Class: Editables::DataEditable

Inherits:
Object
  • Object
show all
Defined in:
lib/editables/data_editable.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#instanceObject

Returns the value of attribute instance.



3
4
5
# File 'lib/editables/data_editable.rb', line 3

def instance
  @instance
end

#modelObject

Returns the value of attribute model.



3
4
5
# File 'lib/editables/data_editable.rb', line 3

def model
  @model
end

#paramObject

Returns the value of attribute param.



3
4
5
# File 'lib/editables/data_editable.rb', line 3

def param
  @param
end

#routeObject

Returns the value of attribute route.



3
4
5
# File 'lib/editables/data_editable.rb', line 3

def route
  @route
end

#valueObject

Returns the value of attribute value.



3
4
5
# File 'lib/editables/data_editable.rb', line 3

def value
  @value
end