map 4.5.1 → 4.6.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 +7 -1
  2. data/map.gemspec +1 -1
  3. data/test/map_test.rb +10 -1
  4. metadata +5 -5
data/lib/map.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  class Map < Hash
2
- Version = '4.5.1' unless defined?(Version)
2
+ Version = '4.6.0' unless defined?(Version)
3
3
  Load = Kernel.method(:load) unless defined?(Load)
4
4
 
5
5
  class << Map
@@ -623,6 +623,12 @@ class Map < Hash
623
623
  end
624
624
  end
625
625
 
626
+ def respond_to?(method)
627
+ has_key = has_key?(method)
628
+ setter = method.to_s =~ /=\Z/o
629
+ (!has_key and setter) or has_key or super
630
+ end
631
+
626
632
  def id
627
633
  return self[:id] if has_key?(:id)
628
634
  return self[:_id] if has_key?(:_id)
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 = "4.5.1"
6
+ spec.version = "4.6.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
@@ -298,7 +298,7 @@ Testing Map do
298
298
  assert{ m.to_list == [:a, :b, :c] }
299
299
  end
300
300
 
301
- testing 'that method missing hacks allow setting values, but not getting them until they are set' do
301
+ testing 'that method_missing hacks allow setting values, but not getting them until they are set' do
302
302
  m = Map.new
303
303
  assert{ (m.missing rescue $!).is_a?(Exception) }
304
304
  assert{ m.missing = :val }
@@ -306,6 +306,15 @@ Testing Map do
306
306
  assert{ m.missing == :val }
307
307
  end
308
308
 
309
+ testing 'that method_missing hacks have sane respond_to? semantics' do
310
+ m = Map.new
311
+ assert{ !m.respond_to?(:missing) }
312
+ assert{ m.respond_to?(:missing=) }
313
+ assert{ m.missing = :val }
314
+ assert{ m.respond_to?(:missing) }
315
+ assert{ m.respond_to?(:missing=) }
316
+ end
317
+
309
318
  testing 'that method missing with a block delegatets to fetch' do
310
319
  m = Map.new
311
320
  assert{ m.missing{ :val } == :val }
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: map
3
3
  version: !ruby/object:Gem::Version
4
- hash: 41
4
+ hash: 39
5
5
  prerelease:
6
6
  segments:
7
7
  - 4
8
- - 5
9
- - 1
10
- version: 4.5.1
8
+ - 6
9
+ - 0
10
+ version: 4.6.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-09-25 00:00:00 Z
18
+ date: 2011-10-08 00:00:00 Z
19
19
  dependencies: []
20
20
 
21
21
  description: "description: map kicks the ass"