confuse 0.1.7 → 0.1.8

Sign up to get free protection for your applications and to get access to all the features.
@@ -43,20 +43,11 @@ module Confuse
43
43
  def to_hash
44
44
  namespaces.reduce({}) do |memo, (name, namespace)|
45
45
  namespace.keys.each do |key|
46
- memo[:"#{name}_#{key}"] = namespace[key, self]
47
- end
48
- memo
49
- end
50
- end
51
-
52
- def self.params_hash
53
- namespaces.reduce({}) do |memo, (name, namespace)|
54
- namespace.keys.each do |key|
55
- item = namespace.get_item(key)
56
- memo[:"#{name}_#{key}"] = {
57
- :type => item.type,
58
- :doc => item.description,
59
- :default => item.default_value }
46
+ if name != :default
47
+ memo[:"#{name}_#{key}"] = namespace[key, self]
48
+ else
49
+ memo[:"#{key}"] = namespace[key, self]
50
+ end
60
51
  end
61
52
  memo
62
53
  end
@@ -1,3 +1,3 @@
1
1
  module Confuse
2
- VERSION = '0.1.7'
2
+ VERSION = '0.1.8'
3
3
  end
@@ -46,5 +46,17 @@ class TestConfig < MiniTest::Unit::TestCase
46
46
  assert @config[:foo_bar][:baz]
47
47
  end
48
48
 
49
+ def test_to_hash
50
+ config = Class.new(Confuse::ConfigBase) do
51
+ define :foo do
52
+ description 'Foo'
53
+ type :integer
54
+ default 1
55
+ end
56
+ end
57
+ assert_nil config.new.to_hash[:default_foo]
58
+ refute_nil config.new.to_hash[:foo]
59
+ end
60
+
49
61
  end
50
62
 
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: 21
4
+ hash: 11
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 7
10
- version: 0.1.7
9
+ - 8
10
+ version: 0.1.8
11
11
  platform: ruby
12
12
  authors:
13
13
  - Tom Chipchase
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2013-11-06 00:00:00 Z
18
+ date: 2014-02-07 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: inifile