Replace Kernel#caller by the faster Kernel#caller_locations

This commit is contained in:
Jean Boussier 2016-06-10 11:34:18 -04:00
parent 527200a456
commit e8148a5cf4

@ -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)