dot_hash 0.2.7 → 0.2.8

Sign up to get free protection for your applications and to get access to all the features.
@@ -9,7 +9,9 @@ module DotHash
9
9
 
10
10
  def method_missing(key, *args, &block)
11
11
  symbolize_key key
12
- has_key?(key) ? get_value(key, *args, &block) : super
12
+ has_key?(key) ?
13
+ execute(key, *args, &block) :
14
+ super(key, *args, &block)
13
15
  end
14
16
 
15
17
  def respond_to?(key)
@@ -28,11 +30,16 @@ module DotHash
28
30
  hash.has_key?(key.to_sym) or hash.respond_to?(key)
29
31
  end
30
32
 
31
- def get_value(key, *args, &block)
32
- key = key.to_sym
33
- value = hash.fetch(key) { hash.send(key, *args, &block) }
33
+ def execute(key, *args, &block)
34
+ value = get_value(key)
35
+ return value unless value.nil?
36
+ hash.public_send(key, *args, &block)
37
+ end
34
38
 
35
- return value unless hash.has_key?(key) and value.is_a?(Hash)
39
+ def get_value(key)
40
+ key = key.to_sym
41
+ value = hash[key]
42
+ return value unless value.is_a?(Hash)
36
43
  hash[key] = self.class.new value
37
44
  end
38
45
 
@@ -1,3 +1,3 @@
1
1
  module DotHash
2
- VERSION = "0.2.7"
2
+ VERSION = "0.2.8"
3
3
  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.2.7
4
+ version: 0.2.8
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: 2013-01-23 00:00:00.000000000 Z
12
+ date: 2013-01-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
@@ -66,7 +66,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
66
66
  version: '0'
67
67
  segments:
68
68
  - 0
69
- hash: 4070340156189844052
69
+ hash: -1533631301402391866
70
70
  required_rubygems_version: !ruby/object:Gem::Requirement
71
71
  none: false
72
72
  requirements:
@@ -75,7 +75,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
75
75
  version: '0'
76
76
  segments:
77
77
  - 0
78
- hash: 4070340156189844052
78
+ hash: -1533631301402391866
79
79
  requirements: []
80
80
  rubyforge_project:
81
81
  rubygems_version: 1.8.24