joshbuddy-fuzzy_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.
@@ -1,4 +1,4 @@
1
1
  ---
2
2
  :major: 0
3
3
  :minor: 0
4
- :patch: 1
4
+ :patch: 2
@@ -69,7 +69,7 @@ class FuzzyHash
69
69
  end
70
70
 
71
71
  def [](key)
72
- @hash[key] || regex_lookup(key)
72
+ @hash.key?(key) ? @hash[key] : regex_lookup(key)
73
73
  end
74
74
 
75
75
  private
@@ -29,6 +29,16 @@ describe "Fuzzy hash" do
29
29
  l[nil].should == 'qwe2'
30
30
  end
31
31
 
32
+ it "should allow boolean keys" do
33
+ l = FuzzyHash.new
34
+ l[false] = 'false'
35
+ l[true] = 'true'
36
+ l[/.*/] = 'everything else'
37
+ l[true].should == 'true'
38
+ l[false].should == 'false'
39
+ l['false'].should == 'everything else'
40
+ end
41
+
32
42
  it "should pick between the correct regex" do
33
43
  hash = FuzzyHash.new
34
44
  hash[/^\d+$/] = 'number'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: joshbuddy-fuzzy_hash
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joshua Hull
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-03-26 00:00:00 -07:00
12
+ date: 2009-04-06 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies: []
15
15