figtree 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/figtree/ini_config.rb +12 -13
- data/lib/figtree/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b6b5da9f31e285ace11997fa8066b4fb9926ad3a
|
4
|
+
data.tar.gz: 1c11bdf776b084922e35c782e9737d3275f32ddd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b515887114e72ca380c854619e5596e2027d7f120c372ff1c2e48b03d35a6bcd50cfa792dac15c435ac7a7639844bab810b95a7813bba4bbffc2e722653c80b6
|
7
|
+
data.tar.gz: 7ccf9fb5da3a512f019c37652ed680f64b502beee938974a560a7b2c25dd5e8bfd1a6a8d414787e3df354a17038d3a705907c61c9709da6b5e64c465372e5c75
|
data/lib/figtree/ini_config.rb
CHANGED
@@ -3,22 +3,21 @@ module Figtree
|
|
3
3
|
class IniConfig < OpenStruct
|
4
4
|
def initialize(ini, override = :none)
|
5
5
|
# cheat to allow a parsed hash in
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
parsed_subgroups = figgy_transform(
|
10
|
-
figgy_parse(
|
11
|
-
File.read(ini)
|
12
|
-
),
|
13
|
-
override
|
14
|
-
).reduce({}, :merge!)
|
15
|
-
end
|
16
|
-
super(
|
17
|
-
parsed_subgroups
|
18
|
-
)
|
6
|
+
parsed_subgroups = ini.is_a?(Hash) ?
|
7
|
+
ini : subgroups_from(ini, override)
|
8
|
+
super(parsed_subgroups)
|
19
9
|
end
|
20
10
|
|
21
11
|
private
|
12
|
+
def subgroups_from(ini_file, override)
|
13
|
+
figgy_transform(
|
14
|
+
figgy_parse(
|
15
|
+
File.read(ini_file)
|
16
|
+
),
|
17
|
+
override
|
18
|
+
).reduce({}, :merge!)
|
19
|
+
end
|
20
|
+
|
22
21
|
def figgy_parse(str)
|
23
22
|
Parser.new.parse(str)
|
24
23
|
rescue Parslet::ParseFailed => failure
|
data/lib/figtree/version.rb
CHANGED