lib/grape/dsl/settings.rb in grape-1.7.1 vs lib/grape/dsl/settings.rb in grape-1.8.0
- old
+ new
@@ -107,16 +107,12 @@
def namespace_reverse_stackable_with_hash(key)
settings = get_or_set :namespace_reverse_stackable, key, nil
return if settings.blank?
- result = {}
- settings.each do |setting|
- setting.each do |field, value|
- result[field] ||= value
- end
+ settings.each_with_object({}) do |setting, result|
+ result.merge!(setting) { |_k, s1, _s2| s1 }
end
- result
end
# (see #unset_global_setting)
def unset_namespace_stackable(key)
unset :namespace_stackable, key