dot_hash 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/dot_hash/properties.rb +2 -6
- data/lib/dot_hash/version.rb +1 -1
- data/test/dot_hash_test.rb +3 -1
- metadata +3 -3
data/lib/dot_hash/properties.rb
CHANGED
@@ -7,16 +7,12 @@ module DotHash
|
|
7
7
|
end
|
8
8
|
|
9
9
|
def method_missing(key)
|
10
|
-
|
10
|
+
symbolize_key key
|
11
|
+
has_key?(key) ? get_value(key) : super
|
11
12
|
end
|
12
13
|
|
13
14
|
private
|
14
15
|
|
15
|
-
def fetch(key)
|
16
|
-
symbolize_key key
|
17
|
-
has_key? key and get_value key
|
18
|
-
end
|
19
|
-
|
20
16
|
def has_key?(key)
|
21
17
|
hash.has_key? key.to_sym
|
22
18
|
end
|
data/lib/dot_hash/version.rb
CHANGED
data/test/dot_hash_test.rb
CHANGED
@@ -25,7 +25,7 @@ module DotHash
|
|
25
25
|
describe "with a nested hash" do
|
26
26
|
before do
|
27
27
|
@settings = Properties.new user: {
|
28
|
-
"info" => {name: "dude"}
|
28
|
+
"info" => {name: "dude", is_admin: false}
|
29
29
|
}
|
30
30
|
end
|
31
31
|
|
@@ -35,7 +35,9 @@ module DotHash
|
|
35
35
|
|
36
36
|
it "gets chained properties" do
|
37
37
|
settings.user.info.name.must_equal "dude"
|
38
|
+
settings.user.info.is_admin.must_equal false
|
38
39
|
end
|
40
|
+
|
39
41
|
end
|
40
42
|
|
41
43
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dot_hash
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -61,7 +61,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
61
61
|
version: '0'
|
62
62
|
segments:
|
63
63
|
- 0
|
64
|
-
hash: -
|
64
|
+
hash: -4110770147551490378
|
65
65
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
66
66
|
none: false
|
67
67
|
requirements:
|
@@ -70,7 +70,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
70
70
|
version: '0'
|
71
71
|
segments:
|
72
72
|
- 0
|
73
|
-
hash: -
|
73
|
+
hash: -4110770147551490378
|
74
74
|
requirements: []
|
75
75
|
rubyforge_project:
|
76
76
|
rubygems_version: 1.8.24
|