map 2.4.2 → 2.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. data/lib/map.rb +2 -2
  2. data/map.gemspec +1 -1
  3. data/test/map_test.rb +11 -1
  4. metadata +4 -4
data/lib/map.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  class Map < Hash
2
- Version = '2.4.2' unless defined?(Version)
2
+ Version = '2.5.0' unless defined?(Version)
3
3
  Load = Kernel.method(:load) unless defined?(Load)
4
4
 
5
5
  class << Map
@@ -220,7 +220,7 @@ class Map < Hash
220
220
 
221
221
  def self.convert_value(value)
222
222
  conversion_methods.each do |method|
223
- return value.send(method) if value.respond_to?(method)
223
+ return coerce(value.send(method)) if value.respond_to?(method)
224
224
  end
225
225
 
226
226
  case value
data/map.gemspec CHANGED
@@ -3,7 +3,7 @@
3
3
 
4
4
  Gem::Specification::new do |spec|
5
5
  spec.name = "map"
6
- spec.version = "2.4.2"
6
+ spec.version = "2.5.0"
7
7
  spec.platform = Gem::Platform::RUBY
8
8
  spec.summary = "map"
9
9
  spec.description = "description: map kicks the ass"
data/test/map_test.rb CHANGED
@@ -227,7 +227,17 @@ Testing Map do
227
227
  c.add_conversion_method!('to_foobar')
228
228
  assert{ c.conversion_methods.map{|x| x.to_s} == %w( to_foobar to_map ) }
229
229
  o[:foobar] = foobar
230
- assert{ o[:foobar] == foobar }
230
+ assert{ o[:foobar] =~ foobar }
231
+ end
232
+
233
+ testing 'that custom conversion methods are coerced - just in case' do
234
+ map = Map.new
235
+ record = Class.new do
236
+ def to_map() {:id => 42} end
237
+ end
238
+ map.update(:list => [record.new, record.new])
239
+ assert{ map.list.all?{|x| x.is_a?(Map)} }
240
+ assert{ map.list.all?{|x| x.id==42} }
231
241
  end
232
242
 
233
243
  testing 'that map supports basic option parsing for methods' do
metadata CHANGED
@@ -5,9 +5,9 @@ version: !ruby/object:Gem::Version
5
5
  prerelease:
6
6
  segments:
7
7
  - 2
8
- - 4
9
- - 2
10
- version: 2.4.2
8
+ - 5
9
+ - 0
10
+ version: 2.5.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Ara T. Howard
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-02-11 00:00:00 -07:00
18
+ date: 2011-02-13 00:00:00 -07:00
19
19
  default_executable:
20
20
  dependencies: []
21
21