Sha256: b834ad3544ad62df8b4a36aa7192e5b72065b9605dc0b03d2a9810e827da19c2
Contents?: true
Size: 499 Bytes
Versions: 5
Compression:
Stored size: 499 Bytes
Contents
require 'yaml' module DataSeeder module Loader class YAML include Loader def load(io) yaml = ::YAML.load(io.read) if yaml.kind_of?(Hash) yaml.each do |key, attr| attr[self.key_attribute] = key if self.key_attribute save(attr) end elsif yaml.kind_of?(Array) yaml.each { |attr| save(attr) } else raise "Don't know how to interpret #{self.path}" end end end end end
Version data entries
5 entries across 5 versions & 1 rubygems