ruby-changes:49043
From: a_matsuda <ko1@a...>
Date: Tue, 12 Dec 2017 21:12:43 +0900 (JST)
Subject: [ruby-changes:49043] a_matsuda:r61158 (trunk): Add Method#=== that invokes #call
a_matsuda 2017-12-12 21:12:38 +0900 (Tue, 12 Dec 2017) New Revision: 61158 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=61158 Log: Add Method#=== that invokes #call Patch by osyo via [Feature #14142] Modified files: trunk/proc.c trunk/test/ruby/test_method.rb Index: test/ruby/test_method.rb =================================================================== --- test/ruby/test_method.rb (revision 61157) +++ test/ruby/test_method.rb (revision 61158) @@ -1017,4 +1017,10 @@ class TestMethod < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_method.rb#L1017 # without trace insn assert_separately [], "RubyVM::InstructionSequence.compile_option = {trace_instruction: false}\n" + body end + + def test_eqq + assert(Method.instance_methods(false).include? :===) + assert_operator(0.method(:<), :===, 5) + assert_not_operator(0.method(:<), :===, -5) + end end Index: proc.c =================================================================== --- proc.c (revision 61157) +++ proc.c (revision 61158) @@ -3124,6 +3124,7 @@ Init_Proc(void) https://github.com/ruby/ruby/blob/trunk/proc.c#L3124 rb_define_method(rb_cMethod, "hash", method_hash, 0); rb_define_method(rb_cMethod, "clone", method_clone, 0); rb_define_method(rb_cMethod, "call", rb_method_call, -1); + rb_define_method(rb_cMethod, "===", rb_method_call, -1); rb_define_method(rb_cMethod, "curry", rb_method_curry, -1); rb_define_method(rb_cMethod, "[]", rb_method_call, -1); rb_define_method(rb_cMethod, "arity", method_arity_m, 0); -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/