Skip to content

Conversation

@schneems
Copy link
Collaborator

Ruby lines that end with a slash \ indicate that the next line should be concatenated with the current line so:

  if "trailing" \
     "line" do
  end

Is functionally equivalent to:

  if "trailing" "line" do
  endf

We can replicate this logic by taking note when a line ends with a trailing slash and then concatenating it with the next line.

Functionally the TrailingSlashJoin class does this by concatenating the lines, and then hiding the original line.

To allow for output, the DisplayCodeWithLineNumbers is now aware that a code line may contain multiple code lines, and it will split and render each.

Ruby lines that end with a slash `\` indicate that the next line should be concatenated with the current line so:

```ruby
  if "trailing" \
     "line" do
  end
```

Is functionally equivalent to:

```ruby
  if "trailing" "line" do
  endf
```

We can replicate this logic by taking note when a line ends with a trailing slash and then concatenating it with the next line.

Functionally the TrailingSlashJoin class does this by concatenating the lines, and then hiding the original line.

To allow for output, the DisplayCodeWithLineNumbers is now aware that a code line may contain multiple code lines, and it will split and render each.
@schneems schneems force-pushed the schneems/trailing-do branch from 8f6083f to 4853d63 Compare December 10, 2020 18:07
@schneems schneems merged commit e4cc8c0 into main Dec 10, 2020
@schneems schneems deleted the schneems/trailing-do branch December 10, 2020 18:14
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