configvar 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.
- checksums.yaml +4 -4
- data/lib/configvar/context.rb +1 -1
- data/lib/configvar/version.rb +1 -1
- data/test/context_test.rb +6 -2
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7f963ff05093621e64d9b4c4809df884ea599c5e
|
4
|
+
data.tar.gz: 3f8c8bd8826f1a7e5a63d365a4dd7a1eadd72b06
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8b27c1f69ddee83b96f194b68a6962f50c484adbebf3575592b0b0fc86145d3ec87d9cdf82464867e34871b6a9f4889f85381711228c6a9d65742bc9098dc06a
|
7
|
+
data.tar.gz: fa4338443ad37b80c38ed2cabddd89e47a2cb00a16cf96ace011ed67ab292879c7203d70d7da62a0fc7a335f914069c476a1edfbe653e3241a9aeb69d2cd6c3d
|
data/lib/configvar/context.rb
CHANGED
@@ -123,7 +123,7 @@ module ConfigVar
|
|
123
123
|
# Convert a string to boolean. An ArgumentError is raised if the string
|
124
124
|
# is not a valid boolean.
|
125
125
|
def parse_bool(name, value)
|
126
|
-
if ['1', 'true'].include?(value.downcase)
|
126
|
+
if ['1', 'true', 'enabled'].include?(value.downcase)
|
127
127
|
true
|
128
128
|
elsif ['0', 'false'].include?(value.downcase)
|
129
129
|
false
|
data/lib/configvar/version.rb
CHANGED
data/test/context_test.rb
CHANGED
@@ -66,12 +66,14 @@ class ContextTest < Minitest::Test
|
|
66
66
|
context = ConfigVar::Context.new
|
67
67
|
context.required_bool :value_1
|
68
68
|
context.required_bool :value_true
|
69
|
+
context.required_bool :value_enabled
|
69
70
|
context.required_bool :value_0
|
70
71
|
context.required_bool :value_false
|
71
|
-
context.reload('VALUE_1' => '1', 'VALUE_TRUE' => 'True',
|
72
|
+
context.reload('VALUE_1' => '1', 'VALUE_TRUE' => 'True', 'VALUE_ENABLED' => 'enabled',
|
72
73
|
'VALUE_0' => '0', 'VALUE_FALSE' => 'False')
|
73
74
|
assert_equal(true, context.value_1)
|
74
75
|
assert_equal(true, context.value_true)
|
76
|
+
assert_equal(true, context.value_enabled)
|
75
77
|
assert_equal(false, context.value_0)
|
76
78
|
assert_equal(false, context.value_false)
|
77
79
|
end
|
@@ -160,12 +162,14 @@ class ContextTest < Minitest::Test
|
|
160
162
|
context = ConfigVar::Context.new
|
161
163
|
context.optional_bool :value_1, false
|
162
164
|
context.optional_bool :value_true, false
|
165
|
+
context.optional_bool :value_enabled, false
|
163
166
|
context.optional_bool :value_0, true
|
164
167
|
context.optional_bool :value_false, true
|
165
|
-
context.reload('VALUE_1' => '1', 'VALUE_TRUE' => 'True',
|
168
|
+
context.reload('VALUE_1' => '1', 'VALUE_TRUE' => 'True', 'VALUE_ENABLED' => 'enabled',
|
166
169
|
'VALUE_0' => '0', 'VALUE_FALSE' => 'False')
|
167
170
|
assert_equal(true, context.value_1)
|
168
171
|
assert_equal(true, context.value_true)
|
172
|
+
assert_equal(true, context.value_enabled)
|
169
173
|
assert_equal(false, context.value_0)
|
170
174
|
assert_equal(false, context.value_false)
|
171
175
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: configvar
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- jkakar
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2016-11-30 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -96,7 +96,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
96
96
|
version: '0'
|
97
97
|
requirements: []
|
98
98
|
rubyforge_project:
|
99
|
-
rubygems_version: 2.
|
99
|
+
rubygems_version: 2.5.1
|
100
100
|
signing_key:
|
101
101
|
specification_version: 4
|
102
102
|
summary: Manage configuration loaded from the environment
|