Module: Frenchy::Model::ClassMethods

Defined in:
lib/frenchy/model.rb

Instance Method Summary collapse

Instance Method Details

#from_hash(hash) ⇒ Object

Create a new instance of the model from a hash



47
48
49
# File 'lib/frenchy/model.rb', line 47

def from_hash(hash)
  new(hash)
end

#from_json(json) ⇒ Object

Create a new instance of the model from JSON



52
53
54
55
# File 'lib/frenchy/model.rb', line 52

def from_json(json)
  hash = JSON.parse(json)
  from_hash(hash)
end