pifano_config 0.2.0 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/pifano/config.rb +9 -4
- data/lib/pifano_config/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0d59fad3206c8bc809de95828df9e981ae6a00e2bdcc5d8cff1971f504753538
|
4
|
+
data.tar.gz: bb3fcb7650dd3505e8ee62cc39961225650a19a8206dffd6fa48397f6ac4403e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dfc55b3ff029fc2326eb899d366e2af5b680fe4ed679f9fa559a506b9e057c9c79582fa6d1a6ebc06a4a038ae8451bdd24b9da7f0f1356b90cbccd63228c2a8e
|
7
|
+
data.tar.gz: 56ac2f81de2e4c2478a181a78332322b147bcd87571aa6277f6e15d5c4c877a3eec8f0273503508a1b827865ca65d74c1a8e5e410bcdc09f77512b1f00c7047e
|
data/lib/pifano/config.rb
CHANGED
@@ -42,15 +42,20 @@ module Pifano
|
|
42
42
|
# @parameter env_name [Symbol] The environment to get the options.
|
43
43
|
# @yields {...} When a block is given, the block is yielded with the option.
|
44
44
|
#
|
45
|
-
# @returns [Hash] The options.
|
45
|
+
# @returns [Hash] The options if a block is not given.
|
46
46
|
#
|
47
47
|
def environment(env_name)
|
48
48
|
return {} unless @options.key?(env_name)
|
49
49
|
|
50
50
|
@env = env_name
|
51
|
-
|
52
|
-
|
53
|
-
|
51
|
+
if block_given?
|
52
|
+
yield @options[env_name].merge(environment: @env)
|
53
|
+
@env = nil
|
54
|
+
else
|
55
|
+
result = @options[env_name]
|
56
|
+
@env = nil
|
57
|
+
result
|
58
|
+
end
|
54
59
|
end
|
55
60
|
|
56
61
|
# Set the option for a specific environment.
|