insensitive_hash 0.0.1 → 0.0.2
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/README.markdown +1 -1
- data/lib/insensitive_hash.rb +1 -1
- data/lib/insensitive_hash/version.rb +1 -1
- data/test/test_insensitive_hash.rb +6 -3
- metadata +2 -2
data/README.markdown
CHANGED
@@ -42,7 +42,7 @@ ih.delete :Abc # 10
|
|
42
42
|
ih.keys # ['DEF']
|
43
43
|
|
44
44
|
# Hashes and Hashes in Arrays as values are automatically converted to be insensitive
|
45
|
-
# (Useful
|
45
|
+
# (Useful when processing YAML inputs)
|
46
46
|
ih['kids'] = { :hello => [ { :world => '!!!' } ] }
|
47
47
|
ih[:kids]['Hello'].first['WORLD'] # !!!
|
48
48
|
```
|
data/lib/insensitive_hash.rb
CHANGED
@@ -22,9 +22,6 @@ class TestInsensitiveHash < Test::Unit::TestCase
|
|
22
22
|
end
|
23
23
|
end
|
24
24
|
end
|
25
|
-
|
26
|
-
#hash = {"source db"=>{"driver"=>"com.mysql.jdbc.Driver", "url"=>"jdbc:mysql://localhost/test", "user"=>"root"}, "target db"=>{"driver"=>"com.mysql.jdbc.Driver", "url"=>"jdbc:mysql://localhost/test", "user"=>"root"}, "mappings"=>[{"table name"=>"a", "writers/partition"=>0}]}
|
27
|
-
#p Marshal.load(Marshal.dump(hash)).insensitive
|
28
25
|
end
|
29
26
|
|
30
27
|
def test_has_key_set
|
@@ -56,6 +53,12 @@ class TestInsensitiveHash < Test::Unit::TestCase
|
|
56
53
|
assert_equal 1, ih[:c].first[:x]
|
57
54
|
assert_equal 2, ih[:c].last['Y']
|
58
55
|
|
56
|
+
# Deeeeeper nesting
|
57
|
+
ih['c'] = [ [ [ { 'x' => 1 }, { :y => 2 } ] ] ]
|
58
|
+
assert_equal 2, ih[:c].first.first.last[:Y]
|
59
|
+
ih['c'] = { 'a' => { 'a' => { 'a' => 100 } } }
|
60
|
+
assert_equal 100, ih[:C][:a][:A]['A']
|
61
|
+
|
59
62
|
ih[5] = 50
|
60
63
|
assert_equal 50, ih[5]
|
61
64
|
end
|
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.0.
|
4
|
+
version: 0.0.2
|
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: 2011-10-
|
12
|
+
date: 2011-10-28 00:00:00.000000000Z
|
13
13
|
dependencies: []
|
14
14
|
description: Hash with case-insensitive, Symbol/String-indifferent key access
|
15
15
|
email:
|