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

@knu
Copy link
Contributor

@knu 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
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
Copy link
Owner

@halostatue 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
Copy link
Contributor Author

@knu 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
1 check passed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@halostatue
Copy link
Owner

@halostatue halostatue commented Jan 26, 2019

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants