lib/evertils/config.rb in evertils-0.4.0 vs lib/evertils/config.rb in evertils-1.0.0
- old
+ new
@@ -42,18 +42,36 @@
# Get a specific value from the config file data
# Params:
# +name+:: String/symbol key value
def get(name, child = nil)
return @yml[name.to_sym][child.to_sym] unless child.nil?
+
@yml[name.to_sym]
end
# Checks if a key exists
# Params:
# +name+:: String/symbol key value
def exist?(name, child = nil)
return @yml[name].key?(child.to_sym) unless child.nil?
+
@yml.key?(name.to_sym)
+ end
+
+ # Merge a hash into config data
+ # Params:
+ # +hash+:: Any arbitrary hash
+ def merge(hash)
+ @yml.merge!(hash)
+ self
+ end
+
+ def symbolize!
+ @yml = @yml.inject({}) { |h, (k, v)| h[k.to_sym] = v; h}
+ end
+
+ def pluck(*args)
+ @yml.slice(*args)
end
private
# Check if configuration data exists
\ No newline at end of file