Skip to content

Conversation

@jeremyevans
Copy link
Collaborator

On Ruby 3.5, method.source_location returns an array with 5 entries instead of 2. Additional entries are start column, end line, and end column.

Don't assume start_line is the last entry in the array, always use offset 1.

If the end line is available, use it instead of splitting the method source and trying to determine the number of lines in it.

@jeremyevans
Copy link
Collaborator Author

@searls This is still an issue with Ruby 4.0.0 preview2. Modulo 3.5/4.0 naming issues in the comments (which I can update), do you think it can be merged?

@searls
Copy link
Collaborator

searls commented Nov 24, 2025

slaps car roof you can fit so many maintainers in this gem.

Since writing TLDR, I'm leaning on this lib less and less often. Want commit bit & gem push?

@jeremyevans
Copy link
Collaborator Author

Sure, I'd be happy to help out with maintenance.

@searls
Copy link
Collaborator

searls commented Dec 1, 2025

My bad, I just learned that I can't actually add you to the repo--@qrush would need to. Sorry!

@qrush could you do it? Maybe worth just making a free org for the gem so you don't have to click things again?

@qrush
Copy link
Owner

qrush commented Dec 2, 2025

Definitely not worth an org. Just added you @jeremyevans !

@jeremyevans
Copy link
Collaborator Author

Accepted. Thank you!

On Ruby 4.0, method.source_location returns an array with 5 entries
instead of 2.  Additional entries are start column, end line, and
end column.

Don't assume start_line is the last entry in the array, always use
offset 1.

If the end line is available, use it instead of splitting the method
source and trying to determine the number of lines in it.

Do not require method_source on Ruby 4.0+, since it will not be used.
@jeremyevans jeremyevans merged commit eb714e0 into qrush:master Dec 3, 2025
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants