eac_ruby_utils 0.106.1 → 0.107.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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: eeb6daf99db3dddb24c607bd5e7dc957075ec1988015aa6871d5cc52df66e6cd
|
4
|
+
data.tar.gz: 0d7126d4dbd98c296fdfa13c7e398cba361540fc46ed6a491eb5461cf9791666
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5dbbb58d1c41ea8e5cbbffcd01f5d7c2c51fc3abe83e615bcec30b3360e66ba24e8d7311b81b49a9d8ef3a43f3ae73e4396303efa84e6810fd4f9f615cd8b84f
|
7
|
+
data.tar.gz: 8a11abf8ab6d9c3c817b7df22ec6e2b3f449c371b595852e19ed12605b97ba1f4a8ffed449a0c122ec45c193980c3acf2245c9424e258c5b8f0d5347f51c822b
|
@@ -37,17 +37,9 @@ module EacRubyUtils
|
|
37
37
|
private
|
38
38
|
|
39
39
|
def add(list_class, item, labels)
|
40
|
-
check_acts_as_listable_new_item(item)
|
41
40
|
acts_as_listable_items[item] = list_class.new(self, item, labels)
|
42
41
|
end
|
43
42
|
|
44
|
-
def check_acts_as_listable_new_item(item)
|
45
|
-
return unless acts_as_listable_items.key?(item)
|
46
|
-
|
47
|
-
raise "Item já adicionado anteriormente: #{item} em #{self} " \
|
48
|
-
"(#{acts_as_listable_items.keys})"
|
49
|
-
end
|
50
|
-
|
51
43
|
def find_list_by_method(method)
|
52
44
|
acts_as_listable_items.each do |item, list|
|
53
45
|
return list if method.to_sym == item.to_sym
|
@@ -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
|
-
|
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
|
-
|
43
|
-
|
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.
|
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
|
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
|
-
|
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
|
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.
|
4
|
+
version: 0.107.1
|
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-
|
11
|
+
date: 2022-11-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|