eac_ruby_utils 0.112.0 → 0.113.0

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: d4e72428fde957fae996836371e62fcae0017805944e1dff3c714500b4d3659c
4
- data.tar.gz: b419f3b1fb13d82c37c6fa8fed357e0a9a16169318972bd3f57271e73a09d46b
3
+ metadata.gz: 3e7deaaf568625e32fc58c45b43ef41e125924595707b3a2ca2ea394d9dc4393
4
+ data.tar.gz: 4af93c26f87f2918f36cc18b2ad5e3cefa8d6fe6a21bb09282f0112bd2138182
5
5
  SHA512:
6
- metadata.gz: de10ee898b6b0e23d17949b454e1a79e631170e2356926d03732f3ebe4dd29dac7768e5651fcd65aba3ac16c333681bf96ccda7e1b81bff0b3057d045e7ed2f1
7
- data.tar.gz: c845230c38a3ad30c9d502978d1fea5fd144a8d34ca4a044f56479f26847a089256e94c7a0ec301b126ef236cbaf59fbdd12ccff783e0976e8fca90ca47e829c
6
+ metadata.gz: 8144e44599f8dc4b5299a3353e79fc51fa558bcb085e1d8a46d0f40182d06b9c0481f56a4a8b464bddf00a52c67c97d3846875489f90f24d0eba8e87b5ed4384
7
+ data.tar.gz: 657df0404c6f3060e756198aeeb1181b210b7d18564e4b58437a5d79601e3c62d1f2d5bdb686b221b434c2ad81322817798ea329b77b94c2b110c189631055e0
@@ -15,13 +15,17 @@ module EacRubyUtils
15
15
  }.freeze
16
16
 
17
17
  include ::EacRubyUtils::Listable
18
- lists.add_symbol :option, :base, :include_modules, :require_dependency
18
+ lists.add_symbol :option, :base, :include_modules, :require_dependency, :require_mode
19
+ lists.add_symbol :require_mode, :active_support, :autoload, :kernel
19
20
 
20
21
  attr_reader :file, :options
21
22
 
22
23
  def initialize(file, options = {})
23
24
  @file = file
24
25
  @options = self.class.lists.option.hash_keys_validate!(options)
26
+ return unless options[OPTION_REQUIRE_MODE]
27
+
28
+ self.class.lists.require_mode.value_validate!(options[OPTION_REQUIRE_MODE])
25
29
  end
26
30
 
27
31
  # @return [Boolean]
@@ -54,6 +58,15 @@ module EacRubyUtils
54
58
  " \"#{options[OPTION_INCLUDE_MODULES]}\""
55
59
  end
56
60
 
61
+ # @return [Symbol]
62
+ def require_mode
63
+ return options[OPTION_REQUIRE_MODE] if options[OPTION_REQUIRE_MODE]
64
+ return REQUIRE_MODE_ACTIVE_SUPPORT if active_support_require?
65
+ return REQUIRE_MODE_AUTOLOAD if base?
66
+
67
+ REQUIRE_MODE_KERNEL
68
+ end
69
+
57
70
  def require_sub_files
58
71
  sub_files.each(&:require_file)
59
72
  end
@@ -38,26 +38,17 @@ module EacRubyUtils
38
38
  end
39
39
 
40
40
  def require_file
41
- active_support_require || autoload_require || kernel_require
41
+ send("#{owner.require_mode}_require")
42
42
  end
43
43
 
44
44
  private
45
45
 
46
46
  def active_support_require
47
- return false unless owner.active_support_require?
48
-
49
47
  ::Kernel.require_dependency(path)
50
- true
51
48
  end
52
49
 
53
50
  def autoload_require
54
- return false unless owner.base?
55
-
56
- basename = ::File.basename(path, '.*')
57
- return false if basename.start_with?('_')
58
-
59
- owner.base.autoload ::ActiveSupport::Inflector.camelize(basename), path
60
- true
51
+ owner.base.autoload ::ActiveSupport::Inflector.camelize(::File.basename(path, '.*')), path
61
52
  end
62
53
 
63
54
  def kernel_require
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EacRubyUtils
4
- VERSION = '0.112.0'
4
+ VERSION = '0.113.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.112.0
4
+ version: 0.113.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-01-26 00:00:00.000000000 Z
11
+ date: 2023-05-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.1
42
+ version: 2.8.4
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.1
52
+ version: 2.8.4
53
53
  - !ruby/object:Gem::Dependency
54
54
  name: bundler
55
55
  requirement: !ruby/object:Gem::Requirement