mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Pass UnboundMethod to 2nd arg of define_method
This commit is contained in:
parent
fdfb43b2b1
commit
5164c2b36f
Notes:
git
2021-12-13 10:24:23 +09:00
1 changed files with 2 additions and 2 deletions
|
@ -503,7 +503,7 @@ module TestStruct
|
||||||
assert_equal 1, klass.instance_method(:a=).arity
|
assert_equal 1, klass.instance_method(:a=).arity
|
||||||
|
|
||||||
klass.module_eval do
|
klass.module_eval do
|
||||||
define_method(:b=, &klass.new.method(:a=).to_proc)
|
define_method(:b=, instance_method(:a=))
|
||||||
alias c= a=
|
alias c= a=
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -518,7 +518,7 @@ module TestStruct
|
||||||
assert_equal [[:req, :_]], klass.instance_method(:a=).parameters
|
assert_equal [[:req, :_]], klass.instance_method(:a=).parameters
|
||||||
|
|
||||||
klass.module_eval do
|
klass.module_eval do
|
||||||
define_method(:b=, &klass.new.method(:a=).to_proc)
|
define_method(:b=, instance_method(:a=))
|
||||||
alias c= a=
|
alias c= a=
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue