Module: Reflex::ModelOwner
- Included in:
- ModelView
- Defined in:
- lib/reflex/model_owner.rb
Instance Attribute Summary collapse
-
#model ⇒ Object
Returns the value of attribute model.
Instance Method Summary collapse
- #data ⇒ Object
- #data=(data) ⇒ Object
- #invoke(*args) ⇒ Object
- #on_data_attach(e) ⇒ Object
- #on_data_detach(e) ⇒ Object
Instance Attribute Details
#model ⇒ Object
Returns the value of attribute model.
12 13 14 |
# File 'lib/reflex/model_owner.rb', line 12 def model @model end |
Instance Method Details
#data ⇒ Object
32 33 34 |
# File 'lib/reflex/model_owner.rb', line 32 def data () @model ? @model.data : nil end |
#data=(data) ⇒ Object
22 23 24 25 26 27 28 29 30 |
# File 'lib/reflex/model_owner.rb', line 22 def data= (data) unless data.nil? self.model = Model.new unless @model @model.data = data else self.model = nil end data end |
#invoke(*args) ⇒ Object
36 37 38 |
# File 'lib/reflex/model_owner.rb', line 36 def invoke (*args) @model.invoke *args if @model end |
#on_data_attach(e) ⇒ Object
40 41 42 |
# File 'lib/reflex/model_owner.rb', line 40 def on_data_attach (e) invoke :update, {}, only: self end |
#on_data_detach(e) ⇒ Object
44 45 46 |
# File 'lib/reflex/model_owner.rb', line 44 def on_data_detach (e) invoke :update, {}, only: self end |