ruby2_keywords 0.0.2 → 0.0.4
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/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: 8443fe4f2ad07b84290bdc001804e9dc04914c8252b37430d04e23f54b1bc5d9
|
4
|
+
data.tar.gz: c6f7a1afa106890c3cdce7b15add28d9690380fae66b323f62bf09de2252f919
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7cb31d0ec6b2ac078c6b440b3979d9679ae677a37866c74878b7bf3093477843730da010eb197b80160826b1faeaef7ab50a5be88717c32ae82504497c93d432
|
7
|
+
data.tar.gz: 7b1c59e09aeed3a653994a490a800252ec8f27c87cc781424f52afddaaca7d51f66af595d4cbc119c3c34566a9b8cd0ef62e4cac5f374fdff31ad99cd2c25951
|
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)
|
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.4
|
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
|