Class: RMQViewData
- Defined in:
- lib/project/ruby_motion_query/rmq_view_data.rb
Instance Attribute Summary collapse
-
#built ⇒ Object
, :cache_queries.
-
#cached_rmq ⇒ Object
, :cache_queries.
-
#events ⇒ Object
, :cache_queries.
-
#is_screen_root_view ⇒ Object
, :cache_queries.
-
#screen ⇒ Object
, :cache_queries.
Instance Method Summary collapse
- #activity ⇒ Object
- #cleanup ⇒ Object
- #clear_query_cache ⇒ Object
-
#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.
- #query_cache ⇒ Object
- #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
#built ⇒ Object
, :cache_queries
2 3 4 |
# File 'lib/project/ruby_motion_query/rmq_view_data.rb', line 2 def built @built end |
#cached_rmq ⇒ Object
, :cache_queries
2 3 4 |
# File 'lib/project/ruby_motion_query/rmq_view_data.rb', line 2 def cached_rmq @cached_rmq end |
#events ⇒ Object
, :cache_queries
2 3 4 |
# File 'lib/project/ruby_motion_query/rmq_view_data.rb', line 2 def events @events end |
#is_screen_root_view ⇒ Object
, :cache_queries
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
, :cache_queries
2 3 4 |
# File 'lib/project/ruby_motion_query/rmq_view_data.rb', line 2 def screen @screen end |
Instance Method Details
#activity ⇒ Object
34 35 36 37 38 |
# File 'lib/project/ruby_motion_query/rmq_view_data.rb', line 34 def activity if @screen @screen.getActivity end end |
#cleanup ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# 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 = nil @_styles = nil @_validation_errors = nil @validation_errors = nil @is_screen_root_view = false @built = false nil end |
#clear_query_cache ⇒ Object
30 31 32 |
# File 'lib/project/ruby_motion_query/rmq_view_data.rb', line 30 def clear_query_cache @query_cache = {} end |
#has_style?(name = nil) ⇒ Boolean
view.rmq_data.has_style?(:style_name_here)
108 109 110 111 112 113 114 |
# 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) ⇒ Boolean
Check if this view contains a specific tag
84 85 86 87 88 89 90 |
# File 'lib/project/ruby_motion_query/rmq_view_data.rb', line 84 def has_tag?(tag_name = nil) if tag_name .include?(tag_name) else RMQ.is_blank?() end end |
#query_cache ⇒ Object
26 27 28 |
# File 'lib/project/ruby_motion_query/rmq_view_data.rb', line 26 def query_cache @_query_cache ||= {} 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
92 93 94 |
# File 'lib/project/ruby_motion_query/rmq_view_data.rb', line 92 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
98 99 100 |
# File 'lib/project/ruby_motion_query/rmq_view_data.rb', line 98 def style_name=(value) self.styles[0] = value end |
#styles ⇒ Object
view.rmq_data.styles
103 104 105 |
# File 'lib/project/ruby_motion_query/rmq_view_data.rb', line 103 def styles @_styles ||= [] end |
#tag(*tag_or_tags) ⇒ Object
*Do not* use this, use RMQ#tag instead:
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/project/ruby_motion_query/rmq_view_data.rb', line 53 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
46 47 48 |
# File 'lib/project/ruby_motion_query/rmq_view_data.rb', line 46 def tag_names .keys end |
#tags ⇒ Hash
41 42 43 |
# File 'lib/project/ruby_motion_query/rmq_view_data.rb', line 41 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
74 75 76 77 78 |
# File 'lib/project/ruby_motion_query/rmq_view_data.rb', line 74 def untag(*) .flatten.each do |tag_name| .delete tag_name end end |
#validation_errors ⇒ Object
116 |
# File 'lib/project/ruby_motion_query/rmq_view_data.rb', line 116 def validation_errors; @_validation_errors ||= {}; end |
#validation_errors=(value) ⇒ Object
117 |
# File 'lib/project/ruby_motion_query/rmq_view_data.rb', line 117 def validation_errors=(value); @_validation_errors = value; end |
#validations ⇒ Object
118 |
# File 'lib/project/ruby_motion_query/rmq_view_data.rb', line 118 def validations; @_validations ||= []; end |
#validations=(value) ⇒ Object
119 |
# File 'lib/project/ruby_motion_query/rmq_view_data.rb', line 119 def validations=(value); @_validations = value; end |