lib/config_default.rb in config_default-0.1.2 vs lib/config_default.rb in config_default-0.2.0
- old
+ new
@@ -17,14 +17,14 @@
def configure
yield(config) if block_given?
end
def load(name, key: Rails.env, symbolize_keys: false, deep_symbolize_keys: false)
- base_config = load_file("#{name}.#{config.postfix}")
+ default_config = load_file("#{name}.#{config.postfix}")
config = load_file(name)
- data = base_config.deep_merge(config)
+ data = default_config.deep_merge(config)
data = key ? data[key] : data
if deep_symbolize_keys
data.deep_symbolize_keys
elsif symbolize_keys
@@ -40,11 +40,14 @@
rescue
{}
end
def load_struct(name, key: Rails.env, recursive: false, allow_nil: false)
- attributes = load(name, key: key)
- ConfigDefault::Struct.new(attributes, recursive: recursive, allow_nil: allow_nil)
+ ConfigDefault::Struct.new(
+ attributes: load(name, key: key),
+ recursive: recursive,
+ allow_nil: allow_nil,
+ )
end
end
ConfigDefault::RailsMonkeyPatch.call