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

Add support for endless method definitions #405

Merged
merged 2 commits into from
Jan 3, 2023
Merged

Conversation

reese
Copy link
Collaborator

@reese reese commented Jan 3, 2023

Related to #399

On the tin -- endless method definitions are ~the same as regular definitions in Ripper, the only difference being that instead of an array of expressions (and the optional rescue/ensure/etc.), it returns only a single expression.

In terms of style, this PR does nothing special -- endless method definitions just render expressions the same as e.g. an assignment. Note that they don't increase the indentation level here, same as variable assignments (although that's not a strong opinion, happy to change that if we want), so multiline expressions do end up left-aligned. (My only reasoning for this is that it looks a little strange to indent it without anend somewhere 🤷)

@reese reese merged commit a5c6eeb into trunk Jan 3, 2023
@reese reese deleted the reese-endless-methods branch January 3, 2023 16:43
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