class Babel::Deserializer def initialize(model_class) @model_class = model_class end def from_json(json) data = JSON.parse(json) if data.is_a? Array data.collect{ |d| @model_class.new(d) } else @model_class.new(data) end end end