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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 011a21ea2c8dfbe34b870ef195349235aa1effa3
4
- data.tar.gz: 0835b757e33b0b33b30640fe95de3deaedae8f9d
3
+ metadata.gz: b6b5da9f31e285ace11997fa8066b4fb9926ad3a
4
+ data.tar.gz: 1c11bdf776b084922e35c782e9737d3275f32ddd
5
5
  SHA512:
6
- metadata.gz: 38e21385476ad11e06a20553893c11271086056959d4613022b123bc64ecdf44653f79824ff611305c89655a75e3cbf1d1ac83b3017fb962823db7c9ded00a80
7
- data.tar.gz: 86199767fdb013c40f4e9c769e394e76c98234b5e32fec12800507fcbee22ab6fd2e0e093bdfdb774ea78866274140fc31ea556021c2ba29118e7f2122c64e89
6
+ metadata.gz: b515887114e72ca380c854619e5596e2027d7f120c372ff1c2e48b03d35a6bcd50cfa792dac15c435ac7a7639844bab810b95a7813bba4bbffc2e722653c80b6
7
+ data.tar.gz: 7ccf9fb5da3a512f019c37652ed680f64b502beee938974a560a7b2c25dd5e8bfd1a6a8d414787e3df354a17038d3a705907c61c9709da6b5e64c465372e5c75
@@ -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
- if ini.is_a?(Hash)
7
- parsed_subgroups = ini
8
- else
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
@@ -1,3 +1,3 @@
1
1
  module Figtree
2
- VERSION = "1.0.0"
2
+ VERSION = "1.0.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: figtree
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alex Moore-Niemi