diff options
author | Austin Ziegler <austin@zieglers.ca> | 2021-12-23 10:43:29 -0500 |
---|---|---|
committer | Austin Ziegler <austin@zieglers.ca> | 2022-07-04 20:26:09 -0400 |
commit | 106d1749c965b8af857c976197814707b66cbef0 (patch) | |
tree | a888b76791ab6ffc32c147b97fbaa0c8661f5f74 /lib/diff | |
parent | 3062997fbbe19cb6099a65a5dbcd0aba7b9b17c7 (diff) | |
download | diff-lcs-106d1749c965b8af857c976197814707b66cbef0.tar.gz |
Fix issues reported by fasterer
Diffstat (limited to 'lib/diff')
-rw-r--r-- | lib/diff/lcs.rb | 2 | ||||
-rw-r--r-- | lib/diff/lcs/hunk.rb | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/lib/diff/lcs.rb b/lib/diff/lcs.rb index 288cfc2..234fd03 100644 --- a/lib/diff/lcs.rb +++ b/lib/diff/lcs.rb @@ -145,7 +145,7 @@ class << Diff::LCS matches = Diff::LCS::Internals.lcs(seq1, seq2) ret = [] string = seq1.kind_of? String - matches.each_with_index do |_e, i| + matches.each_index do |i| next if matches[i].nil? v = string ? seq1[i, 1] : seq1[i] diff --git a/lib/diff/lcs/hunk.rb b/lib/diff/lcs/hunk.rb index 49b520e..d27b024 100644 --- a/lib/diff/lcs/hunk.rb +++ b/lib/diff/lcs/hunk.rb @@ -22,7 +22,7 @@ class Diff::LCS::Hunk end if String.method_defined?(:encoding) - @preferred_data_encoding = data_old.fetch(0, data_new.fetch(0, '')).encoding + @preferred_data_encoding = data_old.fetch(0) { data_new.fetch(0) { '' } }.encoding end @data_old = data_old |