提交 bb5d4890 编写于 作者: R Ryuta Kamizono

Fix `delegate_missing_to` to allow keyword arguments

上级 ccd76d4b
......@@ -314,6 +314,7 @@ def method_missing(method, *args, &block)
end
end
end
ruby2_keywords(:method_missing) if respond_to?(:ruby2_keywords, true)
RUBY
end
end
......@@ -24,6 +24,10 @@ def self.table_name
self::FAILED_DELEGATE_LINE_2 = __LINE__ + 1
delegate :bar, to: :place, allow_nil: true
def kw_send(method:)
public_send(method)
end
private
def private_name
"Private"
......@@ -375,6 +379,10 @@ def test_delegate_missing_to_with_reserved_methods
assert_equal "David", DecoratedReserved.new(@david).name
end
def test_delegate_missing_to_with_keyword_methods
assert_equal "David", DecoratedReserved.new(@david).kw_send(method: "name")
end
def test_delegate_missing_to_does_not_delegate_to_private_methods
e = assert_raises(NoMethodError) do
DecoratedReserved.new(@david).private_name
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册