Skip to content

Commit

Permalink
fix spec deprecation warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
vast committed Sep 12, 2013
1 parent 911c619 commit 1071c8b
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/api_taster/route.rb
Original file line number Diff line number Diff line change
Expand Up @@ -129,13 +129,19 @@ def split_input(input, route)
url_param_keys = route[:path].scan /:\w+/

url_params = input.reject { |k, v| ! ":#{k}".in?(url_param_keys) }
post_params = input.diff(url_params)
post_params = hash_diff(input, url_params)

{
:url_params => url_params,
:post_params => post_params
}
end

def hash_diff(h1, h2)
h1.dup.delete_if do |k, v|
h2[k] == v
end.merge!(h2.dup.delete_if { |k, v| h1.has_key?(k) })
end
end
end
end

0 comments on commit 1071c8b

Please sign in to comment.