Class: RubyMotionQuery::ViewData

Inherits:
Object
  • Object
show all
Defined in:
motion/ruby_motion_query/data.rb

Instance Attribute Summary (collapse)

Instance Method Summary (collapse)

Instance Attribute Details

- (Object) events

Returns the value of attribute events



3
4
5
# File 'motion/ruby_motion_query/data.rb', line 3

def events
  @events
end

- (Object) style_name

Returns the value of attribute style_name



3
4
5
# File 'motion/ruby_motion_query/data.rb', line 3

def style_name
  @style_name
end

Instance Method Details

- (Boolean) has_tag?(tag_name = nil)

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



39
40
41
42
43
44
45
# File 'motion/ruby_motion_query/data.rb', line 39

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

- (Object) tag(*tag_or_tags)

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

Examples:

rmq(my_view).tag(:foo)


18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'motion/ruby_motion_query/data.rb', line 18

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

- (Array) tag_names

Returns Array of tag names assigned to to this view

Returns:

  • (Array)

    Array of tag names assigned to to this view



11
12
13
# File 'motion/ruby_motion_query/data.rb', line 11

def tag_names
  tags.keys
end

- (Hash) tags

Returns Array of tag names assigned to to this view

Returns:

  • (Hash)

    Array of tag names assigned to to this view



6
7
8
# File 'motion/ruby_motion_query/data.rb', line 6

def tags
  @_tags ||= {}
end

- (Object) view_controller



51
52
53
# File 'motion/ruby_motion_query/data.rb', line 51

def view_controller
  @view_controller
end

- (Object) view_controller=(value)



47
48
49
# File 'motion/ruby_motion_query/data.rb', line 47

def view_controller=(value)
  @view_controller = RubyMotionQuery::RMQ.weak_ref(value)
end