Sha256: 8df82c85a67c8d44baae1abd2c5b4364db3fda9d00e79c5491d3c618d580e786

Contents?: true

Size: 272 Bytes

Versions: 3

Compression:

Stored size: 272 Bytes

Contents

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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
vellam-0.1.2 lib/babel/deserializer.rb~
vellam-0.1.1 lib/babel/deserializer.rb~
vellam-0.1 lib/babel/deserializer.rb~