Sha256: 7f39604409ea194cf4f4f7933851c10bc596908404c1d22b95f9a8e7d168a4eb
Contents?: true
Size: 412 Bytes
Versions: 16
Compression:
Stored size: 412 Bytes
Contents
require 'json' module DataSeeder module Loader class JSON include Loader def load(io) json = ::JSON.parse(io.read) if json.kind_of?(Hash) json.each do |key, attr| attr[self.key_attribute] = key if self.key_attribute save(attr) end else Array(json).each { |attr| save(attr) } end end end end end
Version data entries
16 entries across 16 versions & 1 rubygems