lib/grape/dsl/inside_route.rb in grape-0.19.2 vs lib/grape/dsl/inside_route.rb in grape-1.0.0
- old
+ new
@@ -44,20 +44,20 @@
declared(passed_param || {}, options, declared_params)
end
end
def declared_hash(passed_params, options, declared_params)
- declared_params.each_with_object(Hashie::Mash.new) do |declared_param, memo|
+ declared_params.each_with_object(passed_params.class.new) do |declared_param, memo|
# If it is not a Hash then it does not have children.
# Find its value or set it to nil.
if !declared_param.is_a?(Hash)
next unless options[:include_missing] || passed_params.key?(declared_param)
memo[optioned_param_key(declared_param, options)] = passed_params[declared_param]
else
declared_param.each_pair do |declared_parent_param, declared_children_params|
next unless options[:include_missing] || passed_params.key?(declared_parent_param)
- passed_children_params = passed_params[declared_parent_param] || Hashie::Mash.new
+ passed_children_params = passed_params[declared_parent_param] || passed_params.class.new
memo[optioned_param_key(declared_parent_param, options)] = declared(passed_children_params, options, declared_children_params)
end
end
end
end