eac_ruby_utils 0.117.1 → 0.118.1
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_instance_method.rb +34 -0
- data/lib/eac_ruby_utils/gems_registry.rb +0 -1
- data/lib/eac_ruby_utils/method_class.rb +7 -15
- data/lib/eac_ruby_utils/patches/module/acts_as_instance_method.rb +10 -0
- data/lib/eac_ruby_utils/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 904ea7b7f6c0df2889d854f1f2aba29f52511bab46ab634cc6faf850fe2421f4
|
4
|
+
data.tar.gz: 878c847fcdc7214bafc113c5a3af0269537c967858c6d399381f54ae997f0681
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d7c3d1433a92489eb25ba845e0bc84b34a8065ececa9f27220a591176d4197a3ecf66de8f69dd27970fed3e3e5b24d9ae50679dcea3b19e0a104ef82d634e455
|
7
|
+
data.tar.gz: 5ba94d00fe8576164dcc74caa66e54f13fdc5abf1bf9c9d8d7704a3727837a0dde5dac3c0e1ffa7fcf4ee37180faa41475e9a888dd235ec1fb23fdbdce9bf414
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'active_support/core_ext/module/introspection'
|
4
|
+
require 'eac_ruby_utils/patches/class/common_constructor'
|
5
|
+
require 'eac_ruby_utils/patches/module/module_parent'
|
6
|
+
require 'eac_ruby_utils/patches/string/inflector'
|
7
|
+
|
8
|
+
module EacRubyUtils
|
9
|
+
class ActsAsInstanceMethod
|
10
|
+
common_constructor :method_class
|
11
|
+
|
12
|
+
# @param sender_module [Module, nil]
|
13
|
+
# @return [self]
|
14
|
+
def setup(sender_module = nil)
|
15
|
+
sender_module ||= default_sender_module
|
16
|
+
the_setup = self
|
17
|
+
sender_module.define_method(method_name) do |*args, &block|
|
18
|
+
the_setup.method_class.new(self, *args, &block).result
|
19
|
+
end
|
20
|
+
|
21
|
+
self
|
22
|
+
end
|
23
|
+
|
24
|
+
# @return [String]
|
25
|
+
def method_name
|
26
|
+
method_class.name.demodulize.underscore.variableize
|
27
|
+
end
|
28
|
+
|
29
|
+
# @return [Module]
|
30
|
+
def default_sender_module
|
31
|
+
method_class.module_parent
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -1,10 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require '
|
3
|
+
require 'eac_ruby_utils/acts_as_instance_method'
|
4
4
|
require 'eac_ruby_utils/patches/class/common_constructor'
|
5
5
|
require 'eac_ruby_utils/patches/module/common_concern'
|
6
|
-
require 'eac_ruby_utils/patches/module/module_parent'
|
7
|
-
require 'eac_ruby_utils/patches/string/inflector'
|
8
6
|
|
9
7
|
module EacRubyUtils
|
10
8
|
module MethodClass
|
@@ -12,24 +10,18 @@ module EacRubyUtils
|
|
12
10
|
::EacRubyUtils::MethodClass::Setup.new(self)
|
13
11
|
end
|
14
12
|
|
15
|
-
class Setup
|
16
|
-
common_constructor :method_class, :static_method, default: [false]
|
13
|
+
class Setup < ::EacRubyUtils::ActsAsInstanceMethod
|
14
|
+
common_constructor :method_class, :static_method, default: [false],
|
15
|
+
super_args: -> { [method_class] } do
|
17
16
|
perform
|
18
17
|
end
|
19
18
|
|
20
19
|
def perform
|
21
|
-
|
22
|
-
sender_module.define_method(method_name) do |*args, &block|
|
23
|
-
the_setup.method_class.new(self, *args, &block).result
|
24
|
-
end
|
20
|
+
setup
|
25
21
|
end
|
26
22
|
|
27
|
-
def
|
28
|
-
|
29
|
-
end
|
30
|
-
|
31
|
-
def sender_module
|
32
|
-
r = method_class.module_parent
|
23
|
+
def default_sender_module
|
24
|
+
r = super
|
33
25
|
r = r.singleton_class if static_method
|
34
26
|
r
|
35
27
|
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.
|
4
|
+
version: 0.118.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: 2023-
|
11
|
+
date: 2023-06-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -139,6 +139,7 @@ files:
|
|
139
139
|
- lib/eac_ruby_utils/acts_as_immutable/hash_accessor.rb
|
140
140
|
- lib/eac_ruby_utils/acts_as_immutable/instance_methods.rb
|
141
141
|
- lib/eac_ruby_utils/acts_as_immutable/set_accessor.rb
|
142
|
+
- lib/eac_ruby_utils/acts_as_instance_method.rb
|
142
143
|
- lib/eac_ruby_utils/arguments_consumer.rb
|
143
144
|
- lib/eac_ruby_utils/bit.rb
|
144
145
|
- lib/eac_ruby_utils/bit_array.rb
|
@@ -243,6 +244,7 @@ files:
|
|
243
244
|
- lib/eac_ruby_utils/patches/module/abstract_methods.rb
|
244
245
|
- lib/eac_ruby_utils/patches/module/acts_as_abstract.rb
|
245
246
|
- lib/eac_ruby_utils/patches/module/acts_as_immutable.rb
|
247
|
+
- lib/eac_ruby_utils/patches/module/acts_as_instance_method.rb
|
246
248
|
- lib/eac_ruby_utils/patches/module/common_concern.rb
|
247
249
|
- lib/eac_ruby_utils/patches/module/compare_by.rb
|
248
250
|
- lib/eac_ruby_utils/patches/module/context.rb
|