Sha256: ab36f06d54b6f9e8c1a9f8df47f1ec07e9398b22ec457619588467235270c0fa
Contents?: true
Size: 664 Bytes
Versions: 1
Compression:
Stored size: 664 Bytes
Contents
require "data_magic/version" require "data_magic/translation" require 'yml_reader' require 'faker' module DataMagic include Translation extend YmlReader def data_for(key, additional={}) DataMagic.load('default.yml') unless DataMagic.yml data = DataMagic.yml[key.to_s] prep_data data.merge(additional).clone end private def prep_data(data) data.each do |key, value| unless value.nil? next unless value.respond_to? '[]' data[key] = eval(value[1..-1]) if value[0,1] == "~" end end data end class << self attr_reader :yml def default_directory 'config/data' end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
data_magic-0.7 | lib/data_magic.rb |