Permalink
Browse files

standardize on each (instead of for) on enumerables

matches with better benchmarks on 1.9+ and remove inconsistency
  • Loading branch information...
1 parent c880625 commit 9f552aa30d3a5552b58cf5832ca6626f405d42d6 @geemus geemus committed Jul 5, 2012
Showing with 9 additions and 5 deletions.
  1. +4 −0 .travis.yml
  2. +5 −5 lib/excon/connection.rb
View
@@ -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"
View
@@ -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
@@ -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
@@ -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

0 comments on commit 9f552aa

Please sign in to comment.