ruby2_keywords 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE +22 -0
- data/README.md +18 -2
- data/lib/ruby2_keywords.rb +35 -1
- metadata +13 -10
- data/ruby2_keywords.gemspec +0 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: daa7fbb999caacb1acd146d67beca60602e4f3ae1166e3f1e526ecb5e2d06b31
|
4
|
+
data.tar.gz: 4930b1bab3ed2f332a3303c7ded242cc3d7756ab126925c3ee9a6ec5cdec3416
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 93b7743864461e4460472ef2a21dfb49aa5b16dc113e197286d6936434d06d17f4c235504d373ee47a445e096bc484c0c9462b47e74dc75484eee95e760bc8fd
|
7
|
+
data.tar.gz: 62e4a65786b11cd9c99f089696a60c02bd396e542d53be2fc073af8529d1e1f5311b7710e82e4e65621d28e6fd31449468046c710876b01d0c80778a7fc17a0f
|
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright 2019-2020 Nobuyoshi Nakada, Yusuke Endoh
|
2
|
+
|
3
|
+
Redistribution and use in source and binary forms, with or without
|
4
|
+
modification, are permitted provided that the following conditions are met:
|
5
|
+
|
6
|
+
1. Redistributions of source code must retain the above copyright notice, this
|
7
|
+
list of conditions and the following disclaimer.
|
8
|
+
|
9
|
+
2. Redistributions in binary form must reproduce the above copyright notice,
|
10
|
+
this list of conditions and the following disclaimer in the documentation
|
11
|
+
and/or other materials provided with the distribution.
|
12
|
+
|
13
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
14
|
+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
15
|
+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
16
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
17
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
18
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
19
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
20
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
21
|
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
22
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
data/README.md
CHANGED
@@ -42,10 +42,26 @@ ruby2_keywords def oldstyle_keywords(options = {})
|
|
42
42
|
end
|
43
43
|
```
|
44
44
|
|
45
|
+
You can do the same for a method defined by `Module#define_method`:
|
46
|
+
|
47
|
+
```ruby
|
48
|
+
define_method :delegating_method do |*args, &block|
|
49
|
+
other_method(*args, &block)
|
50
|
+
end
|
51
|
+
ruby2_keywords :delegating_method
|
52
|
+
```
|
53
|
+
|
45
54
|
## Contributing
|
46
55
|
|
47
|
-
Bug reports and pull requests are welcome on GitHub
|
56
|
+
Bug reports and pull requests are welcome on [GitHub] or
|
57
|
+
[Ruby Issue Tracking System].
|
48
58
|
|
49
59
|
## License
|
50
60
|
|
51
|
-
The gem is available as open source under the terms of the
|
61
|
+
The gem is available as open source under the terms of the
|
62
|
+
[Ruby License] or the [2-Clause BSD License].
|
63
|
+
|
64
|
+
[GitHub]: https://github.com/ruby/ruby2_keywords/
|
65
|
+
[Ruby Issue Tracking System]: https://bugs.ruby-lang.org
|
66
|
+
[Ruby License]: https://www.ruby-lang.org/en/about/license.txt
|
67
|
+
[2-Clause BSD License]: https://opensource.org/licenses/BSD-2-Clause
|
data/lib/ruby2_keywords.rb
CHANGED
@@ -1,6 +1,10 @@
|
|
1
1
|
class Module
|
2
|
-
unless
|
2
|
+
unless private_method_defined?(:ruby2_keywords, true)
|
3
3
|
private
|
4
|
+
# call-seq:
|
5
|
+
# ruby2_keywords(method_name, ...)
|
6
|
+
#
|
7
|
+
# Does nothing.
|
4
8
|
def ruby2_keywords(name, *)
|
5
9
|
# nil
|
6
10
|
end
|
@@ -9,6 +13,10 @@ end
|
|
9
13
|
|
10
14
|
main = TOPLEVEL_BINDING.receiver
|
11
15
|
unless main.respond_to?(:ruby2_keywords, true)
|
16
|
+
# call-seq:
|
17
|
+
# ruby2_keywords(method_name, ...)
|
18
|
+
#
|
19
|
+
# Does nothing.
|
12
20
|
def main.ruby2_keywords(name, *)
|
13
21
|
# nil
|
14
22
|
end
|
@@ -16,8 +24,34 @@ end
|
|
16
24
|
|
17
25
|
class Proc
|
18
26
|
unless method_defined?(:ruby2_keywords)
|
27
|
+
# call-seq:
|
28
|
+
# proc.ruby2_keywords -> proc
|
29
|
+
#
|
30
|
+
# Does nothing and just returns the receiver.
|
19
31
|
def ruby2_keywords
|
20
32
|
self
|
21
33
|
end
|
22
34
|
end
|
23
35
|
end
|
36
|
+
|
37
|
+
class << Hash
|
38
|
+
unless method_defined?(:ruby2_keywords_hash?)
|
39
|
+
# call-seq:
|
40
|
+
# Hash.ruby2_keywords_hash?(hash) -> false
|
41
|
+
#
|
42
|
+
# Returns false.
|
43
|
+
def ruby2_keywords_hash?(hash)
|
44
|
+
false
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
unless method_defined?(:ruby2_keywords_hash)
|
49
|
+
# call-seq:
|
50
|
+
# Hash.ruby2_keywords_hash(hash) -> new_hash
|
51
|
+
#
|
52
|
+
# Duplicates a given hash and returns the new hash.
|
53
|
+
def ruby2_keywords_hash(hash)
|
54
|
+
hash.dup
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
metadata
CHANGED
@@ -1,30 +1,33 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby2_keywords
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nobuyoshi Nakada
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-01-19 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
|
-
description:
|
14
|
-
email:
|
13
|
+
description:
|
14
|
+
email:
|
15
15
|
executables: []
|
16
16
|
extensions: []
|
17
17
|
extra_rdoc_files: []
|
18
18
|
files:
|
19
|
+
- LICENSE
|
19
20
|
- README.md
|
20
21
|
- lib/ruby2_keywords.rb
|
21
|
-
- ruby2_keywords.gemspec
|
22
22
|
homepage: https://github.com/ruby/ruby2_keywords
|
23
23
|
licenses:
|
24
24
|
- Ruby
|
25
|
+
- BSD-2-Clause
|
25
26
|
metadata: {}
|
26
|
-
post_install_message:
|
27
|
-
rdoc_options:
|
27
|
+
post_install_message:
|
28
|
+
rdoc_options:
|
29
|
+
- "--main"
|
30
|
+
- README.md
|
28
31
|
require_paths:
|
29
32
|
- lib
|
30
33
|
required_ruby_version: !ruby/object:Gem::Requirement
|
@@ -38,8 +41,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
38
41
|
- !ruby/object:Gem::Version
|
39
42
|
version: '0'
|
40
43
|
requirements: []
|
41
|
-
rubygems_version: 3.
|
42
|
-
signing_key:
|
44
|
+
rubygems_version: 3.2.3
|
45
|
+
signing_key:
|
43
46
|
specification_version: 4
|
44
47
|
summary: Shim library for Module#ruby2_keywords
|
45
48
|
test_files: []
|
data/ruby2_keywords.gemspec
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
version = IO.popen(%W[git -C #{__dir__} describe --tags --match v[0-9]*], &:read)[/\Av?(\d+(?:\.\d+)*)/, 1]
|
2
|
-
|
3
|
-
Gem::Specification.new do |s|
|
4
|
-
s.name = "ruby2_keywords"
|
5
|
-
s.version = version
|
6
|
-
s.summary = "Shim library for Module#ruby2_keywords"
|
7
|
-
s.homepage = "https://github.com/ruby/ruby2_keywords"
|
8
|
-
s.licenses = ["Ruby"]
|
9
|
-
s.authors = ["Nobuyoshi Nakada"]
|
10
|
-
s.require_paths = ["lib"]
|
11
|
-
s.files = [
|
12
|
-
"README.md",
|
13
|
-
"lib/ruby2_keywords.rb",
|
14
|
-
"ruby2_keywords.gemspec",
|
15
|
-
]
|
16
|
-
end
|