itamae-node_env 0.0.3 → 0.0.4

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: 82df28106ba9614a71e099ffeed025101449d52f
4
- data.tar.gz: 0469202e86fb4129edd408e3a657aba37bafc181
3
+ metadata.gz: 32f262a5b50b2917c267347f115164a015f8ab90
4
+ data.tar.gz: 3176500e2eaf820e855256173727063531f0493f
5
5
  SHA512:
6
- metadata.gz: 03ee0db21ba61a4f0171662884e768a09607e1fdd24ee8d1f35e4ac7a5904f65f230f54647762c7b97f2f62d69346c5fcefa6b490a63460304ce923b1ad18104
7
- data.tar.gz: 5702387c3ca325044190bafdf5070920bb1f995f6cf39383e40841ad8577835f88d64a74383bcec819cd3b2b8f2d1ee1ac5bcbc316f2fb23a5dff47aadbfbfe0
6
+ metadata.gz: 5dcb2bb6c76f0d5f64e01136e7f9fbafe7adb9df73ce7d258b51c7c1edfbac53841901a64ca343ea27c89e4c645e0049d414043bde12e313feed28d13a813acd
7
+ data.tar.gz: 0c36d26a6aa4cf1b630edead68021db0fd8d69071a3c650cef110cb8a78874d7473e2f0d063ffc35868866ea4ef0b245f92e21b502bdd08a85b1f631eb4036a8
@@ -3,13 +3,25 @@ require "itamae/node_env/version"
3
3
 
4
4
  module Itamae
5
5
  module NodeEnv
6
- def [](key)
7
- val = super(key)
8
- if val.is_a?(String) and /\Aenv\[([^\]]+)\]\z/ =~ val
9
- ENV[$1]
10
- else
11
- val
6
+ def convert_env(val)
7
+ case val
8
+ when String then
9
+ if /\Aenv\[([^\]]+)\]\z/ =~ val
10
+ return ENV[$1]
11
+ end
12
+ when Array then
13
+ return val.map {|v| convert_env(v)}
14
+ when Hash then
15
+ hash = Hash.new
16
+ val.each {|k,v| hash[k] = convert_env(v)}
17
+ return hash
12
18
  end
19
+ return val
20
+ end
21
+
22
+ def initialize(source_hash = nil, default = nil, &blk)
23
+ source_hash = convert_env(source_hash)
24
+ super(source_hash, default, &blk)
13
25
  end
14
26
  end
15
27
  end
@@ -1,5 +1,5 @@
1
1
  module Itamae
2
2
  module NodeEnv
3
- VERSION = "0.0.3"
3
+ VERSION = "0.0.4"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: itamae-node_env
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - nownabe