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 #to_ary to Diff::LCS::Change and Diff::LCS::ContextChange #47

Merged
merged 2 commits into from Jan 26, 2019

Conversation

Projects
None yet
2 participants
@knu
Copy link
Contributor

knu commented Jan 24, 2019

It would be quite handy if you could write as follows:

Diff::LCS.sdiff(a, b).each do |action, (old_position, old_element), (new_position, new_element)|
  case action
  when '!'
    # replace
  when '-'
    # delete
  when '+'
    # insert
  end
end
Add #to_ary to Diff::LCS::Change and Diff::LCS::ContextChange
It would be quite handy if you could write as follows:

```ruby
Diff::LCS.sdiff(a, b).each do |action, (old_position, old_element), (new_position, new_element)|
  case action
  when '!'
    # replace
  when '-'
    # delete
  when '+'
    # insert
  end
end
```
@halostatue

This comment has been minimized.

Copy link
Owner

halostatue commented Jan 24, 2019

Simple but effective. Can I ask that you add a little documentation for this particular use-case? I can see my way to making a release on the weekend.

@knu

This comment has been minimized.

Copy link
Contributor Author

knu commented Jan 26, 2019

@halostatue I added a paragraph to the rdoc of Diff::LCS.sdiff. Feel free to correct it as necessary!

@halostatue halostatue merged commit 3b4d2be into halostatue:master Jan 26, 2019

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
@halostatue

This comment has been minimized.

Copy link
Owner

halostatue commented Jan 26, 2019

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.