chozo 0.0.2 → 0.0.3

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.
@@ -78,7 +78,7 @@ class Hash
78
78
  # @return [Object, nil]
79
79
  def dig(path)
80
80
  parts = path.split('.', 2)
81
- match = self[parts[0]]
81
+ match = (self[parts[0].to_s] || self[parts[0].to_sym])
82
82
  if !parts[1] or match.nil?
83
83
  match
84
84
  else
@@ -1,3 +1,3 @@
1
1
  module Chozo
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
@@ -57,5 +57,21 @@ describe Hash do
57
57
  subject.dig("nothing.is.here").should be_nil
58
58
  end
59
59
  end
60
+
61
+ context "when the Hash contains symbols for keys" do
62
+ subject do
63
+ {
64
+ we: {
65
+ found: {
66
+ something: :symbol_value
67
+ }
68
+ }
69
+ }
70
+ end
71
+
72
+ it "returns the value at the dotted path" do
73
+ subject.dig("we.found.something").should eql(:symbol_value)
74
+ end
75
+ end
60
76
  end
61
77
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chozo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
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: 2012-10-09 00:00:00.000000000 Z
12
+ date: 2012-10-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
@@ -315,7 +315,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
315
315
  version: '0'
316
316
  segments:
317
317
  - 0
318
- hash: -2640494448512270787
318
+ hash: -1213851817618954320
319
319
  requirements: []
320
320
  rubyforge_project:
321
321
  rubygems_version: 1.8.23