Module: Lolita::ObservedArray

Included in:
Configuration::Columns, Configuration::Fields, Configuration::Tabs
Defined in:
lib/lolita/observed_array.rb

Overview

end

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

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



35
36
37
38
# File 'lib/lolita/observed_array.rb', line 35

def method_missing(method,*args,&block)
  generate_collection_elements! if self.respond_to?(:generate_collection_elements!)
  collection_variable.__send__(method,*args,&block)
end

Instance Method Details

#<<(value) ⇒ Object



50
51
52
53
# File 'lib/lolita/observed_array.rb', line 50

def <<(value)
  value=build_element(value)
  collection_variable<<value
end

#[]=(value, index) ⇒ Object



55
56
57
58
# File 'lib/lolita/observed_array.rb', line 55

def []=(value,index)
  value=build_element(value)
  collection_variable[index]=value
end

#eachObject

To support enumerable functions as each, collect etc.



61
62
63
# File 'lib/lolita/observed_array.rb', line 61

def each
  collection_variable.each{|collection_element| yield collection_element}
end

#insert(value) ⇒ Object



45
46
47
48
# File 'lib/lolita/observed_array.rb', line 45

def insert(value)
  value=build_element(value)
  collection_variable.insert(value)
end

#push(value) ⇒ Object



40
41
42
43
# File 'lib/lolita/observed_array.rb', line 40

def push(value)
  value=build_element(value)
  collection_variable.push(value)
end