Module: Roar::Representer::JSON::InstanceMethods

Defined in:
lib/roar/representer/json.rb

Instance Method Summary collapse

Instance Method Details

#deserialize(*args) ⇒ Object



40
41
42
# File 'lib/roar/representer/json.rb', line 40

def deserialize(*args)
  from_json(*args)
end

#from_json(document, options = {}) ⇒ Object



29
30
31
32
33
# File 'lib/roar/representer/json.rb', line 29

def from_json(document, options={})
  document = '{}' if document.nil? or document.empty?

  super
end

#serialize(*args) ⇒ Object

Generic entry-point for rendering.



36
37
38
# File 'lib/roar/representer/json.rb', line 36

def serialize(*args)
  to_json(*args)
end

#to_hash(*args) ⇒ Object



24
25
26
27
# File 'lib/roar/representer/json.rb', line 24

def to_hash(*args)
  before_serialize(*args)
  super
end