confuse 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/confuse/config.rb +5 -2
- data/lib/confuse/config_mixin.rb +5 -1
- data/lib/confuse/version.rb +1 -1
- metadata +4 -4
data/lib/confuse/config.rb
CHANGED
@@ -14,8 +14,11 @@ module Confuse
|
|
14
14
|
|
15
15
|
def initialize(*paths)
|
16
16
|
load_namespaces(self.class.namespaces)
|
17
|
-
|
18
|
-
|
17
|
+
if paths.flatten.empty?
|
18
|
+
read_files(self.class.config_path.flatten)
|
19
|
+
else
|
20
|
+
read_files(paths.flatten)
|
21
|
+
end
|
19
22
|
end
|
20
23
|
|
21
24
|
def config
|
data/lib/confuse/config_mixin.rb
CHANGED
@@ -34,10 +34,14 @@ module Confuse
|
|
34
34
|
ns[rest_of_key, self]
|
35
35
|
end
|
36
36
|
|
37
|
+
def []=(key, value)
|
38
|
+
mixin_config!({key => value})
|
39
|
+
end
|
40
|
+
|
37
41
|
def to_hash
|
38
42
|
namespaces.reduce({}) do |memo, (name, namespace)|
|
39
43
|
namespace.keys.each do |key|
|
40
|
-
memo["#{name}_#{key}"] = namespace[key, self]
|
44
|
+
memo[:"#{name}_#{key}"] = namespace[key, self]
|
41
45
|
end
|
42
46
|
memo
|
43
47
|
end
|
data/lib/confuse/version.rb
CHANGED
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: 29
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 3
|
10
|
+
version: 0.1.3
|
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-10-
|
18
|
+
date: 2013-10-09 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: inifile
|