Class: ArrayModel
- Inherits:
-
ReactiveArray
- Object
- ReactiveArray
- ArrayModel
- Includes:
- ModelWrapper
- Defined in:
- lib/volt/models/array_model.rb
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#parent ⇒ Object
readonly
Returns the value of attribute parent.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#persistor ⇒ Object
readonly
Returns the value of attribute persistor.
Instance Method Summary collapse
-
#+(*args) ⇒ Object
Make sure it gets wrapped.
-
#<<(*args) ⇒ Object
Make sure it gets wrapped.
- #attributes ⇒ Object
-
#initialize(array = [], options = {}) ⇒ 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, #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 = [], options = {}) ⇒ ArrayModel
Returns a new instance of ArrayModel.
8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/volt/models/array_model.rb', line 8 def initialize(array=[], ={}) = @parent = [:parent] @path = [:path] || [] @persistor = setup_persistor([:persistor]) array = wrap_values(array) super(array) @persistor.loaded if @persistor end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class ReactiveArray
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
6 7 8 |
# File 'lib/volt/models/array_model.rb', line 6 def end |
#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 |
#persistor ⇒ Object (readonly)
Returns the value of attribute persistor.
6 7 8 |
# File 'lib/volt/models/array_model.rb', line 6 def persistor @persistor end |
Instance Method Details
#+(*args) ⇒ Object
Make sure it gets wrapped
41 42 43 44 |
# File 'lib/volt/models/array_model.rb', line 41 def +(*args) args = wrap_values(args) super(*args) end |
#<<(*args) ⇒ Object
Make sure it gets wrapped
26 27 28 29 30 31 32 |
# File 'lib/volt/models/array_model.rb', line 26 def <<(*args) args = wrap_values(args) super(*args) @persistor.added(args[0]) if @persistor end |
#attributes ⇒ Object
21 22 23 |
# File 'lib/volt/models/array_model.rb', line 21 def attributes self end |
#inject(*args) ⇒ Object
Make sure it gets wrapped
35 36 37 38 |
# File 'lib/volt/models/array_model.rb', line 35 def inject(*args) args = wrap_values(args) super(*args) end |
#new_array_model(*args) ⇒ Object
50 51 52 |
# File 'lib/volt/models/array_model.rb', line 50 def new_array_model(*args) ArrayModel.new(*args) end |
#new_model(*args) ⇒ Object
46 47 48 |
# File 'lib/volt/models/array_model.rb', line 46 def new_model(*args) Model.new(*args) end |