Browse files

extracted filename to load out to method

  • Loading branch information...
1 parent f65086d commit 63b870d2bb7ff5ec8e70bce88633c607caed04ef @cheezy committed Mar 2, 2014
Showing with 5 additions and 1 deletion.
  1. +5 −1 lib/data_magic.rb
View
6 lib/data_magic.rb
@@ -25,7 +25,7 @@ def data_for(key, additional={})
DataMagic.load("#{filename}.yml")
else
record = key.to_s
- DataMagic.load('default.yml') unless DataMagic.yml
+ DataMagic.load(the_file) unless DataMagic.yml
end
data = DataMagic.yml[record]
raise ArgumentError, "Undefined key #{key}" unless data
@@ -34,6 +34,10 @@ def data_for(key, additional={})
private
+ def the_file
+ 'default.yml'
+ end
+
def prep_data(data)
data.each do |key, value|
unless value.nil?

0 comments on commit 63b870d

Please sign in to comment.