Class: ViewArray

Inherits:
Object show all
Defined in:
lib/droiuby/wrappers/collection/view_array.rb

Instance Method Summary collapse

Constructor Details

#initialize(elements = []) ⇒ ViewArray

Returns a new instance of ViewArray.



3
4
5
# File 'lib/droiuby/wrappers/collection/view_array.rb', line 3

def initialize(elements = [])
  @elements = elements
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(meth, *args, &block) ⇒ Object



7
8
9
# File 'lib/droiuby/wrappers/collection/view_array.rb', line 7

def method_missing(meth, *args, &block)
  @elements.send(meth, *args, &block)
end

Instance Method Details

#on(symbol, &block) ⇒ Object



11
12
13
14
15
# File 'lib/droiuby/wrappers/collection/view_array.rb', line 11

def on(symbol, &block)
  @elements.each { |elem|
    elem.on(symbol, &block)
  }
end

#to_aObject



17
18
19
# File 'lib/droiuby/wrappers/collection/view_array.rb', line 17

def to_a
  @elements
end