lib/configliere/config_file.rb in configliere-0.3.3 vs lib/configliere/config_file.rb in configliere-0.3.4
- old
+ new
@@ -16,10 +16,12 @@
#
# @option [String] :env
# If an :env option is given, only the indicated subhash is merged. This
# lets you for example specify production / environment / test settings
#
+ # @returns [Configliere::Params] the Settings object
+ #
# @example
# # Read from config/apey_eye.yaml and use settings appropriate for development/staging/production
# Settings.read(root_path('config/apey_eye.yaml'), :env => (ENV['RACK_ENV'] || 'production'))
#
def read handle, options={}
@@ -31,12 +33,13 @@
params = {}
end
params = params[handle] if handle.is_a?(Symbol)
# Extract the :env (production/development/etc)
if options[:env]
- params = params[options[:env]]
+ params = params[options[:env]] || {}
end
deep_merge! params
+ self
end
# save to disk.
# * file is in YAML format, as a hash of handle => param_hash pairs
# * filename defaults to Configliere::DEFAULT_CONFIG_FILE (~/.configliere, probably)