Sha256: a36096aa6d043e914a1dc4fa84bf47e63a9cd525880f1bd6302fc4816a07df84
Contents?: true
Size: 666 Bytes
Versions: 2
Compression:
Stored size: 666 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_accessor :yml def default_directory 'config/data' end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
data_magic-0.9 | lib/data_magic.rb |
data_magic-0.8 | lib/data_magic.rb |