Merge pull request #25352 from Shopify/optimized-delegate
Replace Kernel#caller by the faster Kernel#caller_locations
This commit is contained in:
commit
7fd477c0f5
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user