eac_ruby_utils 0.119.2 → 0.120.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.
Files changed (56) hide show
  1. checksums.yaml +4 -4
  2. data/lib/eac_ruby_utils/acts_as_immutable/class_methods.rb +1 -1
  3. data/lib/eac_ruby_utils/arguments_consumer.rb +1 -2
  4. data/lib/eac_ruby_utils/bit.rb +1 -0
  5. data/lib/eac_ruby_utils/bit_array.rb +1 -1
  6. data/lib/eac_ruby_utils/boolean.rb +1 -1
  7. data/lib/eac_ruby_utils/byte.rb +2 -1
  8. data/lib/eac_ruby_utils/common_constructor/instance_initialize.rb +2 -2
  9. data/lib/eac_ruby_utils/common_constructor/super_args.rb +3 -2
  10. data/lib/eac_ruby_utils/common_constructor.rb +1 -2
  11. data/lib/eac_ruby_utils/compact.rb +1 -1
  12. data/lib/eac_ruby_utils/envs/base_command/append_command_options.rb +2 -2
  13. data/lib/eac_ruby_utils/envs/base_command.rb +1 -1
  14. data/lib/eac_ruby_utils/envs/ssh_env.rb +2 -3
  15. data/lib/eac_ruby_utils/gems_registry/gem.rb +2 -2
  16. data/lib/eac_ruby_utils/inflector.rb +2 -2
  17. data/lib/eac_ruby_utils/listable/integer_list.rb +2 -2
  18. data/lib/eac_ruby_utils/listable/list.rb +1 -1
  19. data/lib/eac_ruby_utils/listable/string_list.rb +2 -2
  20. data/lib/eac_ruby_utils/listable/symbol_list.rb +2 -2
  21. data/lib/eac_ruby_utils/listable.rb +1 -1
  22. data/lib/eac_ruby_utils/locales/from_all_gems.rb +1 -1
  23. data/lib/eac_ruby_utils/locales/module_i18n_translate.rb +1 -1
  24. data/lib/eac_ruby_utils/options_consumer.rb +1 -1
  25. data/lib/eac_ruby_utils/patches/addressable/uri/query_value.rb +2 -2
  26. data/lib/eac_ruby_utils/patches/addressable/uri.rb +1 -1
  27. data/lib/eac_ruby_utils/patches/addressable.rb +1 -1
  28. data/lib/eac_ruby_utils/patches/class/common_constructor.rb +2 -2
  29. data/lib/eac_ruby_utils/patches/class.rb +1 -1
  30. data/lib/eac_ruby_utils/patches/enumerable.rb +1 -1
  31. data/lib/eac_ruby_utils/patches/enumerator.rb +1 -1
  32. data/lib/eac_ruby_utils/patches/hash.rb +1 -1
  33. data/lib/eac_ruby_utils/patches/kernel.rb +1 -1
  34. data/lib/eac_ruby_utils/patches/module/module_parent.rb +1 -1
  35. data/lib/eac_ruby_utils/patches/module.rb +1 -1
  36. data/lib/eac_ruby_utils/patches/object/debug.rb +6 -6
  37. data/lib/eac_ruby_utils/patches/object/recursive_build.rb +12 -0
  38. data/lib/eac_ruby_utils/patches/object.rb +1 -1
  39. data/lib/eac_ruby_utils/patches/pathname/reqdir_glob.rb +1 -1
  40. data/lib/eac_ruby_utils/patches/pathname.rb +1 -1
  41. data/lib/eac_ruby_utils/patches/regexp/if_match.rb +1 -1
  42. data/lib/eac_ruby_utils/patches/regexp.rb +1 -1
  43. data/lib/eac_ruby_utils/patches/string/inflector.rb +1 -1
  44. data/lib/eac_ruby_utils/patches/string.rb +1 -1
  45. data/lib/eac_ruby_utils/patches/time.rb +1 -1
  46. data/lib/eac_ruby_utils/patches.rb +1 -1
  47. data/lib/eac_ruby_utils/require_sub/base.rb +2 -2
  48. data/lib/eac_ruby_utils/rspec.rb +1 -1
  49. data/lib/eac_ruby_utils/settings_provider/setting_value.rb +4 -3
  50. data/lib/eac_ruby_utils/settings_provider.rb +1 -1
  51. data/lib/eac_ruby_utils/speaker/receiver.rb +1 -1
  52. data/lib/eac_ruby_utils/string_delimited.rb +1 -1
  53. data/lib/eac_ruby_utils/struct.rb +1 -1
  54. data/lib/eac_ruby_utils/version.rb +1 -1
  55. data/lib/eac_ruby_utils/yaml.rb +1 -1
  56. metadata +8 -7
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 685c96995dbdc13d8471b5b99dea2b20182872293dcd1ecd02ca3d0991afcf9a
4
- data.tar.gz: 7ff65aa2e7cea78bd8a844ef252ae89bd8e100801875054fbfe0001e1dcf857d
3
+ metadata.gz: c58a76e4652914930ee4d510d2dd7cf1a577122b2c634eadf03f95e620d17a80
4
+ data.tar.gz: deb45ec59e21c72844fa5fbf4f8c787c2c2534d1baa0829ceba3babed5fe38e5
5
5
  SHA512:
