提交 7fd477c0 编写于 作者: R Rafael França 提交者: GitHub

Merge pull request #25352 from Shopify/optimized-delegate

Replace Kernel#caller by the faster Kernel#caller_locations
......@@ -164,8 +164,8 @@ def delegate(*methods, to: nil, prefix: nil, allow_nil: nil)
''
end
file, line = caller(1, 1).first.split(':'.freeze, 2)
line = line.to_i
location = caller_locations(1, 1).first
file, line = location.path, location.lineno
to = to.to_s
to = "self.#{to}" if DELEGATION_RESERVED_METHOD_NAMES.include?(to)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册