ruby3-backward-compatibility 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -1
- data/Gemfile.lock +1 -1
- data/lib/ruby3_backward_compatibility/ruby3_keywords.rb +9 -0
- data/lib/ruby3_backward_compatibility/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4551e0985507c3ab5633b97825f059f34962dcfea27dfdb5ad9a3fe7d15a19f6
|
4
|
+
data.tar.gz: c211c8d15240c592d3ab2fd355f76dfb58ed88b548129e951b23764c577a9d51
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a79863218e982c240626e13c6276e0cf1afd5a5bbffc823e427f75e126534c211efa94c5947cc253bc9e4011fe2a2bf1729d7e0ed37b3ac244353c22bd1fa115
|
7
|
+
data.tar.gz: c9f29e66e4162bfc9a8b0afee0e162dacca15eb2158cd51ba5e92cf01c0ba7c33e27255c485ac88257afa715af16823279f078cbf96cca03e5ea17995ff434d5
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
@@ -2,12 +2,21 @@ module Ruby3BackwardCompatibility
|
|
2
2
|
module Ruby3Keywords
|
3
3
|
def ruby3_keywords(*methods)
|
4
4
|
methods.each do |method|
|
5
|
+
method_is_private = private_instance_methods.include?(method)
|
6
|
+
method_is_protected = protected_instance_methods.include?(method)
|
7
|
+
|
5
8
|
_ruby3_keywords_module.define_method(method) do |*args, **keyword_args|
|
6
9
|
if args.last.is_a?(Hash)
|
7
10
|
keyword_args.merge!(args.pop)
|
8
11
|
end
|
9
12
|
super(*args, **keyword_args)
|
10
13
|
end
|
14
|
+
|
15
|
+
if method_is_private
|
16
|
+
_ruby3_keywords_module.send(:private, method)
|
17
|
+
elsif method_is_protected
|
18
|
+
_ruby3_keywords_module.send(:protected, method)
|
19
|
+
end
|
11
20
|
end
|
12
21
|
end
|
13
22
|
|