Class: ArrayModel
- Inherits:
-
ReactiveArray
- Object
- ReactiveArray
- ArrayModel
- Includes:
- ModelWrapper
- Defined in:
- lib/volt/models/array_model.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#parent ⇒ Object
readonly
Returns the value of attribute parent.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Instance Method Summary collapse
-
#+(*args) ⇒ Object
Make sure it gets wrapped.
-
#<<(*args) ⇒ Object
Make sure it gets wrapped.
- #attributes ⇒ Object
-
#initialize(array = [], parent = nil, path = nil) ⇒ ArrayModel
constructor
A new instance of ArrayModel.
-
#inject(*args) ⇒ Object
Make sure it gets wrapped.
- #new_array_model(*args) ⇒ Object
- #new_model(*args) ⇒ Object
Methods included from ModelWrapper
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
Methods included from ReactiveTags
included, #reactive_method_tag
Constructor Details
#initialize(array = [], parent = nil, path = nil) ⇒ ArrayModel
Returns a new instance of ArrayModel.
8 9 10 11 12 13 14 15 |
# File 'lib/volt/models/array_model.rb', line 8 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 Attribute Details
#parent ⇒ Object (readonly)
Returns the value of attribute parent.
6 7 8 |
# File 'lib/volt/models/array_model.rb', line 6 def parent @parent end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
6 7 8 |
# File 'lib/volt/models/array_model.rb', line 6 def path @path end |
Instance Method Details
#+(*args) ⇒ Object
Make sure it gets wrapped
35 36 37 38 |
# File 'lib/volt/models/array_model.rb', line 35 def +(*args) args = wrap_values(args) super(*args) end |
#<<(*args) ⇒ Object
Make sure it gets wrapped
22 23 24 25 26 |
# File 'lib/volt/models/array_model.rb', line 22 def <<(*args) args = wrap_values(args) super(*args) end |
#attributes ⇒ Object
17 18 19 |
# File 'lib/volt/models/array_model.rb', line 17 def attributes self end |
#inject(*args) ⇒ Object
Make sure it gets wrapped
29 30 31 32 |
# File 'lib/volt/models/array_model.rb', line 29 def inject(*args) args = wrap_values(args) super(*args) end |
#new_array_model(*args) ⇒ Object
44 45 46 |
# File 'lib/volt/models/array_model.rb', line 44 def new_array_model(*args) ArrayModel.new(*args) end |
#new_model(*args) ⇒ Object
40 41 42 |
# File 'lib/volt/models/array_model.rb', line 40 def new_model(*args) Model.new(*args) end |