Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor eval_path and SourceFinder::Source #870

Merged
merged 2 commits into from
Feb 13, 2024
Merged

Refactor eval_path and SourceFinder::Source #870

merged 2 commits into from
Feb 13, 2024

Conversation

st0012
Copy link
Member

@st0012 st0012 commented Feb 12, 2024

While the eval_path method works great, I think it's not straightforward to understand and perhaps not easy to debug. So I want to try another approach: move the file path check to @irb_path's assignment.

Another refactor is that I think SourceFinder::Source.find_end can simply be a private instance method of Source.

This simplifies the original caching logic for the `eval_path` method
and makes it easier to understand.
@tompng tompng merged commit c63e4c4 into master Feb 13, 2024
57 checks passed
@tompng tompng deleted the followup-#862 branch February 13, 2024 13:33
matzbot pushed a commit to ruby/ruby that referenced this pull request Feb 13, 2024
(ruby/irb#870)

* Assign `@eval_path` through `irb_path=` method

This simplifies the original caching logic for the `eval_path` method
and makes it easier to understand.

* Refactor SourceFinder::Source

ruby/irb@c63e4c4035
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants