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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8389a6716f4d2a09bf392dd77755023ae24b08785a132686d03dfd90c2ac339a
4
- data.tar.gz: 6d165e8f16da592041d33877f8ea1dcd573f2a1cc427b64ed36bc80b6926d2c0
3
+ metadata.gz: 0d59fad3206c8bc809de95828df9e981ae6a00e2bdcc5d8cff1971f504753538
4
+ data.tar.gz: bb3fcb7650dd3505e8ee62cc39961225650a19a8206dffd6fa48397f6ac4403e
5
5
  SHA512:
6
- metadata.gz: d5fc333691f0ae8f8f5314f5255c0a9edc7539c6db8b7f56ed0f1d5b772d646af9e682b122a1091466121f5efa854532c9a3a8be4ea47d831dcc02e78dc269b0
7
- data.tar.gz: b07a4508e21ac677c6f9cb102dd51993da118ead8199b66c509497cb2575acfdd803aca3f52466b31bfa58fe41d9e9cdea0bab65873a755b32d55a7ac08ecd93
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
- yield self if block_given?
52
- @env = nil
53
- @options[env_name]
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.
@@ -4,5 +4,5 @@
4
4
  # Copyright, 2023, by Aristóteles Coutinho.
5
5
 
6
6
  module PifanoConfig
7
- VERSION = '0.2.0'
7
+ VERSION = '0.2.2'
8
8
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pifano_config
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aristóteles Coutinho