6
- metadata.gz: 811ef94a0d10373feaae9c3b92dfc6b44f1e22e330564259c12a4fcd2d1414f4636968c1ab2ab89495d3a05ff03b3cf0c29fef4bd543af1a160b60436540951d
7
- data.tar.gz: 2b436b967eec208c199d5b1c527d45e42e0a5eadb88b7dd6f4b5eda413d3aee54dfd647bf0739ff47d3a498ed23ba0eb3d61466d70e7f450a8c65c6b4a450aa8
6
+ metadata.gz: 9655fb0dcaac2b8adfe6701e8aa04cc95153a8d43d86ce3c08c31359a939eaa937b024dd5619671879e5db491bee465be804aee3c9f5f791c16676b283f53def
7
+ data.tar.gz: 6c3c8e2736e9e9bea326026bf9be568a040441c5e060c402db24844b889d512d11dd1802270a278fa450c98320ff68e028f27d689601d6c861c0d1b35f4d967c
@@ -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 + 'Accessor'
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 = ::OpenStruct.new(value: value, index: index)
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
@@ -25,6 +25,7 @@ module EacRubyUtils
25
25
  end
26
26
 
27
27
  attr_reader :value
28
+
28
29
  compare_by :value
29
30
  delegate :to_s, :zero?, to: :value
30
31
 
@@ -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
@@ -14,7 +14,7 @@ module EacRubyUtils
14
14
  private
15
15
 
16
16
  def parse_string(value)
17
- ['', 'n', 'no', 'f', 'false'].include?(value.strip.downcase) ? false : true
17
+ ['', 'n', 'no', 'f', 'false'].exclude?(value.strip.downcase)
18
18
  end
19
19
 
20
20
  def parse_number(value)
@@ -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
- " (given #{args.count}, expected #{common_constructor.args_count})"
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.map do |name, index|
38
+ common_constructor.args.each_with_index.to_h do |name, index|
38
39
  [name, args[index]]
39
- end.to_h
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 = ::OpenStruct.new(args: [], options: {})
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
@@ -16,7 +16,7 @@ module EacRubyUtils
16
16
 
17
17
  # @return [Hash]
18
18
  def to_h
19
- attributes.map { |attr| [attr.to_sym, object.send(attr)] }.to_h
19
+ attributes.to_h { |attr| [attr.to_sym, object.send(attr)] }
20
20
  end
21
21
  end
22
22
  end
@@ -12,9 +12,9 @@ module EacRubyUtils
12
12
 
13
13
  def result
14
14
  r = command_line
15
- r = input.command + ' | ' + r if input
15
+ r = "#{input.command} | #{r}" if input
16
16
  r = "cat #{Shellwords.escape(input_file)} | #{r}" if input_file
17
- r += ' > ' + Shellwords.escape(output_file) if output_file
17
+ r += " > #{Shellwords.escape(output_file)}" if output_file
18
18
  r
19
19
  end
20
20
 
@@ -37,7 +37,7 @@ module EacRubyUtils
37
37
 
38
38
  def escape(arg)
39
39
  arg = arg.to_s
40
- m = /^\@ESC_(.+)$/.match(arg)
40
+ m = /^@ESC_(.+)$/.match(arg)
41
41
  m ? m[1] : Shellwords.escape(arg)
42
42
  end
43
43
  end
@@ -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
- def to_s
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 + '.rb')
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('-', '/') + '/' + registry.module_suffix.underscore
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
- "from string \"#{string}\""
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
- Hash[labels.first.map { |k, v| [k.to_i, v.to_s] }]
12
+ labels.first.to_h { |k, v| [k.to_i, v.to_s] }
13
13
  else
14
- Hash[labels.each_with_index.map { |v, i| [i + 1, v.to_s] }]
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
- "#{instance.to_debug}, Values: #{@values.keys})"
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
- Hash[labels.first.map { |k, v| [k.to_s, v.to_s] }]
12
+ labels.first.to_h { |k, v| [k.to_s, v.to_s] }
13
13
  else
