map 6.5.3 → 6.5.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/lib/map.rb +3 -3
- data/map.gemspec +1 -1
- data/test/map_test.rb +11 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ZjAxZjU1M2RmNmE0ZWNlY2ZmMjM2ODhhYzg2YTljNTkzYTY0YTUyMg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ZjNlOTJiNmFiYzljZjYzMWFiOGM5YmViM2Y2YTU1NDIwZDIxZjUzNA==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
YzQzMTQ5ZWQ2NTliNWJkZTFjMTk4MWRmMjEwMGM1OTU0NGRlNWYwOGUwYzZj
|
10
|
+
OWNhMzZlNzRiYTM1NzJkZTRjYzQ5NDFhNTI3YjY1Y2UzMDA5OGNiZjhjOGM4
|
11
|
+
YzlmYWViYzdjNzk4ZjAyOGZhNGIxODlkZjEwZjJmMDA1NWI1Y2Q=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
N2M0MWE0YmM1MzBlNjI5MjNkZDhmYjg1NDQ3ZGU0ZTJkNGJlNTM2NDA0YzJl
|
14
|
+
ZjY1MjhhODhlZjRmZTNlOGVhMTExOTJiZmJkYWE3Njk5ZDVkZDQ2OTRiMjIw
|
15
|
+
ODM5MzQ3NWU0ZjJjY2FmNGI2OTgyMGZhNTBmNjQ1N2U0NzdhYjA=
|
data/lib/map.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# -*- encoding : utf-8 -*-
|
2
2
|
class Map < Hash
|
3
|
-
Version = '6.5.
|
3
|
+
Version = '6.5.4' unless defined?(Version)
|
4
4
|
Load = Kernel.method(:load) unless defined?(Load)
|
5
5
|
|
6
6
|
class << Map
|
@@ -774,8 +774,8 @@ class Map < Hash
|
|
774
774
|
has_key =
|
775
775
|
case collection
|
776
776
|
when Array
|
777
|
-
key = (Integer(key) rescue
|
778
|
-
|
777
|
+
key = (Integer(key) rescue nil)
|
778
|
+
!!collection.fetch(key) rescue false
|
779
779
|
|
780
780
|
when Hash
|
781
781
|
collection.has_key?(key)
|
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 = "6.5.
|
6
|
+
spec.version = "6.5.4"
|
7
7
|
spec.platform = Gem::Platform::RUBY
|
8
8
|
spec.summary = "map"
|
9
9
|
spec.description = "the awesome ruby container you've always wanted: a string/symbol indifferent ordered hash that works in all rubies"
|
data/test/map_test.rb
CHANGED
@@ -365,6 +365,17 @@ Testing Map do
|
|
365
365
|
assert{ Map.new.tap{|nm| nm.set({})} =~ {} }
|
366
366
|
end
|
367
367
|
|
368
|
+
testing 'that maps support compound key/val getting, setting, and checking with negative array indexes' do
|
369
|
+
m = Map.new(a: [b: :c])
|
370
|
+
assert { m.get(:a, '-1', :b) == m.get(:a, '-1').get(:b) }
|
371
|
+
assert { m.get(:a, '-1', :b) == :c }
|
372
|
+
|
373
|
+
assert { m.set(:a, '-1', :b, :d) }
|
374
|
+
assert { m.get(:a, '-1', :b) == :d }
|
375
|
+
|
376
|
+
assert { m.has?(:a, '-1', :b) == true}
|
377
|
+
end
|
378
|
+
|
368
379
|
testing 'that Map#get supports providing a default value in a block' do
|
369
380
|
m = Map.new
|
370
381
|
m.set(:a, :b, :c, 42)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: map
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 6.5.
|
4
|
+
version: 6.5.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ara T. Howard
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-06-18 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: ! 'the awesome ruby container you''ve always wanted: a string/symbol
|
14
14
|
indifferent ordered hash that works in all rubies'
|