gaston 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/gaston/store.rb +21 -7
- data/lib/gaston/version.rb +1 -1
- metadata +5 -5
data/lib/gaston/store.rb
CHANGED
@@ -11,15 +11,29 @@ class Gaston
|
|
11
11
|
def initialize(hash)
|
12
12
|
hash ||= {}
|
13
13
|
hash.each do |key, value|
|
14
|
-
|
15
|
-
|
16
|
-
self.class.instance_eval do
|
17
|
-
define_method key do
|
18
|
-
value.is_a?(Hash) ? Gaston::Store.new(value) : hash[key]
|
19
|
-
end
|
20
|
-
end
|
14
|
+
value.is_a?(Hash) ? self[key] = Gaston::Store.new(value) : self[key] = value
|
21
15
|
end
|
22
16
|
end
|
23
17
|
|
18
|
+
# Search into store for value.
|
19
|
+
#
|
20
|
+
# @param [ String || Symbol ] key store.
|
21
|
+
#
|
22
|
+
# @since 0.0.1
|
23
|
+
#
|
24
|
+
def method_missing(method, *args, &block)
|
25
|
+
return self[method.to_s] if has_key? method.to_s
|
26
|
+
return self[method.to_sym] if has_key? method.to_sym
|
27
|
+
super(method, *args, &block)
|
28
|
+
end
|
29
|
+
|
30
|
+
# Implement respond_to?
|
31
|
+
#
|
32
|
+
# @since 0.0.1
|
33
|
+
#
|
34
|
+
def respond_to?(method)
|
35
|
+
has_key?(method.to_s) || has_key?(method.to_sym) || super(method)
|
36
|
+
end
|
37
|
+
|
24
38
|
end # Store
|
25
39
|
end #Gaston
|
data/lib/gaston/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gaston
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,19 +9,19 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2012-01-29 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
16
|
-
requirement: &
|
16
|
+
requirement: &21579540 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: '2.
|
21
|
+
version: '2.8'
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *21579540
|
25
25
|
description: ! '[Dead simple Ruby config store.]'
|
26
26
|
email: jboyer@af83.com
|
27
27
|
executables: []
|