Class: Loco::RecordArray

Inherits:
Array
  • Object
show all
Includes:
Observable
Defined in:
lib/motion-loco/record_array.rb

Instance Method Summary collapse

Methods included from Observable

included, #init, #initWithFrame, #initWithStyle, #method_missing, #register_observer, #remove_all_observers, #remove_observer, #set_properties

Constructor Details

#initialize(properties = {}) ⇒ RecordArray

Returns a new instance of RecordArray.



22
23
24
25
# File 'lib/motion-loco/record_array.rb', line 22

def initialize(properties={})
  self.init
  self
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Loco::Observable

Instance Method Details

#did_loadObject Also known as: didLoad



8
9
10
# File 'lib/motion-loco/record_array.rb', line 8

def did_load
  # Override to perform actions after loading data
end

#load(type, data) ⇒ Object



13
14
15
16
17
18
19
20
# File 'lib/motion-loco/record_array.rb', line 13

def load(type, data)
  self.removeAllObjects
  data.each do |item_data|
    self.addObject(type.new(item_data))
  end
  self.did_load
  self
end