eac_ruby_utils 0.106.0 → 0.107.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d09c44eb96a5d9f1ea3fa5f6559e3f7b0185c536af8b254daea989f8abe71ffa
4
- data.tar.gz: 732c0400447703cc639ca400c0a0eaf2c294d260dc2e7a91a8c88874ceae248d
3
+ metadata.gz: 327886d15b376e910d0dd5fec9233893209abdeb2e28f3ac6c37c21c09af8b67
4
+ data.tar.gz: 1cec2ad79b9d74a99685b5722e8a3b4ee38118088443601b0cb3ad87bdae65c4
5
5
  SHA512:
6
- metadata.gz: 8a3f8342b15dc6f6b957efeb8f3a6b297876573f7a9ed29fce86307e6f42710914169f6785f41ed14c495cf35b6147f1399575955389c095a964480166b290f6
7
- data.tar.gz: e03b9749f87b9dea75f376f152000a55365fc915d931d28cb7df97cf15566227e56083913a88ac52e42ea7635293637309f53e0b354221318522bb0778c784d0
6
+ metadata.gz: eee2f09ecad4676780dc461ced9bfd31a03363b0187bc53e59463afa6bbc35a062d58eb333ec38c0e76abc5ba6df13bf114393e4c67862a3b4300935e6c11056
7
+ data.tar.gz: 2a85091e0d59670188c5dc87d07328aee35ce6d4483c15c73159a28b8c292a3ad534f316d76cbb82128da8f102882d164179b627b9d843e3219484ba0001266d
@@ -49,7 +49,7 @@ module EacRubyUtils
49
49
  return nil unless lib_file_found?
50
50
 
51
51
  require path_to_require
52
- path_to_require.classify.constantize
52
+ path_to_require.camelize.constantize
53
53
  end
54
54
 
55
55
  # @return [String]
@@ -1,6 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'eac_ruby_utils/core_ext'
4
+ require 'eac_ruby_utils/rspec/stub_speaker'
5
+ require 'eac_ruby_utils/speaker'
4
6
 
5
7
  module EacRubyUtils
6
8
  module Rspec
@@ -13,6 +15,13 @@ module EacRubyUtils
13
15
  obj.rspec_config.setup_manager = obj
14
16
  obj.rspec_config.include(::EacRubyUtils::Rspec::Setup::SetupManager)
15
17
  end
18
+
19
+ # @return [self]
20
+ def stub_eac_speaker
21
+ ::EacRubyUtils::Speaker.context.push(::EacRubyUtils::Rspec::StubSpeaker.new)
22
+
23
+ self
24
+ end
16
25
  end
17
26
  end
18
27
  end
@@ -28,8 +28,7 @@ module EacRubyUtils
28
28
 
29
29
  def value
30
30
  parsed_options.order.each do |method|
31
- value = send("value_by_#{method}")
32
- return value if value
31
+ return send("value_by_#{method}") if send("value_by_#{method}?")
33
32
  end
34
33
  return parsed_options.default if parsed_options.respond_to?(OPTION_DEFAULT)
35
34
  return nil unless parsed_options.required
@@ -39,16 +38,26 @@ module EacRubyUtils
39
38
 
40
39
  def value_by_constant
41
40
  source.class.const_get(constant_name)
42
- rescue NameError
43
- nil
41
+ end
42
+
43
+ def value_by_constant?
44
+ source.class.const_defined?(constant_name)
44
45
  end
45
46
 
46
47
  def value_by_method
47
- source.respond_to?(key, true) ? source.send(key) : nil
48
+ source.send(key)
49
+ end
50
+
51
+ def value_by_method?
52
+ source.respond_to?(key, true)
48
53
  end
49
54
 
50
55
  def value_by_settings_object
51
- source.settings_object[key.to_s] || source.settings_object[key.to_sym]
56
+ source.settings_object.fetch(key)
57
+ end
58
+
59
+ def value_by_settings_object?
60
+ source.settings_object.key?(key)
52
61
  end
53
62
 
54
63
  private
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'active_support/hash_with_indifferent_access'
3
4
  require 'eac_ruby_utils/require_sub'
4
5
 
5
6
  module EacRubyUtils
@@ -15,8 +16,11 @@ module EacRubyUtils
15
16
  %w[settings_object method constant]
16
17
  end
17
18
 
19
+ # return [ActiveSupport::HashWithIndifferentAccess]
18
20
  def settings_object
19
- respond_to?(settings_object_name) ? send(settings_object_name) : {}
21
+ ActiveSupport::HashWithIndifferentAccess.new(
22
+ respond_to?(settings_object_name) ? send(settings_object_name) : {}
23
+ )
20
24
  end
21
25
 
22
26
  def settings_object_name
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EacRubyUtils
4
- VERSION = '0.106.0'
4
+ VERSION = '0.107.0'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: eac_ruby_utils
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.106.0
4
+ version: 0.107.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Esquilo Azul Company
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-10-25 00:00:00.000000000 Z
11
+ date: 2022-11-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport