eac_ruby_utils 0.133.0 → 0.134.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: 59dea5ef129d2386830b2a29ac3b1a3bdb383857738340519e133d1259bdde4a
4
- data.tar.gz: 01b90174390960bcbbbacd488ecb2d84d2407dbc52b80df52b8d2dd81481d1cc
3
+ metadata.gz: 67b9797b5e613c584015d1101bcf9027e34e5fa8442bd0087d967db89ff41e44
4
+ data.tar.gz: df3aab0d94a57473449bfeea90ef8959c687dfb84243182e7897cd7a3a2f7632
5
5
  SHA512:
6
- metadata.gz: b73d7c0333fbc77945313e8ad9164371a00fa899abdf5be846b10b87bef40702553ce2f637ccd59b6928a36c2706f5d52755a687006a67ebffd867844d47fddf
7
- data.tar.gz: 7eaf3737402874d9edf109f24648fce4bb6781d08d6479e1df88eef61420c88877f6ee26f277ee988eefaed5f5b0af4f28972662f9c5dd37ebb2d0d1eebad959
6
+ metadata.gz: aa28edfdfec3de51d4a00c8cb39f6d259d4f352db7ce8f78e7b1fa11da7f36fe1520e4f5b422486fae990e1024f6a49808390b37b4c62618dc2a46fbaf35e690
7
+ data.tar.gz: 1ebcf27e69838827acce00cd02cad19574d6fe8fba15996b60a774bf74eb555c9ffc5dda51bf3f622195ad384b2d0f099484ae318ed828dbc6a75d9a22c94840
@@ -2,12 +2,19 @@
2
2
 
3
3
  require 'active_support/core_ext/module/introspection'
4
4
  require 'eac_ruby_utils/patches/class/common_constructor'
5
+ require 'eac_ruby_utils/patches/module/listable'
5
6
  require 'eac_ruby_utils/patches/module/module_parent'
6
7
  require 'eac_ruby_utils/patches/string/inflector'
7
8
 
8
9
  module EacRubyUtils
9
10
  class ActsAsInstanceMethod
10
- common_constructor :method_class
11
+ enable_listable
12
+ lists.add_symbol :option, :name_mark
13
+ lists.add_symbol :name_mark, '': :none, '!': :exclamation, '?': :interrogation
14
+
15
+ common_constructor :method_class, :options, default: [{}] do
16
+ self.options = ::EacRubyUtils::ActsAsInstanceMethod.lists.option.hash_keys_validate!(options)
17
+ end
11
18
 
12
19
  # @param sender_module [Module, nil]
13
20
  # @return [self]
@@ -23,7 +30,12 @@ module EacRubyUtils
23
30
 
24
31
  # @return [String]
25
32
  def method_name
26
- method_class.name.demodulize.underscore.variableize
33
+ "#{method_class.name.demodulize.underscore.variableize}#{method_name_mark}"
34
+ end
35
+
36
+ # @return [Symbol]
37
+ def method_name_mark
38
+ options[OPTION_NAME_MARK] || NAME_MARK_NONE
27
39
  end
28
40
 
29
41
  # @return [Module]
@@ -11,8 +11,10 @@ module EacRubyUtils
11
11
  end
12
12
 
13
13
  class Setup < ::EacRubyUtils::ActsAsInstanceMethod
14
- common_constructor :method_class, :static_method, default: [false],
15
- super_args: -> { [method_class] } do
14
+ common_constructor :method_class, :static_method, :options, default: [false, {}],
15
+ super_args: lambda {
16
+ [method_class, options]
17
+ } do
16
18
  perform
17
19
  end
18
20
 
@@ -3,15 +3,15 @@
3
3
  require 'eac_ruby_utils/patches/module/common_concern'
4
4
 
5
5
  module EacRubyUtils
6
- module PatchModule
7
- common_concern
8
-
9
- class_methods do
10
- delegate :patch_module, to: :'::EacRubyUtils::PatchModule'
6
+ class << self
7
+ def patch_module(*)
8
+ ::EacRubyUtils::PatchModule.perform(*)
11
9
  end
10
+ end
12
11
 
12
+ module PatchModule
13
13
  class << self
14
- def patch_module(target, patch)
14
+ def perform(target, patch)
15
15
  return if target.include?(patch)
16
16
 
17
17
  target.send(:include, patch)
@@ -3,8 +3,9 @@
3
3
  require 'eac_ruby_utils/acts_as_instance_method'
4
4
 
5
5
  class Module
6
+ # @param options [Hash]
6
7
  # @return [EacRubyUtils::ActsAsInstanceMethod]
7
- def acts_as_instance_method
8
- ::EacRubyUtils::ActsAsInstanceMethod.new(self).setup
8
+ def acts_as_instance_method(**options)
9
+ ::EacRubyUtils::ActsAsInstanceMethod.new(self, options).setup
9
10
  end
10
11
  end
@@ -4,6 +4,6 @@ require 'eac_ruby_utils/patch_module'
4
4
 
5
5
  class Module
6
6
  def patch_self(patch_module)
7
- ::EacRubyUtils::PatchModule.patch_module(self, patch_module)
7
+ ::EacRubyUtils::PatchModule.perform(self, patch_module)
8
8
  end
9
9
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EacRubyUtils
4
- VERSION = '0.133.0'
4
+ VERSION = '0.134.0'
5
5
  end
@@ -9,7 +9,6 @@ EacRubyUtils::RootModuleSetup.perform __FILE__ do
9
9
  end
10
10
 
11
11
  module EacRubyUtils
12
- include ::EacRubyUtils::PatchModule
13
12
  end
14
13
 
15
14
  require 'eac_ruby_utils/core_ext'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: eac_ruby_utils
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.133.0
4
+ version: 0.134.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Esquilo Azul Company