14
- Hash[labels.map { |v| [v.to_s, v.to_s] }]
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
- Hash[labels.first.map { |k, v| [k.to_sym, v.to_sym] }]
12
+ labels.first.to_h { |k, v| [k.to_sym, v.to_sym] }
13
13
  else
14
- Hash[labels.map { |v| [v.to_sym, v.to_sym] }]
14
+ labels.to_h { |v| [v.to_sym, v.to_sym] }
15
15
  end
16
16
  end
17
17
  end
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'active_support/concern'
4
- Dir["#{__dir__}/#{::File.basename(__FILE__, '.*')}/*.rb"].sort.each do |partial|
4
+ Dir["#{__dir__}/#{File.basename(__FILE__, '.*')}/*.rb"].sort.each do |partial|
5
5
  require partial
6
6
  end
7
7
 
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'eac_ruby_utils/locales/from_gem'
4
- ::EacRubyUtils::Locales::FromGem.include_all
4
+ EacRubyUtils::Locales::FromGem.include_all
@@ -33,7 +33,7 @@ module EacRubyUtils
33
33
  end
34
34
 
35
35
  def i18n_translate
36
- ::I18n.translate(i18n_key, i18n_options)
36
+ ::I18n.t(i18n_key, i18n_options)
37
37
  end
38
38
 
39
39
  def locale
@@ -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.map { |key| [key, consume(key)] }.to_h)
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
- " (given #{args.count}, expected 1..2)"
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
 
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'eac_ruby_utils/require_sub'
4
- ::EacRubyUtils.require_sub __FILE__
4
+ EacRubyUtils.require_sub __FILE__
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'eac_ruby_utils/require_sub'
4
- ::EacRubyUtils.require_sub __FILE__
4
+ EacRubyUtils.require_sub __FILE__
@@ -3,7 +3,7 @@
3
3
  require 'eac_ruby_utils/common_constructor'
4
4
 
5
5
  class Class
6
- def common_constructor(*args, &block)
7
- ::EacRubyUtils::CommonConstructor.new(*args, &block).setup_class(self)
6
+ def common_constructor(...)
7
+ ::EacRubyUtils::CommonConstructor.new(...).setup_class(self)
8
8
  end
9
9
  end
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'eac_ruby_utils/require_sub'
4
- ::EacRubyUtils.require_sub(__FILE__)
4
+ EacRubyUtils.require_sub(__FILE__)
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'eac_ruby_utils/require_sub'
4
- ::EacRubyUtils.require_sub __FILE__
4
+ EacRubyUtils.require_sub __FILE__
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'eac_ruby_utils/require_sub'
4
- ::EacRubyUtils.require_sub __FILE__
4
+ EacRubyUtils.require_sub __FILE__
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- Dir["#{File.dirname(__FILE__)}/#{::File.basename(__FILE__, '.*')}/*.rb"].sort.each do |path|
3
+ Dir["#{File.dirname(__FILE__)}/#{File.basename(__FILE__, '.*')}/*.rb"].sort.each do |path|
4
4
  require path
5
5
  end
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'eac_ruby_utils/require_sub'
4
- ::EacRubyUtils.require_sub(__FILE__)
4
+ EacRubyUtils.require_sub(__FILE__)
@@ -2,4 +2,4 @@
2
2
 
3
3
  require 'active_support/core_ext/module/introspection'
4
4
 
5
- ::Module.alias_method :module_parent, :parent unless ::Module.method_defined?(:module_parent)
5
+ Module.alias_method :module_parent, :parent unless Module.method_defined?(:module_parent)
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'eac_ruby_utils/require_sub'
4
- ::EacRubyUtils.require_sub(__FILE__)
4
+ EacRubyUtils.require_sub(__FILE__)
@@ -13,20 +13,20 @@ class Object
13
13
  def pretty_debug(options = {})
14
14
  print_debug_options(options)
15
15
 
16
- STDERR.write(pretty_inspect)
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
- STDERR.write(to_debug + "\n")
23
+ $stderr.write("#{to_debug}\n")
24
24
 
25
25
  self
26
26
  end
27
27
 
28
28
  def print_debug_label(label)
29
- STDERR.write("#{label}: ")
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
- STDERR.write(char * (4 + title.length) + "\n")
40
- STDERR.write("#{char} #{title} #{char}\n")
41
- STDERR.write(char * (4 + title.length) + "\n")
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- Dir["#{File.dirname(__FILE__)}/#{::File.basename(__FILE__, '.*')}/*.rb"].sort.each do |path|
3
+ Dir["#{File.dirname(__FILE__)}/#{File.basename(__FILE__, '.*')}/*.rb"].sort.each do |path|
4
4
  require path
