Module: Bixby::Jsonify::ClassMethods

Defined in:
lib/bixby_common/util/jsonify.rb

Instance Method Summary collapse

Instance Method Details

#from_json(json) ⇒ Object



14
15
16
17
18
19
# File 'lib/bixby_common/util/jsonify.rb', line 14

def from_json(json)
  json = MultiJson.load(json) if json.kind_of? String
  obj = self.allocate
  json.each{ |k,v| obj.send("#{k}=".to_sym, v) }
  obj
end