insensitive_hash 0.2.0 → 0.2.1
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.
data/CHANGELOG.markdown
CHANGED
@@ -235,11 +235,6 @@ class TestInsensitiveHash < Test::Unit::TestCase
|
|
235
235
|
assert_equal 3, h.each.count
|
236
236
|
end
|
237
237
|
|
238
|
-
def test_fetch
|
239
|
-
h = InsensitiveHash[{ :a => 1, :b => 2, :c => 3}]
|
240
|
-
assert_raise(KeyError) { h.fetch('D') }
|
241
|
-
end
|
242
|
-
|
243
238
|
def test_has_value
|
244
239
|
h = InsensitiveHash[{ :a => 1, :b => 2, :c => 3}]
|
245
240
|
assert h.value?(3)
|
@@ -272,5 +267,16 @@ class TestInsensitiveHash < Test::Unit::TestCase
|
|
272
267
|
h = InsensitiveHash[{:a => 1, :b => 2}]
|
273
268
|
assert_equal [2, 1], h.values_at('B', :A)
|
274
269
|
end
|
270
|
+
|
271
|
+
def test_fetch
|
272
|
+
h = InsensitiveHash[{:a => 1, :b => 2}]
|
273
|
+
['a', 'A', :A].each do |k|
|
274
|
+
assert_equal 1, h.fetch(k)
|
275
|
+
assert_equal 1, h.fetch(k) { nil }
|
276
|
+
end
|
277
|
+
assert_equal 3, h.fetch(:c, 3)
|
278
|
+
assert_equal 3, h.fetch(:c) { 3 }
|
279
|
+
assert_raise(KeyError) { h.fetch('D') }
|
280
|
+
end
|
275
281
|
end
|
276
282
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: insensitive_hash
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-02-
|
12
|
+
date: 2012-02-10 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: test-unit
|
16
|
-
requirement: &
|
16
|
+
requirement: &2152981220 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,7 +21,7 @@ dependencies:
|
|
21
21
|
version: 2.3.0
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *2152981220
|
25
25
|
description: Hash with case-insensitive, Symbol/String-indifferent key access
|
26
26
|
email:
|
27
27
|
- junegunn.c@gmail.com
|