delegate 0.4.0 → 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 +5 -5
- data/.github/workflows/sync-ruby.yml +33 -0
- data/.github/workflows/test.yml +2 -2
- data/lib/delegate.rb +19 -12
- metadata +6 -6
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
|
@@ -23,24 +23,24 @@ jobs:
|
|
|
23
23
|
|
|
24
24
|
steps:
|
|
25
25
|
- name: Harden Runner
|
|
26
|
-
uses: step-security/harden-runner@
|
|
26
|
+
uses: step-security/harden-runner@20cf305ff2072d973412fa9b1e3a4f227bda3c76 # v2.14.0
|
|
27
27
|
with:
|
|
28
28
|
egress-policy: audit
|
|
29
29
|
|
|
30
|
-
- uses: actions/checkout@
|
|
30
|
+
- uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
|
|
31
31
|
|
|
32
32
|
- name: Set up Ruby
|
|
33
|
-
uses: ruby/setup-ruby@
|
|
33
|
+
uses: ruby/setup-ruby@d5126b9b3579e429dd52e51e68624dda2e05be25 # v1.267.0
|
|
34
34
|
with:
|
|
35
35
|
bundler-cache: true
|
|
36
36
|
ruby-version: ruby
|
|
37
37
|
|
|
38
38
|
- name: Publish to RubyGems
|
|
39
|
-
uses: rubygems/release-gem@
|
|
39
|
+
uses: rubygems/release-gem@1c162a739e8b4cb21a676e97b087e8268d8fc40b # v1.1.2
|
|
40
40
|
|
|
41
41
|
- name: Create GitHub release
|
|
42
42
|
run: |
|
|
43
43
|
tag_name="$(git describe --tags --abbrev=0)"
|
|
44
44
|
gh release create "${tag_name}" --verify-tag --generate-notes
|
|
45
45
|
env:
|
|
46
|
-
GITHUB_TOKEN: ${{ secrets.
|
|
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
|
@@ -17,11 +17,11 @@ jobs:
|
|
|
17
17
|
os: [ ubuntu-latest, macos-latest ]
|
|
18
18
|
runs-on: ${{ matrix.os }}
|
|
19
19
|
steps:
|
|
20
|
-
- uses: actions/checkout@
|
|
20
|
+
- uses: actions/checkout@v6
|
|
21
21
|
- name: Set up Ruby
|
|
22
22
|
uses: ruby/setup-ruby@v1
|
|
23
23
|
with:
|
|
24
24
|
ruby-version: ${{ matrix.ruby }}
|
|
25
|
-
|
|
25
|
+
bundler-cache: true # 'bundle install' and cache gems
|
|
26
26
|
- name: Run test
|
|
27
27
|
run: bundle exec rake test
|
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__
|
|
@@ -198,7 +199,7 @@ class Delegator < BasicObject
|
|
|
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,8 +16,11 @@ executables: []
|
|
|
17
16
|
extensions: []
|
|
18
17
|
extra_rdoc_files: []
|
|
19
18
|
files:
|
|
19
|
+
- ".document"
|
|
20
20
|
- ".github/dependabot.yml"
|
|
21
|
+
- ".github/release.yml"
|
|
21
22
|
- ".github/workflows/push_gem.yml"
|
|
23
|
+
- ".github/workflows/sync-ruby.yml"
|
|
22
24
|
- ".github/workflows/test.yml"
|
|
23
25
|
- ".gitignore"
|
|
24
26
|
- BSDL
|
|
@@ -37,7 +39,6 @@ licenses:
|
|
|
37
39
|
metadata:
|
|
38
40
|
homepage_uri: https://github.com/ruby/delegate
|
|
39
41
|
source_code_uri: https://github.com/ruby/delegate
|
|
40
|
-
post_install_message:
|
|
41
42
|
rdoc_options: []
|
|
42
43
|
require_paths:
|
|
43
44
|
- lib
|
|
@@ -52,8 +53,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
52
53
|
- !ruby/object:Gem::Version
|
|
53
54
|
version: '0'
|
|
54
55
|
requirements: []
|
|
55
|
-
rubygems_version: 3.
|
|
56
|
-
signing_key:
|
|
56
|
+
rubygems_version: 3.6.9
|
|
57
57
|
specification_version: 4
|
|
58
58
|
summary: Provides three abilities to delegate method calls to an object.
|
|
59
59
|
test_files: []
|