Class: Editables::DataEditable
- Inherits:
-
Object
- Object
- Editables::DataEditable
- Defined in:
- lib/editables/data_editable.rb
Instance Attribute Summary collapse
-
#instance ⇒ Object
Returns the value of attribute instance.
-
#model ⇒ Object
Returns the value of attribute model.
-
#param ⇒ Object
Returns the value of attribute param.
-
#route ⇒ Object
Returns the value of attribute route.
-
#value ⇒ Object
Returns the value of attribute value.
Instance Method Summary collapse
-
#initialize(field, param = :value) ⇒ DataEditable
constructor
format :json should be dealt by the frontend api.
Constructor Details
#initialize(field, param = :value) ⇒ DataEditable
format :json should be dealt by the frontend api
5 6 7 8 9 10 11 |
# File 'lib/editables/data_editable.rb', line 5 def initialize(field, param = :value) @route ="/#{field.class.to_s.underscore.pluralize}/#{field.id}" @model = field.class.to_s.underscore.split('/').last @param = param @value = field.send(param) @instance = field end |
Instance Attribute Details
#instance ⇒ Object
Returns the value of attribute instance.
3 4 5 |
# File 'lib/editables/data_editable.rb', line 3 def instance @instance end |
#model ⇒ Object
Returns the value of attribute model.
3 4 5 |
# File 'lib/editables/data_editable.rb', line 3 def model @model end |
#param ⇒ Object
Returns the value of attribute param.
3 4 5 |
# File 'lib/editables/data_editable.rb', line 3 def param @param end |
#route ⇒ Object
Returns the value of attribute route.
3 4 5 |
# File 'lib/editables/data_editable.rb', line 3 def route @route end |
#value ⇒ Object
Returns the value of attribute value.
3 4 5 |
# File 'lib/editables/data_editable.rb', line 3 def value @value end |