module Representable::JSON
Public Class Methods
Source
# File lib/representable/json.rb, line 14 def self.included(base) base.class_eval do include Representable # either in Hero or HeroRepresentation. extend ClassMethods # DISCUSS: do that only for classes? register_feature Representable::JSON end end
Public Instance Methods
Source
# File lib/representable/json.rb, line 35 def from_json(data, *args) data = MultiJson.load(data) from_hash(data, *args) end
Parses the body as JSON
and delegates to from_hash.
Also aliased as: parse