Class: ArrayModel

Inherits:
ReactiveArray show all
Includes:
ModelWrapper
Defined in:
lib/volt/models/array_model.rb

Instance Method Summary collapse

Methods included from ModelWrapper

#wrap_value, #wrap_values

Methods inherited from ReactiveArray

#==, #[]=, #delete_at, #insert, #inspect, #method_missing, #split_scope, #trigger_for_index!, #trigger_on_direct_listeners!, #trigger_size_change!

Methods included from ObjectTracking

#__setup_tracking

Methods included from ReactiveTags

included, #reactive_method_tag

Constructor Details

#initialize(array = [], parent = nil, path = nil) ⇒ ArrayModel

Returns a new instance of ArrayModel.



6
7
8
9
10
11
12
13
# File 'lib/volt/models/array_model.rb', line 6

def initialize(array=[], parent=nil, path=nil)
  @parent = parent
  @path = path
  
  array = wrap_values(array)
  
  super(array)
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class ReactiveArray

Instance Method Details

#+(*args) ⇒ Object

Make sure it gets wrapped



33
34
35
36
# File 'lib/volt/models/array_model.rb', line 33

def +(*args)
  args = wrap_values(args)
  super(*args)
end

#<<(*args) ⇒ Object

Make sure it gets wrapped



20
21
22
23
24
# File 'lib/volt/models/array_model.rb', line 20

def <<(*args)
  args = wrap_values(args)
  
  super(*args)
end

#attributesObject



15
16
17
# File 'lib/volt/models/array_model.rb', line 15

def attributes
  self
end

#inject(*args) ⇒ Object

Make sure it gets wrapped



27
28
29
30
# File 'lib/volt/models/array_model.rb', line 27

def inject(*args)
  args = wrap_values(args)
  super(*args)
end