Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 42afa9e63a
Fetching contributors…

Cannot retrieve contributors at this time

42 lines (33 sloc) 0.804 kb
require 'data_magic/core_ext/string'
require 'data_magic/core_ext/fixnum'
require "data_magic/version"
require "data_magic/translation"
require "data_magic/date_translation"
require 'yml_reader'
require 'faker'
module DataMagic
include Translation
include DateTranslation
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
Jump to Line
Something went wrong with that request. Please try again.