Class: RMQViewData
- Defined in:
- lib/project/ruby_motion_query/rmq_view_data.rb
Instance Attribute Summary collapse
-
#activity ⇒ Object
Returns the value of attribute activity.
-
#built ⇒ Object
Returns the value of attribute built.
-
#events ⇒ Object
Returns the value of attribute events.
-
#is_screen_root_view ⇒ Object
Returns the value of attribute is_screen_root_view.
-
#screen ⇒ Object
Returns the value of attribute screen.
Instance Method Summary collapse
-
#has_style?(name = nil) ⇒ Boolean
view.rmq_data.has_style?(:style_name_here).
-
#has_tag?(tag_name = nil) ⇒ Boolean
Check if this view contains a specific tag.
- #screen_root_view? ⇒ Boolean
- #style_name ⇒ Object
-
#style_name=(value) ⇒ Object
Sets first style name, this is only here for backwards compatibility and as a convenience method.
-
#styles ⇒ Object
view.rmq_data.styles.
-
#tag(*tag_or_tags) ⇒ Object
*Do not* use this, use RMQ#tag instead:.
-
#tag_names ⇒ Array
Array of tag names assigned to to this view.
-
#tags ⇒ Hash
Array of tag names assigned to to this view.
-
#untag(*tag_or_tags) ⇒ Object
*Do not* use this, use RMQ#untag instead: Do nothing if no tag supplied or tag not present.
- #validation_errors ⇒ Object
- #validation_errors=(value) ⇒ Object
- #validations ⇒ Object
- #validations=(value) ⇒ Object
Instance Attribute Details
#activity ⇒ Object
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 |
#built ⇒ Object
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 |
#events ⇒ Object
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_view ⇒ Object
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 |
#screen ⇒ Object
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)
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
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 .include?(tag_name) else RMQ.is_blank?() end end |
#screen_root_view? ⇒ 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_name ⇒ Object
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 |
#styles ⇒ Object
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:
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(*) .flatten! = .first if .length == 1 if .is_a?(Array) .each do |tag_name| [tag_name] = 1 end elsif .is_a?(Hash) .each do |tag_name, tag_value| [tag_name] = tag_value end elsif .is_a?(Symbol) [] = 1 end end |
#tag_names ⇒ Array
Returns 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 .keys end |
#tags ⇒ Hash
Returns 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 ||= {} end |
#untag(*tag_or_tags) ⇒ Object
*Do not* use this, use RMQ#untag instead: Do nothing if no tag supplied or tag not present
42 43 44 45 46 |
# File 'lib/project/ruby_motion_query/rmq_view_data.rb', line 42 def untag(*) .flatten.each do |tag_name| .delete tag_name end end |
#validation_errors ⇒ Object
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 |
#validations ⇒ Object
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 |