class RMQViewData

Attributes

built[RW]
cached_rmq[RW]
events[RW]
is_screen_root_view[RW]
screen[RW]

Public Instance Methods

activity() click to toggle source
# File lib/project/ruby_motion_query/rmq_view_data.rb, line 34
def activity
  if @screen
    @screen.getActivity
  end
end
cleanup() click to toggle source
# File lib/project/ruby_motion_query/rmq_view_data.rb, line 8
def cleanup
  clear_query_cache
  if @cached_rmq
    @cached_rmq.selectors = nil
    @cached_rmq.parent_rmq = nil
    @cached_rmq = nil
  end
  @events = nil
  @screen = nil
  @_tags = nil
  @_styles = nil
  @_validation_errors = nil
  @validation_errors = nil
  @is_screen_root_view = false
  @built = false
  nil
end
clear_query_cache() click to toggle source
# File lib/project/ruby_motion_query/rmq_view_data.rb, line 30
def clear_query_cache
  @query_cache = {}
end
has_style?(name = nil) click to toggle source

view.rmq_data.has_style?(:style_name_here)

# File lib/project/ruby_motion_query/rmq_view_data.rb, line 108
def has_style?(name = nil)
  if name
    self.styles.include?(name)
  else
    RMQ.is_blank?(@_styles)
  end
end
has_tag?(tag_name = nil) click to toggle source

Check if this view contains a specific tag

@param tag_name name of tag to check @return [Boolean] true if this view has the tag provided

# File lib/project/ruby_motion_query/rmq_view_data.rb, line 84
def has_tag?(tag_name = nil)
  if tag_name
    tags.include?(tag_name)
  else
    RMQ.is_blank?(@_tags)
  end
end
query_cache() click to toggle source
# File lib/project/ruby_motion_query/rmq_view_data.rb, line 26
def query_cache
  @_query_cache ||= {}
end
screen_root_view?() click to toggle source
# File lib/project/ruby_motion_query/rmq_view_data.rb, line 4
def screen_root_view?
  !@is_screen_root_view.nil?
end
style_name() click to toggle source
# File lib/project/ruby_motion_query/rmq_view_data.rb, line 92
def style_name
  self.styles.first
end
style_name=(value) click to toggle source

Sets first style name, this is only here for backwards compatibility and as a convenience method

# File lib/project/ruby_motion_query/rmq_view_data.rb, line 98
def style_name=(value)
  self.styles[0] = value
end
styles() click to toggle source

view.rmq_data.styles

# File lib/project/ruby_motion_query/rmq_view_data.rb, line 103
def styles
  @_styles ||= []
end
tag(*tag_or_tags) click to toggle source

*Do not* use this, use {RMQ#tag} instead: @example

rmq(my_view).tag(:foo)
# File lib/project/ruby_motion_query/rmq_view_data.rb, line 53
def tag(*tag_or_tags)
  tag_or_tags.flatten!
  tag_or_tags = tag_or_tags.first if tag_or_tags.length == 1

  if tag_or_tags.is_a?(Array)
    tag_or_tags.each do |tag_name|
      tags[tag_name] = 1
    end
  elsif tag_or_tags.is_a?(Hash)
    tag_or_tags.each do |tag_name, tag_value|
      tags[tag_name] = tag_value
    end
  elsif tag_or_tags.is_a?(Symbol)
    tags[tag_or_tags] = 1
  end
end
tag_names() click to toggle source

@return [Array] Array of tag names assigned to to this view

# File lib/project/ruby_motion_query/rmq_view_data.rb, line 46
def tag_names
  tags.keys
end
tags() click to toggle source

@return [Hash] Array of tag names assigned to to this view

# File lib/project/ruby_motion_query/rmq_view_data.rb, line 41
def tags
  @_tags ||= {}
end
untag(*tag_or_tags) click to toggle source

*Do not* use this, use {RMQ#untag} instead: @example

rmq(my_view).untag(:foo, :bar)

Do nothing if no tag supplied or tag not present

# File lib/project/ruby_motion_query/rmq_view_data.rb, line 74
def untag(*tag_or_tags)
  tag_or_tags.flatten.each do |tag_name|
    tags.delete tag_name
  end
end
validation_errors() click to toggle source
# File lib/project/ruby_motion_query/rmq_view_data.rb, line 116
def validation_errors; @_validation_errors ||= {}; end
validation_errors=(value) click to toggle source
# File lib/project/ruby_motion_query/rmq_view_data.rb, line 117
def validation_errors=(value); @_validation_errors = value; end
validations() click to toggle source
# File lib/project/ruby_motion_query/rmq_view_data.rb, line 118
def validations; @_validations ||= []; end
validations=(value) click to toggle source
# File lib/project/ruby_motion_query/rmq_view_data.rb, line 119
def validations=(value); @_validations = value; end