gaston 0.0.2 → 0.1.0
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.
- data/lib/gaston.rb +6 -9
- data/lib/gaston/store.rb +7 -21
- data/lib/gaston/version.rb +1 -1
- metadata +4 -4
data/lib/gaston.rb
CHANGED
@@ -19,14 +19,6 @@ class Gaston
|
|
19
19
|
|
20
20
|
class << self
|
21
21
|
|
22
|
-
# Access to Gaston::Store.
|
23
|
-
#
|
24
|
-
# @since 0.0.1
|
25
|
-
#
|
26
|
-
def retrieve
|
27
|
-
self.instance.store
|
28
|
-
end
|
29
|
-
|
30
22
|
# Define a configure block.
|
31
23
|
#
|
32
24
|
# Delegates to Gaston::Configuration
|
@@ -42,7 +34,12 @@ class Gaston
|
|
42
34
|
# @since 0.0.1
|
43
35
|
#
|
44
36
|
def configure(&block)
|
45
|
-
|
37
|
+
self::Configuration.configure(&block)
|
38
|
+
self.instance.store.each do |key, value|
|
39
|
+
define_singleton_method key do
|
40
|
+
value
|
41
|
+
end
|
42
|
+
end
|
46
43
|
end
|
47
44
|
end # self
|
48
45
|
|
data/lib/gaston/store.rb
CHANGED
@@ -11,28 +11,14 @@ class Gaston
|
|
11
11
|
def initialize(hash)
|
12
12
|
hash ||= {}
|
13
13
|
hash.each do |key, value|
|
14
|
-
value.is_a?(Hash) ?
|
15
|
-
end
|
16
|
-
end
|
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
|
14
|
+
self[key] = value.is_a?(Hash) ? Gaston::Store.new(value) : hash[key]
|
29
15
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
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
|
21
|
+
end
|
36
22
|
end
|
37
23
|
|
38
24
|
end # Store
|
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.0
|
4
|
+
version: 0.1.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2011-
|
12
|
+
date: 2011-12-11 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
16
|
-
requirement: &
|
16
|
+
requirement: &15199040 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,7 +21,7 @@ dependencies:
|
|
21
21
|
version: '2.6'
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *15199040
|
25
25
|
description: ! '[Dead simple Ruby config store.]'
|
26
26
|
email: jboyer@af83.com
|
27
27
|
executables: []
|