config-reader 0.0.1 → 0.0.2

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
  SHA256:
3
- metadata.gz: 8e34a3d24b7bfa6ca50291dda7cd876997daba180ab835d3115cc80fc63235d4
4
- data.tar.gz: c93da14263ca62012051ffce6a348bc0e7b6bb2f2d970f2e2058cda40807380a
3
+ metadata.gz: c7ce214efba842d40d1adc82bf5313ca57f2f3099e510068d4a4f0739371bc47
4
+ data.tar.gz: cbd23f6c1163bc9a84ba243cd7346d3a6b4a34c27092f1e2466e254b6d753557
5
5
  SHA512:
6
- metadata.gz: bf864827bca7100e31a75ed9fcdd32b4eaccdd41d2499487e98f6c2ddcede7fc60cbf256dfe93be70f8d521871dda49d692012d61fa13ca2483773def1426f88
7
- data.tar.gz: '003001860394573a4b3a4531002d752ad522416af9faa53997c4ee2d15ed1a9c85bb2f8f4c587e453881b4693289673ec4fc92e34108f312965eaf8521e2e828'
6
+ metadata.gz: 6e4e3cbf47c540791af60f56e8333ab3ec4a88f5e3f656886e15a03c14d125085818f7f7317210122afee14b32ba62ad2223dba5f4d464bcfed129627ec98335
7
+ data.tar.gz: 66c0d83bc8bd2bd4ffd4efd6b24aef8b2ce1eec124bac584c3175140aaccf3db0f53ccd179a6eb542c346cba74c01562b118f344494ec0495d967e4c7036482f
data/lib/config-reader.rb CHANGED
@@ -3,10 +3,13 @@ require 'erb'
3
3
  require 'ostruct'
4
4
  require 'yaml'
5
5
 
6
- class ConfigReader < OpenStruct
6
+ class ConfigReader
7
+ # Process IO as ERB and then YAML
8
+ # and return results as OpenStruct
9
+ # @param [String] path
10
+ # @param [String,Symbol] env
11
+ # @return [OpenStruct]
7
12
  def self.load(path, env)
8
- contents = IO.read(path)
9
- processed = ERB.new(contents).result
10
- new(YAML.load(processed)[env.to_s])
13
+ OpenStruct.new(YAML.load(ERB.new(IO.read(path)).result)[env.to_s])
11
14
  end
12
15
  end
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  class ConfigReader
3
- VERSION = '0.0.1'
3
+ VERSION = '0.0.2'
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: config-reader
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Tulino