delegate 0.3.1 → 0.5.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 +4 -4
- data/.document +4 -0
- data/.github/release.yml +4 -0
- data/.github/workflows/push_gem.yml +46 -0
- data/.github/workflows/sync-ruby.yml +33 -0
- data/.github/workflows/test.yml +1 -1
- data/{LICENSE.txt → BSDL} +3 -3
- data/COPYING +56 -0
- data/delegate.gemspec +1 -1
- data/lib/delegate.rb +21 -14
- metadata +10 -8
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 4c3016b29b2e5293f2a1640abbf72cf0fe819f0745ca5bdf007c87ef7ed4abfe
|
|
4
|
+
data.tar.gz: e3b42b7d7213d92697d0246250dee6ba6c7ac2e76455dabe68e991e4c126a51b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f9ffc701e9a7323a98cb5437abc35150507c1908232d8ef86bd0bd2c0aa3fa69da3ee9105d064427cda5d3e6bf073babf996c99e1783b494b01a729793228cad
|
|
7
|
+
data.tar.gz: b906eb55858d81abc66dfce6c3468417cbac4023960ab143fca5e6c36a0fe00976a6d2bee3f55f07d988e5c9897a5037c6690ca91c7cb2fb536098fc64eaff1a
|
data/.document
ADDED
data/.github/release.yml
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
name: Publish gem to rubygems.org
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags:
|
|
6
|
+
- 'v*'
|
|
7
|
+
|
|
8
|
+
permissions:
|
|
9
|
+
contents: read
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
push:
|
|
13
|
+
if: github.repository == 'ruby/delegate'
|
|
14
|
+
runs-on: ubuntu-latest
|
|
15
|
+
|
|
16
|
+
environment:
|
|
17
|
+
name: rubygems.org
|
|
18
|
+
url: https://rubygems.org/gems/delegate
|
|
19
|
+
|
|
20
|
+
permissions:
|
|
21
|
+
contents: write
|
|
22
|
+
id-token: write
|
|
23
|
+
|
|
24
|
+
steps:
|
|
25
|
+
- name: Harden Runner
|
|
26
|
+
uses: step-security/harden-runner@20cf305ff2072d973412fa9b1e3a4f227bda3c76 # v2.14.0
|
|
27
|
+
with:
|
|
28
|
+
egress-policy: audit
|
|
29
|
+
|
|
30
|
+
- uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
|
|
31
|
+
|
|
32
|
+
- name: Set up Ruby
|
|
33
|
+
uses: ruby/setup-ruby@d5126b9b3579e429dd52e51e68624dda2e05be25 # v1.267.0
|
|
34
|
+
with:
|
|
35
|
+
bundler-cache: true
|
|
36
|
+
ruby-version: ruby
|
|
37
|
+
|
|
38
|
+
- name: Publish to RubyGems
|
|
39
|
+
uses: rubygems/release-gem@1c162a739e8b4cb21a676e97b087e8268d8fc40b # v1.1.2
|
|
40
|
+
|
|
41
|
+
- name: Create GitHub release
|
|
42
|
+
run: |
|
|
43
|
+
tag_name="$(git describe --tags --abbrev=0)"
|
|
44
|
+
gh release create "${tag_name}" --verify-tag --generate-notes
|
|
45
|
+
env:
|
|
46
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
name: Sync ruby
|
|
2
|
+
on:
|
|
3
|
+
push:
|
|
4
|
+
branches: [master]
|
|
5
|
+
jobs:
|
|
6
|
+
sync:
|
|
7
|
+
name: Sync ruby
|
|
8
|
+
runs-on: ubuntu-latest
|
|
9
|
+
if: ${{ github.repository_owner == 'ruby' }}
|
|
10
|
+
steps:
|
|
11
|
+
- uses: actions/checkout@v6
|
|
12
|
+
|
|
13
|
+
- name: Create GitHub App token
|
|
14
|
+
id: app-token
|
|
15
|
+
uses: actions/create-github-app-token@v2
|
|
16
|
+
with:
|
|
17
|
+
app-id: 2060836
|
|
18
|
+
private-key: ${{ secrets.RUBY_SYNC_DEFAULT_GEMS_PRIVATE_KEY }}
|
|
19
|
+
owner: ruby
|
|
20
|
+
repositories: ruby
|
|
21
|
+
|
|
22
|
+
- name: Sync to ruby/ruby
|
|
23
|
+
uses: convictional/trigger-workflow-and-wait@v1.6.5
|
|
24
|
+
with:
|
|
25
|
+
owner: ruby
|
|
26
|
+
repo: ruby
|
|
27
|
+
workflow_file_name: sync_default_gems.yml
|
|
28
|
+
github_token: ${{ steps.app-token.outputs.token }}
|
|
29
|
+
ref: master
|
|
30
|
+
client_payload: |
|
|
31
|
+
{"gem":"${{ github.event.repository.name }}","before":"${{ github.event.before }}","after":"${{ github.event.after }}"}
|
|
32
|
+
propagate_failure: true
|
|
33
|
+
wait_interval: 10
|
data/.github/workflows/test.yml
CHANGED
data/{LICENSE.txt → BSDL}
RENAMED
|
@@ -4,10 +4,10 @@ Redistribution and use in source and binary forms, with or without
|
|
|
4
4
|
modification, are permitted provided that the following conditions
|
|
5
5
|
are met:
|
|
6
6
|
1. Redistributions of source code must retain the above copyright
|
|
7
|
-
notice, this list of conditions and the following disclaimer.
|
|
7
|
+
notice, this list of conditions and the following disclaimer.
|
|
8
8
|
2. Redistributions in binary form must reproduce the above copyright
|
|
9
|
-
notice, this list of conditions and the following disclaimer in the
|
|
10
|
-
documentation and/or other materials provided with the distribution.
|
|
9
|
+
notice, this list of conditions and the following disclaimer in the
|
|
10
|
+
documentation and/or other materials provided with the distribution.
|
|
11
11
|
|
|
12
12
|
THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
|
13
13
|
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
data/COPYING
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
Ruby is copyrighted free software by Yukihiro Matsumoto <matz@netlab.jp>.
|
|
2
|
+
You can redistribute it and/or modify it under either the terms of the
|
|
3
|
+
2-clause BSDL (see the file BSDL), or the conditions below:
|
|
4
|
+
|
|
5
|
+
1. You may make and give away verbatim copies of the source form of the
|
|
6
|
+
software without restriction, provided that you duplicate all of the
|
|
7
|
+
original copyright notices and associated disclaimers.
|
|
8
|
+
|
|
9
|
+
2. You may modify your copy of the software in any way, provided that
|
|
10
|
+
you do at least ONE of the following:
|
|
11
|
+
|
|
12
|
+
a. place your modifications in the Public Domain or otherwise
|
|
13
|
+
make them Freely Available, such as by posting said
|
|
14
|
+
modifications to Usenet or an equivalent medium, or by allowing
|
|
15
|
+
the author to include your modifications in the software.
|
|
16
|
+
|
|
17
|
+
b. use the modified software only within your corporation or
|
|
18
|
+
organization.
|
|
19
|
+
|
|
20
|
+
c. give non-standard binaries non-standard names, with
|
|
21
|
+
instructions on where to get the original software distribution.
|
|
22
|
+
|
|
23
|
+
d. make other distribution arrangements with the author.
|
|
24
|
+
|
|
25
|
+
3. You may distribute the software in object code or binary form,
|
|
26
|
+
provided that you do at least ONE of the following:
|
|
27
|
+
|
|
28
|
+
a. distribute the binaries and library files of the software,
|
|
29
|
+
together with instructions (in the manual page or equivalent)
|
|
30
|
+
on where to get the original distribution.
|
|
31
|
+
|
|
32
|
+
b. accompany the distribution with the machine-readable source of
|
|
33
|
+
the software.
|
|
34
|
+
|
|
35
|
+
c. give non-standard binaries non-standard names, with
|
|
36
|
+
instructions on where to get the original software distribution.
|
|
37
|
+
|
|
38
|
+
d. make other distribution arrangements with the author.
|
|
39
|
+
|
|
40
|
+
4. You may modify and include the part of the software into any other
|
|
41
|
+
software (possibly commercial). But some files in the distribution
|
|
42
|
+
are not written by the author, so that they are not under these terms.
|
|
43
|
+
|
|
44
|
+
For the list of those files and their copying conditions, see the
|
|
45
|
+
file LEGAL.
|
|
46
|
+
|
|
47
|
+
5. The scripts and library files supplied as input to or produced as
|
|
48
|
+
output from the software do not automatically fall under the
|
|
49
|
+
copyright of the software, but belong to whomever generated them,
|
|
50
|
+
and may be sold commercially, and may be aggregated with this
|
|
51
|
+
software.
|
|
52
|
+
|
|
53
|
+
6. THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
|
|
54
|
+
IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
|
55
|
+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
56
|
+
PURPOSE.
|
data/delegate.gemspec
CHANGED
data/lib/delegate.rb
CHANGED
|
@@ -39,7 +39,8 @@
|
|
|
39
39
|
# Be advised, RDoc will not detect delegated methods.
|
|
40
40
|
#
|
|
41
41
|
class Delegator < BasicObject
|
|
42
|
-
|
|
42
|
+
# The version string
|
|
43
|
+
VERSION = "0.5.0"
|
|
43
44
|
|
|
44
45
|
kernel = ::Kernel.dup
|
|
45
46
|
kernel.class_eval do
|
|
@@ -77,7 +78,7 @@ class Delegator < BasicObject
|
|
|
77
78
|
end
|
|
78
79
|
|
|
79
80
|
#
|
|
80
|
-
# Handles the magic of delegation through
|
|
81
|
+
# Handles the magic of delegation through +__getobj__+.
|
|
81
82
|
#
|
|
82
83
|
ruby2_keywords def method_missing(m, *args, &block)
|
|
83
84
|
r = true
|
|
@@ -94,7 +95,7 @@ class Delegator < BasicObject
|
|
|
94
95
|
|
|
95
96
|
#
|
|
96
97
|
# Checks for a method provided by this the delegate object by forwarding the
|
|
97
|
-
# call through
|
|
98
|
+
# call through +__getobj__+.
|
|
98
99
|
#
|
|
99
100
|
def respond_to_missing?(m, include_private)
|
|
100
101
|
r = true
|
|
@@ -107,7 +108,7 @@ class Delegator < BasicObject
|
|
|
107
108
|
r
|
|
108
109
|
end
|
|
109
110
|
|
|
110
|
-
KERNEL_RESPOND_TO = ::Kernel.instance_method(:respond_to?)
|
|
111
|
+
KERNEL_RESPOND_TO = ::Kernel.instance_method(:respond_to?) # :nodoc:
|
|
111
112
|
private_constant :KERNEL_RESPOND_TO
|
|
112
113
|
|
|
113
114
|
# Handle BasicObject instances
|
|
@@ -126,7 +127,7 @@ class Delegator < BasicObject
|
|
|
126
127
|
|
|
127
128
|
#
|
|
128
129
|
# Returns the methods available to this delegate object as the union
|
|
129
|
-
# of this object's and
|
|
130
|
+
# of this object's and +__getobj__+ methods.
|
|
130
131
|
#
|
|
131
132
|
def methods(all=true)
|
|
132
133
|
__getobj__.methods(all) | super
|
|
@@ -134,7 +135,7 @@ class Delegator < BasicObject
|
|
|
134
135
|
|
|
135
136
|
#
|
|
136
137
|
# Returns the methods available to this delegate object as the union
|
|
137
|
-
# of this object's and
|
|
138
|
+
# of this object's and +__getobj__+ public methods.
|
|
138
139
|
#
|
|
139
140
|
def public_methods(all=true)
|
|
140
141
|
__getobj__.public_methods(all) | super
|
|
@@ -142,7 +143,7 @@ class Delegator < BasicObject
|
|
|
142
143
|
|
|
143
144
|
#
|
|
144
145
|
# Returns the methods available to this delegate object as the union
|
|
145
|
-
# of this object's and
|
|
146
|
+
# of this object's and +__getobj__+ protected methods.
|
|
146
147
|
#
|
|
147
148
|
def protected_methods(all=true)
|
|
148
149
|
__getobj__.protected_methods(all) | super
|
|
@@ -175,7 +176,7 @@ class Delegator < BasicObject
|
|
|
175
176
|
end
|
|
176
177
|
|
|
177
178
|
#
|
|
178
|
-
# Delegates ! to the
|
|
179
|
+
# Delegates ! to the +__getobj__+
|
|
179
180
|
#
|
|
180
181
|
def !
|
|
181
182
|
!__getobj__
|
|
@@ -186,7 +187,7 @@ class Delegator < BasicObject
|
|
|
186
187
|
# method calls are being delegated to.
|
|
187
188
|
#
|
|
188
189
|
def __getobj__
|
|
189
|
-
__raise__ ::NotImplementedError, "need to define
|
|
190
|
+
__raise__ ::NotImplementedError, "need to define '__getobj__'"
|
|
190
191
|
end
|
|
191
192
|
|
|
192
193
|
#
|
|
@@ -194,11 +195,11 @@ class Delegator < BasicObject
|
|
|
194
195
|
# to _obj_.
|
|
195
196
|
#
|
|
196
197
|
def __setobj__(obj)
|
|
197
|
-
__raise__ ::NotImplementedError, "need to define
|
|
198
|
+
__raise__ ::NotImplementedError, "need to define '__setobj__'"
|
|
198
199
|
end
|
|
199
200
|
|
|
200
201
|
#
|
|
201
|
-
# Serialization support for the object returned by
|
|
202
|
+
# Serialization support for the object returned by +__getobj__+.
|
|
202
203
|
#
|
|
203
204
|
def marshal_dump
|
|
204
205
|
ivars = instance_variables.reject {|var| /\A@delegate_/ =~ var}
|
|
@@ -232,7 +233,7 @@ class Delegator < BasicObject
|
|
|
232
233
|
|
|
233
234
|
##
|
|
234
235
|
# :method: freeze
|
|
235
|
-
# Freeze both the object returned by
|
|
236
|
+
# Freeze both the object returned by +__getobj__+ and self.
|
|
236
237
|
#
|
|
237
238
|
def freeze
|
|
238
239
|
__getobj__.freeze
|
|
@@ -344,10 +345,16 @@ class SimpleDelegator < Delegator
|
|
|
344
345
|
end
|
|
345
346
|
|
|
346
347
|
def Delegator.delegating_block(mid) # :nodoc:
|
|
347
|
-
lambda do |*args, &block|
|
|
348
|
+
prok = lambda do |*args, &block|
|
|
348
349
|
target = self.__getobj__
|
|
349
350
|
target.__send__(mid, *args, &block)
|
|
350
|
-
end
|
|
351
|
+
end
|
|
352
|
+
prok.ruby2_keywords
|
|
353
|
+
if defined?(Ractor.shareable_proc)
|
|
354
|
+
Ractor.shareable_proc(&prok)
|
|
355
|
+
else
|
|
356
|
+
prok
|
|
357
|
+
end
|
|
351
358
|
end
|
|
352
359
|
|
|
353
360
|
#
|
metadata
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: delegate
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.5.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Yukihiro Matsumoto
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: bin
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
12
11
|
dependencies: []
|
|
13
12
|
description: Provides three abilities to delegate method calls to an object.
|
|
14
13
|
email:
|
|
@@ -17,11 +16,16 @@ executables: []
|
|
|
17
16
|
extensions: []
|
|
18
17
|
extra_rdoc_files: []
|
|
19
18
|
files:
|
|
19
|
+
- ".document"
|
|
20
20
|
- ".github/dependabot.yml"
|
|
21
|
+
- ".github/release.yml"
|
|
22
|
+
- ".github/workflows/push_gem.yml"
|
|
23
|
+
- ".github/workflows/sync-ruby.yml"
|
|
21
24
|
- ".github/workflows/test.yml"
|
|
22
25
|
- ".gitignore"
|
|
26
|
+
- BSDL
|
|
27
|
+
- COPYING
|
|
23
28
|
- Gemfile
|
|
24
|
-
- LICENSE.txt
|
|
25
29
|
- README.md
|
|
26
30
|
- Rakefile
|
|
27
31
|
- bin/console
|
|
@@ -35,7 +39,6 @@ licenses:
|
|
|
35
39
|
metadata:
|
|
36
40
|
homepage_uri: https://github.com/ruby/delegate
|
|
37
41
|
source_code_uri: https://github.com/ruby/delegate
|
|
38
|
-
post_install_message:
|
|
39
42
|
rdoc_options: []
|
|
40
43
|
require_paths:
|
|
41
44
|
- lib
|
|
@@ -43,15 +46,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
43
46
|
requirements:
|
|
44
47
|
- - ">="
|
|
45
48
|
- !ruby/object:Gem::Version
|
|
46
|
-
version: '
|
|
49
|
+
version: '3.0'
|
|
47
50
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
48
51
|
requirements:
|
|
49
52
|
- - ">="
|
|
50
53
|
- !ruby/object:Gem::Version
|
|
51
54
|
version: '0'
|
|
52
55
|
requirements: []
|
|
53
|
-
rubygems_version: 3.
|
|
54
|
-
signing_key:
|
|
56
|
+
rubygems_version: 3.6.9
|
|
55
57
|
specification_version: 4
|
|
56
58
|
summary: Provides three abilities to delegate method calls to an object.
|
|
57
59
|
test_files: []
|