Skip to content

Refactor eval_path and SourceFinder::Source - #870

Merged
tompng merged 2 commits into
masterfrom
followup-#862
Feb 13, 2024
Merged

tompng merged 2 commits into
masterfrom
followup-#862

Conversation

@st0012

@st0012 st0012 commented Feb 12, 2024

Copy link
Copy Markdown
Member

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants