Skip to content

Decouple edit and show_source commands #658

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

Merged
merged 3 commits into from
Jul 31, 2023
Merged

Conversation

st0012
Copy link
Member

@st0012 st0012 commented Jul 27, 2023

Ideally all commands should be independent from each other. But currently edit is implemented based on the show_source command for its source-finding mechanism.

I think the better approach is to extract the source-finding part to a standalone utility class and use it in both commands instead.

st0012 added 3 commits July 27, 2023 12:16
2 commands should not depend on each other. If `edit` command also needs
to find a source, the source finding logic should be extracted into a
separate class.
@st0012 st0012 self-assigned this Jul 27, 2023
@st0012 st0012 requested a review from a team July 29, 2023 21:18
Copy link
Member

@tompng tompng left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍
The changed part in find_source find_end (local var name, when to check File.exist?) also looks good 👍

@tompng tompng merged commit 9790517 into master Jul 31, 2023
@tompng tompng deleted the refactor-source-finding branch July 31, 2023 19:57
matzbot pushed a commit to ruby/ruby that referenced this pull request Jul 31, 2023
(ruby/irb#658)

* Decouple `edit` command from `show_source`

2 commands should not depend on each other. If `edit` command also needs
to find a source, the source finding logic should be extracted into a
separate class.

* Return nil if is not an actual file path

* Refactor SourceFinder

ruby/irb@9790517a0c
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