pifano_config 0.2.0 → 0.2.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
  SHA256:
3
- metadata.gz: 8389a6716f4d2a09bf392dd77755023ae24b08785a132686d03dfd90c2ac339a
4
- data.tar.gz: 6d165e8f16da592041d33877f8ea1dcd573f2a1cc427b64ed36bc80b6926d2c0
3
+ metadata.gz: fac4c5883861603405e2bf63071cc3a1896a961e1d29a063efae4b562c72d56c
4
+ data.tar.gz: 0e823fb70099e1410b41f75627531508317ade972a5b42114a736af69634d5a3
5
5
  SHA512:
6
- metadata.gz: d5fc333691f0ae8f8f5314f5255c0a9edc7539c6db8b7f56ed0f1d5b772d646af9e682b122a1091466121f5efa854532c9a3a8be4ea47d831dcc02e78dc269b0
7
- data.tar.gz: b07a4508e21ac677c6f9cb102dd51993da118ead8199b66c509497cb2575acfdd803aca3f52466b31bfa58fe41d9e9cdea0bab65873a755b32d55a7ac08ecd93
6
+ metadata.gz: e7300421ecc51cb4010235a5a6db91c2875dcf12e15d1936a660fbbc6b06c3c691ef18453e80158b61a6e5df66db6a370017f3269c9ffa7cc32e7be7ec12831b
7
+ data.tar.gz: 7dda5b00d1e9cfb674c4532e8d62d492a842c5fd1426ff3cf99a51821e1d73c185c4b771fdfa6030813db3e8fdd71f08e71c43eee760ec66959945e0ead43fc3
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]
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.1'
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.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aristóteles Coutinho