confuse 0.1.6 → 0.1.7
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/confuse/config.rb +14 -0
- data/lib/confuse/config_mixin.rb +1 -1
- data/lib/confuse/version.rb +1 -1
- data/test/test_config_base.rb +1 -1
- metadata +3 -3
data/lib/confuse/config.rb
CHANGED
@@ -30,5 +30,19 @@ module Confuse
|
|
30
30
|
def config
|
31
31
|
self
|
32
32
|
end
|
33
|
+
|
34
|
+
def self.params_hash
|
35
|
+
namespaces.reduce({}) do |memo, (name, namespace)|
|
36
|
+
namespace.keys.each do |key|
|
37
|
+
item = namespace.get_item(key)
|
38
|
+
memo[:"#{name}_#{key}"] = {
|
39
|
+
:type => item.type,
|
40
|
+
:doc => item.description,
|
41
|
+
:default => item.default_value }
|
42
|
+
end
|
43
|
+
memo
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
33
47
|
end
|
34
48
|
end
|
data/lib/confuse/config_mixin.rb
CHANGED
data/lib/confuse/version.rb
CHANGED
data/test/test_config_base.rb
CHANGED
@@ -15,7 +15,7 @@ class TestConfigBase < MiniTest::Unit::TestCase
|
|
15
15
|
def test_params_hash
|
16
16
|
assert_equal({ :default_foo => { :type => :string, :doc => 'foo',
|
17
17
|
:default => 'foo' } },
|
18
|
-
Foo.
|
18
|
+
Foo.params_hash)
|
19
19
|
end
|
20
20
|
|
21
21
|
def test_can_specify_config_options_on_initialize
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: confuse
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 21
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 7
|
10
|
+
version: 0.1.7
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Tom Chipchase
|