ruby-changes:60077
From: Yusuke <ko1@a...>
Date: Sat, 15 Feb 2020 16:27:56 +0900 (JST)
Subject: [ruby-changes:60077] fb472ca7ad (master): lib/drb/drb.rb: Use ruby2_keywords for keyword separation
https://git.ruby-lang.org/ruby.git/commit/?id=fb472ca7ad From fb472ca7adbaceb35aae1b3a6b948720ffc9eb53 Mon Sep 17 00:00:00 2001 From: Yusuke Endoh <mame@r...> Date: Sat, 15 Feb 2020 16:27:03 +0900 Subject: lib/drb/drb.rb: Use ruby2_keywords for keyword separation [Bug #16634] diff --git a/lib/drb/drb.rb b/lib/drb/drb.rb index e2aaf70..4d3ea36 100644 --- a/lib/drb/drb.rb +++ b/lib/drb/drb.rb @@ -1131,7 +1131,7 @@ module DRb https://github.com/ruby/ruby/blob/trunk/lib/drb/drb.rb#L1131 end # Routes method calls to the referenced remote object. - def method_missing(msg_id, *a, &b) + ruby2_keywords def method_missing(msg_id, *a, &b) if DRb.here?(@uri) obj = DRb.to_obj(@ref) DRb.current_server.check_insecure_method(obj, msg_id) diff --git a/test/drb/test_drb.rb b/test/drb/test_drb.rb index b792349..47b2966 100644 --- a/test/drb/test_drb.rb +++ b/test/drb/test_drb.rb @@ -349,4 +349,20 @@ class TestDRbTCP < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/drb/test_drb.rb#L349 end end +class TestBug16634 < Test::Unit::TestCase + include DRbBase + + def setup + super + setup_service 'ut_drb.rb' + end + + def test_bug16634 + assert_equal(42, @there.keyword_test1(a: 42)) + assert_equal("default", @there.keyword_test2) + assert_equal(42, @there.keyword_test2(b: 42)) + assert_equal({:a=>42, :b=>42}, @there.keyword_test3(a: 42, b: 42)) + end +end + end diff --git a/test/drb/ut_drb.rb b/test/drb/ut_drb.rb index f05d3f8..7c0603b 100644 --- a/test/drb/ut_drb.rb +++ b/test/drb/ut_drb.rb @@ -148,6 +148,18 @@ class DRbEx https://github.com/ruby/ruby/blob/trunk/test/drb/ut_drb.rb#L148 end end + def keyword_test1(a:) + a + end + + def keyword_test2(b: "default") + b + end + + def keyword_test3(**opt) + opt + end + private def call_private_method true -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/