5
5
  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 ::RuntimeError, "\"#{self}\" is not a directory" unless directory?
9
+ raise "\"#{self}\" is not a directory" unless directory?
10
10
 
11
11
  glob(*args)
12
12
  end
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'eac_ruby_utils/require_sub'
4
- ::EacRubyUtils.require_sub __FILE__
4
+ EacRubyUtils.require_sub __FILE__
@@ -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
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'eac_ruby_utils/require_sub'
4
- ::EacRubyUtils.require_sub __FILE__
4
+ EacRubyUtils.require_sub __FILE__
@@ -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
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'eac_ruby_utils/require_sub'
4
- ::EacRubyUtils.require_sub __FILE__
4
+ EacRubyUtils.require_sub __FILE__
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'eac_ruby_utils/require_sub'
4
- ::EacRubyUtils.require_sub __FILE__
4
+ EacRubyUtils.require_sub __FILE__
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'eac_ruby_utils/require_sub'
4
- ::EacRubyUtils.require_sub(__FILE__)
4
+ EacRubyUtils.require_sub(__FILE__)
@@ -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
- " \"#{options[OPTION_INCLUDE_MODULES]}\""
57
+ raise ::ArgumentError, "Invalid value for 'options[OPTION_INCLUDE_MODULES]': " \
58
+ "\"#{options[OPTION_INCLUDE_MODULES]}\""
59
59
  end
60
60
 
61
61
  # @return [Symbol]
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'eac_ruby_utils/require_sub'
4
- ::EacRubyUtils.require_sub(__FILE__)
4
+ EacRubyUtils.require_sub(__FILE__)
5
5
 
6
6
  module EacRubyUtils
7
7
  module Rspec
@@ -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
- "a \"#{key}\" method or declare a #{constant_name(true)} constant."
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
 
@@ -20,7 +20,7 @@ module EacRubyUtils
20
20
 
21
21
  def fatal_error(string)
22
22
  error(string)
23
- ::Kernel.exit 1 # rubocop:disable Rails/Exit
23
+ ::Kernel.exit 1
24
24
  end
25
25
 
26
26
  # @see EacRubyUtils::Speaker::Sender.input
@@ -52,7 +52,7 @@ module EacRubyUtils
52
52
  def without_join(*strings)
53
53
  return string if strings.any?(&:nil?)
54
54
 
55
- strings.join('')
55
+ strings.join
56
56
  end
57
57
 
58
58
  def end_index
@@ -34,7 +34,7 @@ module EacRubyUtils
34
34
  end
35
35
 
36
36
  def slice_fetch(*keys)
37
- self.class.new(keys.map { |key| [key, fetch(key)] }.to_h)
37
+ self.class.new(keys.index_with { |key| fetch(key) })
38
38
  end
39
39
 
40
40
  def to_h
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EacRubyUtils
4
- VERSION = '0.119.2'
4
+ VERSION = '0.120.0'
5
5
  end
@@ -76,7 +76,7 @@ module EacRubyUtils
76
76
  end
77
77
 
78
78
  def result_hashable
79
- source.to_h.map { |k, v| [k.to_sym, sanitize_value(v)] }.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.119.2
4
+ version: 0.120.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: 2023-09-06 00:00:00.000000000 Z
11
+ date: 2023-11-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -98,28 +98,28 @@ dependencies:
98
98
  requirements:
99
99
  - - "~>"
100
100
  - !ruby/object:Gem::Version
101
- version: '0.4'
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.4'
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.5.1
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.5.1
122
+ version: '0.9'
123
123
  description:
124
124
  email:
125
125
  executables: []
@@ -265,6 +265,7 @@ files:
265
265
  - lib/eac_ruby_utils/patches/object/if_nil.rb
266
266
  - lib/eac_ruby_utils/patches/object/if_present.rb
267
267
  - lib/eac_ruby_utils/patches/object/if_respond.rb
268
+ - lib/eac_ruby_utils/patches/object/recursive_build.rb
268
269
  - lib/eac_ruby_utils/patches/object/to_bool.rb
269
270
  - lib/eac_ruby_utils/patches/object/to_pathname.rb
270
271
  - lib/eac_ruby_utils/patches/object/to_uri.rb
@@ -328,7 +329,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
328
329
  requirements:
329
330
  - - ">="
330
331
  - !ruby/object:Gem::Version
331
- version: '0'
332
+ version: '2.7'
332
333
  required_rubygems_version: !ruby/object:Gem::Requirement
333
334
  requirements:
334
335
  - - ">="