lib/brief/data.rb in brief-1.17.8 vs lib/brief/data.rb in brief-1.17.9
- old
+ new
@@ -21,10 +21,17 @@
def initialize(options={})
@root = options.fetch(:root) { Pathname(Brief.pwd).join('data') }
@sources = {}.to_mash
load_files.each do |source, data|
- @sources[source] = Queryable.new(data)
+ if data.is_a?(Hash)
+ @sources[source] = data.keys.inject({}.to_mash) do |memo, key|
+ memo[key] = Queryable.new(data[key])
+ memo
+ end
+ elsif data.is_a?(Array)
+ @sources[source] = Queryable.new(data)
+ end
end
end
def method_missing(meth, *args, &block)
return sources.send(meth, *args, &block) if sources.key?(meth)