Class: RMQViewData

Inherits:
Object show all
Defined in:
lib/project/ruby_motion_query/rmq_view_data.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#activityObject

Returns the value of attribute activity.



2
3
4
# File 'lib/project/ruby_motion_query/rmq_view_data.rb', line 2

def activity
  @activity
end

#builtObject

Returns the value of attribute built.



2
3
4
# File 'lib/project/ruby_motion_query/rmq_view_data.rb', line 2

def built
  @built
end

#eventsObject

Returns the value of attribute events.



2
3
4
# File 'lib/project/ruby_motion_query/rmq_view_data.rb', line 2

def events
  @events
end

#is_screen_root_viewObject

Returns the value of attribute is_screen_root_view.



2
3
4
# File 'lib/project/ruby_motion_query/rmq_view_data.rb', line 2

def is_screen_root_view
  @is_screen_root_view
end

#screenObject

Returns the value of attribute screen.



2
3
4
# File 'lib/project/ruby_motion_query/rmq_view_data.rb', line 2

def screen
  @screen
end

Instance Method Details

#has_style?(name = nil) ⇒ Boolean

view.rmq_data.has_style?(:style_name_here)

Returns:

  • (Boolean)


76
77
78
79
80
81
82
# File 'lib/project/ruby_motion_query/rmq_view_data.rb', line 76

def has_style?(name = nil)
  if name
    self.styles.include?(name)
  else
    RMQ.is_blank?(@_styles)
  end
end

#has_tag?(tag_name = nil) ⇒ Boolean

Check if this view contains a specific tag

Parameters:

  • tag_name (defaults to: nil)

    name of tag to check

Returns:

  • (Boolean)

    true if this view has the tag provided



52
53
54
55
56
57
58
# File 'lib/project/ruby_motion_query/rmq_view_data.rb', line 52

def has_tag?(tag_name = nil)
  if tag_name
    tags.include?(tag_name)
  else
    RMQ.is_blank?(@_tags)
  end
end

#screen_root_view?Boolean

Returns:

  • (Boolean)


4
5
6
# File 'lib/project/ruby_motion_query/rmq_view_data.rb', line 4

def screen_root_view?
  !@is_screen_root_view.nil?
end

#style_nameObject



60
61
62
# File 'lib/project/ruby_motion_query/rmq_view_data.rb', line 60

def style_name
  self.styles.first
end

#style_name=(value) ⇒ Object

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



66
67
68
# File 'lib/project/ruby_motion_query/rmq_view_data.rb', line 66

def style_name=(value)
  self.styles[0] = value
end

#stylesObject

view.rmq_data.styles



71
72
73
# File 'lib/project/ruby_motion_query/rmq_view_data.rb', line 71

def styles
  @_styles ||= []
end

#tag(*tag_or_tags) ⇒ Object

*Do not* use this, use RMQ#tag instead:

Examples:

rmq(my_view).tag(:foo)


21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/project/ruby_motion_query/rmq_view_data.rb', line 21

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_namesArray

Returns Array of tag names assigned to to this view.

Returns:

  • (Array)

    Array of tag names assigned to to this view



14
15
16
# File 'lib/project/ruby_motion_query/rmq_view_data.rb', line 14

def tag_names
  tags.keys
end

#tagsHash

Returns Array of tag names assigned to to this view.

Returns:

  • (Hash)

    Array of tag names assigned to to this view



9
10
11
# File 'lib/project/ruby_motion_query/rmq_view_data.rb', line 9

def tags
  @_tags ||= {}
end

#untag(*tag_or_tags) ⇒ Object

*Do not* use this, use RMQ#untag instead: Do nothing if no tag supplied or tag not present

Examples:

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


42
43
44
45
46
# File 'lib/project/ruby_motion_query/rmq_view_data.rb', line 42

def untag(*tag_or_tags)
  tag_or_tags.flatten.each do |tag_name|
    tags.delete tag_name
  end
end

#validation_errorsObject



84
# File 'lib/project/ruby_motion_query/rmq_view_data.rb', line 84

def validation_errors; @_validation_errors ||= {}; end

#validation_errors=(value) ⇒ Object



85
# File 'lib/project/ruby_motion_query/rmq_view_data.rb', line 85

def validation_errors=(value); @_validation_errors = value; end

#validationsObject



86
# File 'lib/project/ruby_motion_query/rmq_view_data.rb', line 86

def validations; @_validations ||= []; end

#validations=(value) ⇒ Object



87
# File 'lib/project/ruby_motion_query/rmq_view_data.rb', line 87

def validations=(value); @_validations = value; end