[ruby-core:126302] [Ruby Feature#8751] Add offsets to method#source_location
Issue #8751 has been updated by Eregon (Benoit Daloze). This is now available since #21998 with `{Method,UnboundMethod,Proc}#source_range`. It's start/end line + start/end byte-column and not byte offsets, but one can convert between both if the source file is available. ---------------------------------------- Feature #8751: Add offsets to method#source_location https://bugs.ruby-lang.org/issues/8751#change-118403 * Author: tenderlovemaking (Aaron Patterson) * Status: Closed ---------------------------------------- Hello, I would like to have byte offsets returned on the source_location for methods. For example: def foo(&b) b.source_location # => [file_name, line_number, start_byte, end_byte] end If we had the start and end byte for a method or proc, then we could find the source for methods and procs in each file. There are some cases (like with heredocuments) where the "end of the method" could be after the `end` keyword. But I think if we just have offsets for the start of `def` and the end of `end`, I think it would cover 99% of usecases. -- https://bugs.ruby-lang.org/
participants (1)
-
Eregon (Benoit Daloze)