ethon 0.4.0 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -2,7 +2,16 @@
2
2
 
3
3
  ## Master
4
4
 
5
- [Full Changelog](http://github.com/typhoeus/ethon/compare/v0.4.0...master)
5
+ [Full Changelog](http://github.com/typhoeus/ethon/compare/v0.4.1...master)
6
+
7
+ ## 0.4.1
8
+
9
+ [Full Changelog](http://github.com/typhoeus/ethon/compare/v0.4.0...v0.4.1)
10
+
11
+ Bugfixes:
12
+
13
+ * Handle nested hash in an array in params correct
14
+ ( [\#201](https://github.com/typhoeus/typhoeus/issues/201) )
6
15
 
7
16
  ## 0.4.0
8
17
 
@@ -36,7 +36,7 @@ module Ethon
36
36
  #
37
37
  # @return [ Class ] The action class.
38
38
  def fabricate(action_name)
39
- eval("#{action_name.to_s.capitalize}")
39
+ Ethon::Easies::Http.const_get(action_name.to_s.capitalize)
40
40
  end
41
41
  end
42
42
  end
@@ -60,17 +60,16 @@ module Ethon
60
60
 
61
61
  pairs = []
62
62
  recursive = Proc.new do |h, prefix|
63
- h.each_pair do |k,v|
64
- key = prefix == '' ? k : "#{prefix}[#{k}]"
65
- case v
66
- when Hash
67
- recursive.call(v, key)
68
- when Array
69
- v.each { |x| pairs << [key, x] }
70
- when File, Tempfile
71
- pairs << [Util.escape_zero_byte(key), file_info(v)]
72
- else
73
- pairs << [Util.escape_zero_byte(key), Util.escape_zero_byte(v)]
63
+ case h
64
+ when Hash
65
+ h.each_pair do |k,v|
66
+ key = prefix == '' ? k : "#{prefix}[#{k}]"
67
+ pairs_for(v, key, pairs, recursive)
68
+ end
69
+ when Array
70
+ h.each_with_index do |v, i|
71
+ key = "#{prefix}[#{i}]"
72
+ pairs_for(v, key, pairs, recursive)
74
73
  end
75
74
  end
76
75
  end
@@ -95,6 +94,21 @@ module Ethon
95
94
  File.expand_path(file.path)
96
95
  ]
97
96
  end
97
+
98
+ private
99
+
100
+ def pairs_for(v, key, pairs, recursive)
101
+ case v
102
+ when Hash
103
+ recursive.call(v, key)
104
+ when Array
105
+ recursive.call(v, key)
106
+ when File, Tempfile
107
+ pairs << [Util.escape_zero_byte(key), file_info(v)]
108
+ else
109
+ pairs << [Util.escape_zero_byte(key), Util.escape_zero_byte(v)]
110
+ end
111
+ end
98
112
  end
99
113
  end
100
114
  end
@@ -1,5 +1,5 @@
1
1
  module Ethon
2
2
 
3
3
  # Ethon version.
4
- VERSION = '0.4.0'
4
+ VERSION = '0.4.1'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ethon
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-07-06 00:00:00.000000000 Z
12
+ date: 2012-07-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: ffi
@@ -264,7 +264,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
264
264
  version: '0'
265
265
  segments:
266
266
  - 0
267
- hash: 2336974979301889597
267
+ hash: 1338934003639649204
268
268
  required_rubygems_version: !ruby/object:Gem::Requirement
269
269
  none: false
270
270
  requirements: