lib/elasticonf/loader.rb in elasticonf-1.0.0 vs lib/elasticonf/loader.rb in elasticonf-1.1.0

- old
+ new

@@ -1,4 +1,17 @@ module ElastiConf class Loader < Hashie::Mash + def get(key) + unless [String, Symbol].include?(key.class) + raise ArgumentError, "String or Symbol expected #{key.class} given" + end + + hash, items = self, key.split('.') + + while (item = items.shift) + (hash = hash[item.to_sym]) || break + end + + hash + end end end \ No newline at end of file