Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

standardize on each (instead of for) on enumerables

matches with better benchmarks on 1.9+ and remove inconsistency
  • Loading branch information...
commit 9f552aa30d3a5552b58cf5832ca6626f405d42d6 1 parent c880625
Wesley Beary geemus authored
Showing with 9 additions and 5 deletions.
  1. +4 −0 .travis.yml
  2. +5 −5 lib/excon/connection.rb
4 .travis.yml
View
@@ -1,6 +1,9 @@
+language: ruby
+
matrix:
allow_failures:
- rvm: rbx
+
rvm:
- 1.8.7
- 1.9.2
@@ -8,4 +11,5 @@ rvm:
- jruby
- rbx
- ree
+
script: "bundle exec shindont"
10 lib/excon/connection.rb
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
Please sign in to comment.
Something went wrong with that request. Please try again.