confuse 1.1.0 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/example/example.ini CHANGED
@@ -1 +1,2 @@
1
1
  foo = 10
2
+ bar = 10,20
@@ -5,6 +5,8 @@ require 'confuse'
5
5
 
6
6
  config = Confuse.config :path => 'example/example.ini' do |conf|
7
7
  conf.add_item :foo, :description => "How many Foo's are there?", :default => 1
8
+ conf.add_item :bar, :description => "list of bars", :type => Array
8
9
  end
9
10
 
10
11
  puts config.foo
12
+ puts config.bar
data/lib/confuse/item.rb CHANGED
@@ -20,13 +20,9 @@ module Confuse
20
20
  end
21
21
 
22
22
  def default(config)
23
- raise Errors::Undefined.new(@key) if @required && !@default
23
+ raise Errors::Undefined.new(@key) if @required && @default.nil?
24
24
 
25
- res = if @default.respond_to?(:call)
26
- @default.call(config)
27
- else
28
- @default
29
- end
25
+ @default.respond_to?(:call) ? @default.call(config) : @default
30
26
  end
31
27
 
32
28
  def to_s
@@ -52,8 +48,7 @@ module Confuse
52
48
  end
53
49
 
54
50
  def type_from_default
55
- if @default
56
- klass = @default.class
51
+ unless @default.nil?
57
52
  case @default
58
53
  when TrueClass, FalseClass
59
54
  :bool
@@ -2,5 +2,5 @@
2
2
 
3
3
  # Confuse version
4
4
  module Confuse
5
- VERSION = '1.1.0'
5
+ VERSION = '1.1.1'
6
6
  end
data/test/test_item.rb CHANGED
@@ -36,4 +36,10 @@ class TestItem < MiniTest::Unit::TestCase
36
36
  assert_equal({ :description => 'Description', :default => 1 },
37
37
  @item.to_hash)
38
38
  end
39
+
40
+ def test_default_false
41
+ item = Confuse::Item.new(:foo, :default => false)
42
+
43
+ assert_equal false, item.convert('false')
44
+ end
39
45
  end
metadata CHANGED
@@ -1,89 +1,87 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: confuse
3
- version: !ruby/object:Gem::Version
4
- hash: 19
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.1.1
5
5
  prerelease:
6
- segments:
7
- - 1
8
- - 1
9
- - 0
10
- version: 1.1.0
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Tom Chipchase
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2014-09-16 00:00:00 Z
19
- dependencies:
20
- - !ruby/object:Gem::Dependency
12
+ date: 2014-12-05 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
21
15
  name: inifile
22
- prerelease: false
23
- requirement: &id001 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
24
17
  none: false
25
- requirements:
26
- - - ">="
27
- - !ruby/object:Gem::Version
28
- hash: 3
29
- segments:
30
- - 0
31
- version: "0"
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
32
22
  type: :runtime
33
- version_requirements: *id001
34
- - !ruby/object:Gem::Dependency
35
- name: bundler
36
23
  prerelease: false
37
- requirement: &id002 !ruby/object:Gem::Requirement
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
30
+ - !ruby/object:Gem::Dependency
31
+ name: bundler
32
+ requirement: !ruby/object:Gem::Requirement
38
33
  none: false
39
- requirements:
34
+ requirements:
40
35
  - - ~>
41
- - !ruby/object:Gem::Version
42
- hash: 9
43
- segments:
44
- - 1
45
- - 3
46
- version: "1.3"
36
+ - !ruby/object:Gem::Version
37
+ version: '1.3'
47
38
  type: :development
48
- version_requirements: *id002
49
- - !ruby/object:Gem::Dependency
50
- name: minitest
51
39
  prerelease: false
52
- requirement: &id003 !ruby/object:Gem::Requirement
40
+ version_requirements: !ruby/object:Gem::Requirement
53
41
  none: false
54
- requirements:
55
- - - ">="
56
- - !ruby/object:Gem::Version
57
- hash: 3
58
- segments:
59
- - 0
60
- version: "0"
42
+ requirements:
43
+ - - ~>
44
+ - !ruby/object:Gem::Version
45
+ version: '1.3'
46
+ - !ruby/object:Gem::Dependency
47
+ name: minitest
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
61
54
  type: :development
62
- version_requirements: *id003
63
- - !ruby/object:Gem::Dependency
64
- name: rake
65
55
  prerelease: false
66
- requirement: &id004 !ruby/object:Gem::Requirement
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ - !ruby/object:Gem::Dependency
63
+ name: rake
64
+ requirement: !ruby/object:Gem::Requirement
67
65
  none: false
68
- requirements:
69
- - - ">="
70
- - !ruby/object:Gem::Version
71
- hash: 3
72
- segments:
73
- - 0
74
- version: "0"
66
+ requirements:
67
+ - - ! '>='
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
75
70
  type: :development
76
- version_requirements: *id004
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
77
78
  description: Add nested configuration to an application
78
- email:
79
+ email:
79
80
  - tom@mediasp.com
80
81
  executables: []
81
-
82
82
  extensions: []
83
-
84
83
  extra_rdoc_files: []
85
-
86
- files:
84
+ files:
87
85
  - .gitignore
88
86
  - .ruby-version
89
87
  - Gemfile
@@ -117,39 +115,31 @@ files:
117
115
  - test/test_key_splitter.rb
118
116
  - test/test_namespace.rb
119
117
  homepage: https://github.com/mediasp/confuse
120
- licenses:
118
+ licenses:
121
119
  - MIT
122
120
  post_install_message:
123
121
  rdoc_options: []
124
-
125
- require_paths:
122
+ require_paths:
126
123
  - lib
127
- required_ruby_version: !ruby/object:Gem::Requirement
124
+ required_ruby_version: !ruby/object:Gem::Requirement
128
125
  none: false
129
- requirements:
130
- - - ">="
131
- - !ruby/object:Gem::Version
132
- hash: 3
133
- segments:
134
- - 0
135
- version: "0"
136
- required_rubygems_version: !ruby/object:Gem::Requirement
126
+ requirements:
127
+ - - ! '>='
128
+ - !ruby/object:Gem::Version
129
+ version: '0'
130
+ required_rubygems_version: !ruby/object:Gem::Requirement
137
131
  none: false
138
- requirements:
139
- - - ">="
140
- - !ruby/object:Gem::Version
141
- hash: 3
142
- segments:
143
- - 0
144
- version: "0"
132
+ requirements:
133
+ - - ! '>='
134
+ - !ruby/object:Gem::Version
135
+ version: '0'
145
136
  requirements: []
146
-
147
137
  rubyforge_project:
148
- rubygems_version: 1.8.25
138
+ rubygems_version: 1.8.23.2
149
139
  signing_key:
150
140
  specification_version: 3
151
141
  summary: A DSL for defining configuration options in classes
152
- test_files:
142
+ test_files:
153
143
  - test/test_config.rb
154
144
  - test/test_confuse.rb
155
145
  - test/test_converter.rb
@@ -157,4 +147,3 @@ test_files:
157
147
  - test/test_item.rb
158
148
  - test/test_key_splitter.rb
159
149
  - test/test_namespace.rb
160
- has_rdoc: