lib/i18n/tasks/configuration.rb in i18n-tasks-0.4.1 vs lib/i18n/tasks/configuration.rb in i18n-tasks-0.4.2
- old
+ new
@@ -7,10 +7,11 @@
CONFIG_FILES = %w(
config/i18n-tasks.yml config/i18n-tasks.yml.erb
i18n-tasks.yml i18n-tasks.yml.erb
)
+
def file_config
file = CONFIG_FILES.detect { |f| File.exists?(f) }
file = YAML.load(Erubis::Eruby.new(File.read(file)).result) if file
{}.with_indifferent_access.merge(file.presence || {})
end
@@ -25,11 +26,11 @@
# @return [{adapter: String, options: Hash}]
def data_config
@config_sections[:data] ||= begin
{
adapter: data.class.name,
- config: data.config
+ config: data.config
}
end
end
def relative_roots
@@ -95,8 +96,15 @@
@config_sections
end
def config_for_inspect
# hide empty sections, stringify keys
- Hash[config_sections.reject { |k, v| v.empty? }.map { |k, v| [k.to_s, v.respond_to?(:stringify_keys) ? v.stringify_keys : v] }]
+ Hash[config_sections.reject { |k, v| v.empty? }.map { |k, v|
+ [k.to_s, v.respond_to?(:stringify_keys) ? v.stringify_keys : v] }].tap do |h|
+ h.each do |_k, v|
+ if v.is_a?(Hash) && v.key?('config')
+ v.merge! v.delete('config')
+ end
+ end
+ end
end
end