Module: Simplifyapi::Representer
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/simplifyapi/representer.rb
Defined Under Namespace
Modules: ClassMethods
Instance Method Summary collapse
Instance Method Details
#from_json(json) ⇒ Object
16 17 18 |
# File 'lib/simplifyapi/representer.rb', line 16 def from_json json self.class.import @model, ActiveSupport::JSON.decode(json) end |
#initialize(model) ⇒ Object
8 9 10 |
# File 'lib/simplifyapi/representer.rb', line 8 def initialize model @model = model end |
#to_json ⇒ Object
12 13 14 |
# File 'lib/simplifyapi/representer.rb', line 12 def to_json self.class.export(@model).to_json end |