Skip to content

Commit

Permalink
standardize on each (instead of for) on enumerables
Browse files Browse the repository at this point in the history
matches with better benchmarks on 1.9+ and remove inconsistency
  • Loading branch information
geemus committed Jul 5, 2012
1 parent c880625 commit 9f552aa
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
4 changes: 4 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
language: ruby

matrix:
allow_failures:
- rvm: rbx

rvm:
- 1.8.7
- 1.9.2
- 1.9.3
- jruby
- rbx
- ree

script: "bundle exec shindont"
10 changes: 5 additions & 5 deletions lib/excon/connection.rb
Original file line number Diff line number Diff line change
Expand Up @@ -186,11 +186,11 @@ def request_kernel(params)
request << '?' << params[:query]
when Hash
request << '?'
for key, values in params[:query]
params[:query].each do |key, values|
if values.nil?
request << key.to_s << '&'
else
for value in [*values]
[*values].each do |value|
request << key.to_s << '=' << CGI.escape(value.to_s) << '&'
end
end
Expand All @@ -210,8 +210,8 @@ def request_kernel(params)
end

# add headers to request
for key, values in params[:headers]
for value in [*values]
params[:headers].each do |key, values|
[*values].each do |value|
request << key.to_s << ': ' << value.to_s << CR_NL
end
end
Expand Down Expand Up @@ -289,7 +289,7 @@ def invoke_stub(params)
end

params[:captures] = {:headers => {}} # setup data to hold captures
for stub, response in Excon.stubs
Excon.stubs.each do |stub, response|
headers_match = !stub.has_key?(:headers) || stub[:headers].keys.all? do |key|
case value = stub[:headers][key]
when Regexp
Expand Down

0 comments on commit 9f552aa

Please sign in to comment.