eac_ruby_utils 0.119.2 → 0.121.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 +4 -4
- data/lib/eac_ruby_utils/acts_as_immutable/class_methods.rb +1 -1
- data/lib/eac_ruby_utils/arguments_consumer.rb +2 -3
- data/lib/eac_ruby_utils/bit.rb +1 -0
- data/lib/eac_ruby_utils/bit_array.rb +1 -1
- data/lib/eac_ruby_utils/boolean.rb +1 -1
- data/lib/eac_ruby_utils/byte.rb +2 -1
- data/lib/eac_ruby_utils/common_constructor/instance_initialize.rb +2 -2
- data/lib/eac_ruby_utils/common_constructor/super_args.rb +3 -2
- data/lib/eac_ruby_utils/common_constructor.rb +1 -2
- data/lib/eac_ruby_utils/compact.rb +1 -1
- data/lib/eac_ruby_utils/envs/base_command/append_command_options.rb +2 -2
- data/lib/eac_ruby_utils/envs/base_command.rb +1 -1
- data/lib/eac_ruby_utils/envs/ssh_env.rb +2 -3
- data/lib/eac_ruby_utils/gems_registry/gem.rb +2 -2
- data/lib/eac_ruby_utils/inflector.rb +2 -2
- data/lib/eac_ruby_utils/listable/integer_list.rb +2 -2
- data/lib/eac_ruby_utils/listable/list.rb +1 -1
- data/lib/eac_ruby_utils/listable/string_list.rb +2 -2
- data/lib/eac_ruby_utils/listable/symbol_list.rb +2 -2
- data/lib/eac_ruby_utils/listable.rb +1 -1
- data/lib/eac_ruby_utils/locales/from_all_gems.rb +1 -1
- data/lib/eac_ruby_utils/locales/module_i18n_translate.rb +1 -1
- data/lib/eac_ruby_utils/options_consumer.rb +1 -1
- data/lib/eac_ruby_utils/patches/addressable/uri/query_value.rb +2 -2
- data/lib/eac_ruby_utils/patches/addressable/uri.rb +1 -1
- data/lib/eac_ruby_utils/patches/addressable.rb +1 -1
- data/lib/eac_ruby_utils/patches/class/common_constructor.rb +2 -2
- data/lib/eac_ruby_utils/patches/class.rb +1 -1
- data/lib/eac_ruby_utils/patches/enumerable.rb +1 -1
- data/lib/eac_ruby_utils/patches/enumerator.rb +1 -1
- data/lib/eac_ruby_utils/patches/hash/if_key.rb +12 -0
- data/lib/eac_ruby_utils/patches/hash.rb +1 -1
- data/lib/eac_ruby_utils/patches/kernel/ibr.rb +10 -0
- data/lib/eac_ruby_utils/patches/kernel.rb +1 -1
- data/lib/eac_ruby_utils/patches/module/module_parent.rb +1 -1
- data/lib/eac_ruby_utils/patches/module.rb +1 -1
- data/lib/eac_ruby_utils/patches/object/debug.rb +6 -6
- data/lib/eac_ruby_utils/patches/object/recursive_build.rb +12 -0
- data/lib/eac_ruby_utils/patches/object.rb +1 -1
- data/lib/eac_ruby_utils/patches/pathname/reqdir_glob.rb +1 -1
- data/lib/eac_ruby_utils/patches/pathname.rb +1 -1
- data/lib/eac_ruby_utils/patches/regexp/if_match.rb +1 -1
- data/lib/eac_ruby_utils/patches/regexp.rb +1 -1
- data/lib/eac_ruby_utils/patches/string/inflector.rb +1 -1
- data/lib/eac_ruby_utils/patches/string.rb +1 -1
- data/lib/eac_ruby_utils/patches/time.rb +1 -1
- data/lib/eac_ruby_utils/patches.rb +1 -1
- data/lib/eac_ruby_utils/require_sub/base.rb +2 -2
- data/lib/eac_ruby_utils/rspec.rb +1 -1
- data/lib/eac_ruby_utils/settings_provider/setting_value.rb +4 -3
- data/lib/eac_ruby_utils/settings_provider.rb +1 -1
- data/lib/eac_ruby_utils/speaker/receiver.rb +1 -1
- data/lib/eac_ruby_utils/string_delimited.rb +1 -1
- data/lib/eac_ruby_utils/struct.rb +2 -2
- data/lib/eac_ruby_utils/version.rb +1 -1
- data/lib/eac_ruby_utils/yaml.rb +2 -2
- metadata +12 -9
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f01b05501b3b07a9a61379167199fb3489be9b082a77ac5e1730ca271cbdc951
|
|
4
|
+
data.tar.gz: ebc0eb54e6ee6d90d7fc3fffcf050b72ed10b1860d0db6c43213c7a241d2b27e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 814b5652fb79d527e9331111697f438082a6012db38d74cf432ee8c7f855ea7cfb61a0e073807dec5acc6143b8453885fdeba2c82e0f55d94ea0b19426f3723e
|
|
7
|
+
data.tar.gz: dcb8f3c8b0ee24d278bfe723bbefb8646b1ff7bcc6d21544ba853aba8750386130d0f242a40e727c392d16fe972759b7f8da1e1d91ffd39787a24ed57ab8d06b
|
|
@@ -7,7 +7,7 @@ module EacRubyUtils
|
|
|
7
7
|
options = accessors.extract_options!
|
|
8
8
|
options[:type] ||= const_get('TYPE_COMMON')
|
|
9
9
|
accessors.each do |name|
|
|
10
|
-
class_name = options.fetch(:type).to_s.camelize
|
|
10
|
+
class_name = "#{options.fetch(:type).to_s.camelize}Accessor"
|
|
11
11
|
::EacRubyUtils::ActsAsImmutable.const_get(class_name).new(name).apply(self)
|
|
12
12
|
end
|
|
13
13
|
end
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
require 'active_support/hash_with_indifferent_access'
|
|
4
|
-
require 'ostruct'
|
|
5
4
|
|
|
6
5
|
module EacRubyUtils
|
|
7
6
|
class ArgumentsConsumer
|
|
@@ -38,7 +37,7 @@ module EacRubyUtils
|
|
|
38
37
|
private
|
|
39
38
|
|
|
40
39
|
def add_arg(value, index)
|
|
41
|
-
arg = ::
|
|
40
|
+
arg = ::Struct.new(:value, :index).new(value, index)
|
|
42
41
|
if arg.value.is_a?(::Hash)
|
|
43
42
|
add_hash_arg(arg)
|
|
44
43
|
else
|
|
@@ -74,7 +73,7 @@ module EacRubyUtils
|
|
|
74
73
|
def initialize(args_consumer, arg, message)
|
|
75
74
|
@args_consumer = args_consumer
|
|
76
75
|
@arg = arg
|
|
77
|
-
super
|
|
76
|
+
super("#{message} (Arg: #{arg}, Args Consumer: #{args_consumer})")
|
|
78
77
|
end
|
|
79
78
|
end
|
|
80
79
|
end
|
data/lib/eac_ruby_utils/bit.rb
CHANGED
|
@@ -47,7 +47,7 @@ module EacRubyUtils
|
|
|
47
47
|
|
|
48
48
|
# @param big_endian [Boolean]
|
|
49
49
|
# @return [EacRubyUtils::ByteArray]
|
|
50
|
-
def to_byte_array(big_endian = false)
|
|
50
|
+
def to_byte_array(big_endian = false) # rubocop:disable Style/OptionalBooleanParameter
|
|
51
51
|
unless count.modulo(::EacRubyUtils::Byte::BIT_COUNT).zero?
|
|
52
52
|
raise 'Bits returned is not multile of 8'
|
|
53
53
|
end
|
data/lib/eac_ruby_utils/byte.rb
CHANGED
|
@@ -18,7 +18,7 @@ module EacRubyUtils
|
|
|
18
18
|
new(obj.to_i)
|
|
19
19
|
end
|
|
20
20
|
|
|
21
|
-
def from_bit_array(bit_array, big_endian = false)
|
|
21
|
+
def from_bit_array(bit_array, big_endian = false) # rubocop:disable Style/OptionalBooleanParameter
|
|
22
22
|
bit_array = ::EacRubyUtils::BitArray.assert(bit_array)
|
|
23
23
|
raise ::ArgumentError, "Wrong bit array size: #{bit_array.size}" if
|
|
24
24
|
bit_array.size != BIT_COUNT
|
|
@@ -51,6 +51,7 @@ module EacRubyUtils
|
|
|
51
51
|
end
|
|
52
52
|
|
|
53
53
|
attr_reader :value
|
|
54
|
+
|
|
54
55
|
compare_by :value
|
|
55
56
|
|
|
56
57
|
def initialize(value)
|
|
@@ -56,8 +56,8 @@ module EacRubyUtils
|
|
|
56
56
|
def validate_args_count
|
|
57
57
|
return if common_constructor.args_count.include?(args.count)
|
|
58
58
|
|
|
59
|
-
raise ArgumentError, "#{object.class}.initialize: wrong number of arguments" \
|
|
60
|
-
|
|
59
|
+
raise ArgumentError, "#{object.class}.initialize: wrong number of arguments " \
|
|
60
|
+
"(given #{args.count}, expected #{common_constructor.args_count})"
|
|
61
61
|
end
|
|
62
62
|
end
|
|
63
63
|
end
|
|
@@ -6,6 +6,7 @@ module EacRubyUtils
|
|
|
6
6
|
class CommonConstructor
|
|
7
7
|
class SuperArgs
|
|
8
8
|
attr_reader :class_initialize, :args, :object
|
|
9
|
+
|
|
9
10
|
delegate :common_constructor, to: :class_initialize
|
|
10
11
|
|
|
11
12
|
def initialize(class_initialize, args, object)
|
|
@@ -34,9 +35,9 @@ module EacRubyUtils
|
|
|
34
35
|
end
|
|
35
36
|
|
|
36
37
|
def sub_args
|
|
37
|
-
common_constructor.args.each_with_index.
|
|
38
|
+
common_constructor.args.each_with_index.to_h do |name, index|
|
|
38
39
|
[name, args[index]]
|
|
39
|
-
end
|
|
40
|
+
end
|
|
40
41
|
end
|
|
41
42
|
|
|
42
43
|
def super_arg_index(name)
|
|
@@ -4,7 +4,6 @@ require 'active_support/callbacks'
|
|
|
4
4
|
require 'eac_ruby_utils/arguments_consumer'
|
|
5
5
|
require 'eac_ruby_utils/common_constructor/class_accessors'
|
|
6
6
|
require 'eac_ruby_utils/common_constructor/class_initialize'
|
|
7
|
-
require 'ostruct'
|
|
8
7
|
|
|
9
8
|
module EacRubyUtils
|
|
10
9
|
class CommonConstructor
|
|
@@ -12,7 +11,7 @@ module EacRubyUtils
|
|
|
12
11
|
|
|
13
12
|
class << self
|
|
14
13
|
def parse_args_options(args)
|
|
15
|
-
result = ::
|
|
14
|
+
result = ::Struct.new(:args, :options).new([], {})
|
|
16
15
|
options_reached = false
|
|
17
16
|
args.each do |arg|
|
|
18
17
|
raise "Options reached and there is more arguments (Arguments: #{args})" if
|
|
@@ -12,9 +12,9 @@ module EacRubyUtils
|
|
|
12
12
|
|
|
13
13
|
def result
|
|
14
14
|
r = command_line
|
|
15
|
-
r = input.command
|
|
15
|
+
r = "#{input.command} | #{r}" if input
|
|
16
16
|
r = "cat #{Shellwords.escape(input_file)} | #{r}" if input_file
|
|
17
|
-
r +=
|
|
17
|
+
r += " > #{Shellwords.escape(output_file)}" if output_file
|
|
18
18
|
r
|
|
19
19
|
end
|
|
20
20
|
|
|
@@ -39,12 +39,11 @@ module EacRubyUtils
|
|
|
39
39
|
attr_reader :uri
|
|
40
40
|
|
|
41
41
|
def initialize(uri)
|
|
42
|
+
super()
|
|
42
43
|
@uri = self.class.parse_uri(uri).freeze
|
|
43
44
|
end
|
|
44
45
|
|
|
45
|
-
|
|
46
|
-
uri.to_s
|
|
47
|
-
end
|
|
46
|
+
delegate :to_s, to: :uri
|
|
48
47
|
|
|
49
48
|
def command_line(line)
|
|
50
49
|
"#{ssh_command_line} #{Shellwords.escape(line)}"
|
|
@@ -40,7 +40,7 @@ module EacRubyUtils
|
|
|
40
40
|
|
|
41
41
|
def lib_file_found?
|
|
42
42
|
gemspec.require_paths.any? do |require_path|
|
|
43
|
-
::Pathname.new(require_path).expand_path(gemspec.gem_dir).join(path_to_require
|
|
43
|
+
::Pathname.new(require_path).expand_path(gemspec.gem_dir).join("#{path_to_require}.rb")
|
|
44
44
|
.file?
|
|
45
45
|
end
|
|
46
46
|
end
|
|
@@ -54,7 +54,7 @@ module EacRubyUtils
|
|
|
54
54
|
|
|
55
55
|
# @return [String]
|
|
56
56
|
def path_to_require
|
|
57
|
-
gemspec.name.gsub('-', '/')
|
|
57
|
+
"#{gemspec.name.gsub('-', '/')}/#{registry.module_suffix.underscore}"
|
|
58
58
|
end
|
|
59
59
|
|
|
60
60
|
def to_s
|
|
@@ -14,7 +14,7 @@ module EacRubyUtils
|
|
|
14
14
|
# variable format. If `true`, it raises a {ArgumentError}. If `false`, return `nil`.
|
|
15
15
|
# @return [String, nil]
|
|
16
16
|
# @raise [ArgumentError]
|
|
17
|
-
def variableize(string, validate = true)
|
|
17
|
+
def variableize(string, validate = true) # rubocop:disable Style/OptionalBooleanParameter
|
|
18
18
|
r = ::ActiveSupport::Inflector.transliterate(string).gsub(/[^_a-z0-9]/i, '_')
|
|
19
19
|
.gsub(/_+/, '_').gsub(/_\z/, '').gsub(/\A_/, '').downcase
|
|
20
20
|
m = VARIABLE_NAME_PATTERN.match(r)
|
|
@@ -22,7 +22,7 @@ module EacRubyUtils
|
|
|
22
22
|
return nil unless validate
|
|
23
23
|
|
|
24
24
|
raise ::ArgumentError, "Invalid variable name \"#{r}\" was generated " \
|
|
25
|
-
|
|
25
|
+
"from string \"#{string}\""
|
|
26
26
|
end
|
|
27
27
|
end
|
|
28
28
|
end
|
|
@@ -9,9 +9,9 @@ module EacRubyUtils
|
|
|
9
9
|
|
|
10
10
|
def parse_labels(labels)
|
|
11
11
|
if labels.first.is_a?(Hash)
|
|
12
|
-
|
|
12
|
+
labels.first.to_h { |k, v| [k.to_i, v.to_s] }
|
|
13
13
|
else
|
|
14
|
-
|
|
14
|
+
labels.each_with_index.to_h { |v, i| [i + 1, v.to_s] }
|
|
15
15
|
end
|
|
16
16
|
end
|
|
17
17
|
|
|
@@ -76,7 +76,7 @@ module EacRubyUtils
|
|
|
76
76
|
return @values[v] if @values.key?(v)
|
|
77
77
|
|
|
78
78
|
raise "List value unkown: \"#{v}\" (Source: #{@lists.source}, Item: #{item}, Instance: " \
|
|
79
|
-
|
|
79
|
+
"#{instance.to_debug}, Values: #{@values.keys})"
|
|
80
80
|
end
|
|
81
81
|
|
|
82
82
|
def value_valid?(value)
|
|
@@ -9,9 +9,9 @@ module EacRubyUtils
|
|
|
9
9
|
|
|
10
10
|
def parse_labels(labels)
|
|
11
11
|
if labels.first.is_a?(Hash)
|
|
12
|
-
|
|
12
|
+
labels.first.to_h { |k, v| [k.to_s, v.to_s] }
|
|
13
13
|
else
|
|
14
|
-
|
|
14
|
+
labels.to_h { |v| [v.to_s, v.to_s] }
|
|
15
15
|
end
|
|
16
16
|
end
|
|
17
17
|
end
|
|
@@ -9,9 +9,9 @@ module EacRubyUtils
|
|
|
9
9
|
|
|
10
10
|
def parse_labels(labels)
|
|
11
11
|
if labels.first.is_a?(Hash)
|
|
12
|
-
|
|
12
|
+
labels.first.to_h { |k, v| [k.to_sym, v.to_sym] }
|
|
13
13
|
else
|
|
14
|
-
|
|
14
|
+
labels.to_h { |v| [v.to_sym, v.to_sym] }
|
|
15
15
|
end
|
|
16
16
|
end
|
|
17
17
|
end
|
|
@@ -53,7 +53,7 @@ module EacRubyUtils
|
|
|
53
53
|
|
|
54
54
|
def consume_all_build_result(keys, ostruct)
|
|
55
55
|
if ostruct
|
|
56
|
-
::OpenStruct.new(keys.
|
|
56
|
+
::OpenStruct.new(keys.index_with { |key| consume(key) }) # rubocop:disable Style/OpenStructUse
|
|
57
57
|
else
|
|
58
58
|
keys.map { |key| consume(key) }
|
|
59
59
|
end
|
|
@@ -15,8 +15,8 @@ module Addressable
|
|
|
15
15
|
elsif args.count == 2
|
|
16
16
|
query_value_set(*args)
|
|
17
17
|
else
|
|
18
|
-
raise ::ArgumentError, "#{object.class}.#{__method__}: wrong number of arguments" \
|
|
19
|
-
|
|
18
|
+
raise ::ArgumentError, "#{object.class}.#{__method__}: wrong number of arguments " \
|
|
19
|
+
"(given #{args.count}, expected 1..2)"
|
|
20
20
|
end
|
|
21
21
|
end
|
|
22
22
|
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
require 'eac_ruby_utils/common_constructor'
|
|
4
4
|
|
|
5
5
|
class Class
|
|
6
|
-
def common_constructor(
|
|
7
|
-
::EacRubyUtils::CommonConstructor.new(
|
|
6
|
+
def common_constructor(...)
|
|
7
|
+
::EacRubyUtils::CommonConstructor.new(...).setup_class(self)
|
|
8
8
|
end
|
|
9
9
|
end
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'active_support/core_ext/object/blank'
|
|
4
|
+
|
|
5
|
+
class Hash
|
|
6
|
+
# @return +block.call(fetch(key))+ if +self+ has the key +key+, +default_value+ otherwise.
|
|
7
|
+
def if_key(key, default_value = nil)
|
|
8
|
+
return default_value unless key?(key)
|
|
9
|
+
|
|
10
|
+
block_given? ? yield(fetch(key)) : fetch(key)
|
|
11
|
+
end
|
|
12
|
+
end
|
|
@@ -13,20 +13,20 @@ class Object
|
|
|
13
13
|
def pretty_debug(options = {})
|
|
14
14
|
print_debug_options(options)
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
$stderr.write(pretty_inspect)
|
|
17
17
|
|
|
18
18
|
self
|
|
19
19
|
end
|
|
20
20
|
|
|
21
21
|
def print_debug(options = {})
|
|
22
22
|
print_debug_options(options)
|
|
23
|
-
|
|
23
|
+
$stderr.write("#{to_debug}\n")
|
|
24
24
|
|
|
25
25
|
self
|
|
26
26
|
end
|
|
27
27
|
|
|
28
28
|
def print_debug_label(label)
|
|
29
|
-
|
|
29
|
+
$stderr.write("#{label}: ")
|
|
30
30
|
end
|
|
31
31
|
|
|
32
32
|
def print_debug_options(options)
|
|
@@ -36,9 +36,9 @@ class Object
|
|
|
36
36
|
|
|
37
37
|
def print_debug_title(title)
|
|
38
38
|
char = '='
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
39
|
+
$stderr.write("#{char * (4 + title.length)}\n")
|
|
40
|
+
$stderr.write("#{char} #{title} #{char}\n")
|
|
41
|
+
$stderr.write("#{char * (4 + title.length)}\n")
|
|
42
42
|
end
|
|
43
43
|
|
|
44
44
|
def to_debug
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'eac_ruby_utils/recursive_builder'
|
|
4
|
+
|
|
5
|
+
class Object
|
|
6
|
+
# Equivalent to +EacRubyUtils::RecursiveBuilder.new(self, &neighbors_block).result+.
|
|
7
|
+
# @param &neighbors_block [Proc]
|
|
8
|
+
# @return [Enumerable]
|
|
9
|
+
def recursive_build(&neighbors_block)
|
|
10
|
+
::EacRubyUtils::RecursiveBuilder.new(self, &neighbors_block).result
|
|
11
|
+
end
|
|
12
|
+
end
|
|
@@ -6,7 +6,7 @@ class Pathname
|
|
|
6
6
|
# A .glob that raises a ::RuntimeError if +self+ is not a directory.
|
|
7
7
|
# @return [Pathname]
|
|
8
8
|
def reqdir_glob(*args)
|
|
9
|
-
raise
|
|
9
|
+
raise "\"#{self}\" is not a directory" unless directory?
|
|
10
10
|
|
|
11
11
|
glob(*args)
|
|
12
12
|
end
|
|
@@ -5,7 +5,7 @@ class Regexp
|
|
|
5
5
|
# not provided.
|
|
6
6
|
# If +self+ does not match +string+ raises a +ArgumentError+ if +required+ is truthy or return
|
|
7
7
|
# +nil+ otherwise.
|
|
8
|
-
def if_match(string, required = true, &block)
|
|
8
|
+
def if_match(string, required = true, &block) # rubocop:disable Style/OptionalBooleanParameter
|
|
9
9
|
m = match(string)
|
|
10
10
|
if m
|
|
11
11
|
block ? block.call(m) : m
|
|
@@ -5,7 +5,7 @@ require 'eac_ruby_utils/inflector'
|
|
|
5
5
|
class String
|
|
6
6
|
# Shortcut to `EacRubyUtils::Inflector.variableize(self, ...)`.
|
|
7
7
|
# @see EacRubyUtils::Inflector.variableize
|
|
8
|
-
def variableize(validate = true)
|
|
8
|
+
def variableize(validate = true) # rubocop:disable Style/OptionalBooleanParameter
|
|
9
9
|
::EacRubyUtils::Inflector.variableize(self, validate)
|
|
10
10
|
end
|
|
11
11
|
end
|
|
@@ -54,8 +54,8 @@ module EacRubyUtils
|
|
|
54
54
|
return INCLUDE_MODULES_MAP.fetch(options[OPTION_INCLUDE_MODULES]) if
|
|
55
55
|
INCLUDE_MODULES_MAP.key?(options[OPTION_INCLUDE_MODULES])
|
|
56
56
|
|
|
57
|
-
raise ::ArgumentError, "Invalid value for 'options[OPTION_INCLUDE_MODULES]':" \
|
|
58
|
-
|
|
57
|
+
raise ::ArgumentError, "Invalid value for 'options[OPTION_INCLUDE_MODULES]': " \
|
|
58
|
+
"\"#{options[OPTION_INCLUDE_MODULES]}\""
|
|
59
59
|
end
|
|
60
60
|
|
|
61
61
|
# @return [Symbol]
|
data/lib/eac_ruby_utils/rspec.rb
CHANGED
|
@@ -12,6 +12,7 @@ module EacRubyUtils
|
|
|
12
12
|
include ::EacRubyUtils::SimpleCache
|
|
13
13
|
|
|
14
14
|
attr_reader :source, :key, :options
|
|
15
|
+
|
|
15
16
|
lists.add_symbol :option, :default, :order, :required
|
|
16
17
|
|
|
17
18
|
def initialize(source, key, options)
|
|
@@ -20,7 +21,7 @@ module EacRubyUtils
|
|
|
20
21
|
@options = options
|
|
21
22
|
end
|
|
22
23
|
|
|
23
|
-
def constant_name(fullname = false)
|
|
24
|
+
def constant_name(fullname = false) # rubocop:disable Style/OptionalBooleanParameter
|
|
24
25
|
name = key.to_s.underscore.upcase
|
|
25
26
|
name = "#{source.class.name}::#{name}" if fullname
|
|
26
27
|
name
|
|
@@ -70,8 +71,8 @@ module EacRubyUtils
|
|
|
70
71
|
end
|
|
71
72
|
|
|
72
73
|
def raise_key_not_found
|
|
73
|
-
raise "Setting \"#{key}\" not found. Supply in #{source.settings_object_name}, implement "\
|
|
74
|
-
|
|
74
|
+
raise "Setting \"#{key}\" not found. Supply in #{source.settings_object_name}, implement " \
|
|
75
|
+
"a \"#{key}\" method or declare a #{constant_name(true)} constant."
|
|
75
76
|
end
|
|
76
77
|
end
|
|
77
78
|
end
|
|
@@ -8,7 +8,7 @@ module EacRubyUtils
|
|
|
8
8
|
module SettingsProvider
|
|
9
9
|
::EacRubyUtils.require_sub __FILE__, base: self
|
|
10
10
|
|
|
11
|
-
def setting_constant_name(key, fullname = false)
|
|
11
|
+
def setting_constant_name(key, fullname = false) # rubocop:disable Style/OptionalBooleanParameter
|
|
12
12
|
setting_value_instance(key).constant_name(fullname)
|
|
13
13
|
end
|
|
14
14
|
|
|
@@ -34,7 +34,7 @@ module EacRubyUtils
|
|
|
34
34
|
end
|
|
35
35
|
|
|
36
36
|
def slice_fetch(*keys)
|
|
37
|
-
self.class.new(keys.
|
|
37
|
+
self.class.new(keys.index_with { |key| fetch(key) })
|
|
38
38
|
end
|
|
39
39
|
|
|
40
40
|
def to_h
|
|
@@ -57,7 +57,7 @@ module EacRubyUtils
|
|
|
57
57
|
end
|
|
58
58
|
|
|
59
59
|
def property_methods
|
|
60
|
-
data.keys.flat_map { |k| [k.to_sym, "#{k}?"
|
|
60
|
+
data.keys.flat_map { |k| [k.to_sym, :"#{k}?"] }
|
|
61
61
|
end
|
|
62
62
|
end
|
|
63
63
|
end
|
data/lib/eac_ruby_utils/yaml.rb
CHANGED
|
@@ -19,7 +19,7 @@ module EacRubyUtils
|
|
|
19
19
|
end
|
|
20
20
|
|
|
21
21
|
def load(string)
|
|
22
|
-
::YAML.safe_load(string, permitted_classes)
|
|
22
|
+
::YAML.safe_load(string, permitted_classes: permitted_classes)
|
|
23
23
|
end
|
|
24
24
|
|
|
25
25
|
def load_file(path)
|
|
@@ -76,7 +76,7 @@ module EacRubyUtils
|
|
|
76
76
|
end
|
|
77
77
|
|
|
78
78
|
def result_hashable
|
|
79
|
-
source.to_h.
|
|
79
|
+
source.to_h.to_h { |k, v| [k.to_sym, sanitize_value(v)] }
|
|
80
80
|
end
|
|
81
81
|
|
|
82
82
|
def result_nil?
|
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.121.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:
|
|
11
|
+
date: 2024-02-10 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: activesupport
|
|
@@ -39,7 +39,7 @@ dependencies:
|
|
|
39
39
|
version: '2.8'
|
|
40
40
|
- - ">="
|
|
41
41
|
- !ruby/object:Gem::Version
|
|
42
|
-
version: 2.8.
|
|
42
|
+
version: 2.8.6
|
|
43
43
|
type: :runtime
|
|
44
44
|
prerelease: false
|
|
45
45
|
version_requirements: !ruby/object:Gem::Requirement
|
|
@@ -49,7 +49,7 @@ dependencies:
|
|
|
49
49
|
version: '2.8'
|
|
50
50
|
- - ">="
|
|
51
51
|
- !ruby/object:Gem::Version
|
|
52
|
-
version: 2.8.
|
|
52
|
+
version: 2.8.6
|
|
53
53
|
- !ruby/object:Gem::Dependency
|
|
54
54
|
name: bundler
|
|
55
55
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -98,28 +98,28 @@ dependencies:
|
|
|
98
98
|
requirements:
|
|
99
99
|
- - "~>"
|
|
100
100
|
- !ruby/object:Gem::Version
|
|
101
|
-
version: '0.
|
|
101
|
+
version: '0.5'
|
|
102
102
|
type: :development
|
|
103
103
|
prerelease: false
|
|
104
104
|
version_requirements: !ruby/object:Gem::Requirement
|
|
105
105
|
requirements:
|
|
106
106
|
- - "~>"
|
|
107
107
|
- !ruby/object:Gem::Version
|
|
108
|
-
version: '0.
|
|
108
|
+
version: '0.5'
|
|
109
109
|
- !ruby/object:Gem::Dependency
|
|
110
110
|
name: eac_ruby_gem_support
|
|
111
111
|
requirement: !ruby/object:Gem::Requirement
|
|
112
112
|
requirements:
|
|
113
113
|
- - "~>"
|
|
114
114
|
- !ruby/object:Gem::Version
|
|
115
|
-
version: 0.
|
|
115
|
+
version: '0.9'
|
|
116
116
|
type: :development
|
|
117
117
|
prerelease: false
|
|
118
118
|
version_requirements: !ruby/object:Gem::Requirement
|
|
119
119
|
requirements:
|
|
120
120
|
- - "~>"
|
|
121
121
|
- !ruby/object:Gem::Version
|
|
122
|
-
version: 0.
|
|
122
|
+
version: '0.9'
|
|
123
123
|
description:
|
|
124
124
|
email:
|
|
125
125
|
executables: []
|
|
@@ -235,10 +235,12 @@ files:
|
|
|
235
235
|
- lib/eac_ruby_utils/patches/enumerator/current.rb
|
|
236
236
|
- lib/eac_ruby_utils/patches/enumerator/stopped.rb
|
|
237
237
|
- lib/eac_ruby_utils/patches/hash.rb
|
|
238
|
+
- lib/eac_ruby_utils/patches/hash/if_key.rb
|
|
238
239
|
- lib/eac_ruby_utils/patches/hash/options_consumer.rb
|
|
239
240
|
- lib/eac_ruby_utils/patches/hash/sym_keys_hash.rb
|
|
240
241
|
- lib/eac_ruby_utils/patches/hash/to_struct.rb
|
|
241
242
|
- lib/eac_ruby_utils/patches/kernel.rb
|
|
243
|
+
- lib/eac_ruby_utils/patches/kernel/ibr.rb
|
|
242
244
|
- lib/eac_ruby_utils/patches/kernel/nyi.rb
|
|
243
245
|
- lib/eac_ruby_utils/patches/module.rb
|
|
244
246
|
- lib/eac_ruby_utils/patches/module/abstract_methods.rb
|
|
@@ -265,6 +267,7 @@ files:
|
|
|
265
267
|
- lib/eac_ruby_utils/patches/object/if_nil.rb
|
|
266
268
|
- lib/eac_ruby_utils/patches/object/if_present.rb
|
|
267
269
|
- lib/eac_ruby_utils/patches/object/if_respond.rb
|
|
270
|
+
- lib/eac_ruby_utils/patches/object/recursive_build.rb
|
|
268
271
|
- lib/eac_ruby_utils/patches/object/to_bool.rb
|
|
269
272
|
- lib/eac_ruby_utils/patches/object/to_pathname.rb
|
|
270
273
|
- lib/eac_ruby_utils/patches/object/to_uri.rb
|
|
@@ -328,7 +331,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
328
331
|
requirements:
|
|
329
332
|
- - ">="
|
|
330
333
|
- !ruby/object:Gem::Version
|
|
331
|
-
version: '
|
|
334
|
+
version: '2.7'
|
|
332
335
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
333
336
|
requirements:
|
|
334
337
|
- - ">="
|