summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAustin Ziegler <austin@zieglers.ca>2021-12-23 11:14:10 -0500
committerAustin Ziegler <austin@zieglers.ca>2022-07-04 20:26:10 -0400
commit99af1369a86b38585f6c63e9d50ac7040932916a (patch)
tree370f1bbc09632cd3a24c504815fa572e038b3e76
parent927b9b3c935f08a1611059e81b411c2ee2ff9724 (diff)
downloaddiff-lcs-99af1369a86b38585f6c63e9d50ac7040932916a.tar.gz
standardrb --only Style/ClassCheck --fix
-rw-r--r--lib/diff/lcs.rb8
-rw-r--r--lib/diff/lcs/change.rb6
-rw-r--r--lib/diff/lcs/internals.rb8
-rw-r--r--spec/spec_helper.rb2
4 files changed, 12 insertions, 12 deletions
diff --git a/lib/diff/lcs.rb b/lib/diff/lcs.rb
index 4461af0..2214240 100644
--- a/lib/diff/lcs.rb
+++ b/lib/diff/lcs.rb
@@ -144,7 +144,7 @@ class << Diff::LCS
def lcs(seq1, seq2, &block) # :yields: seq1[i] for each matched
matches = Diff::LCS::Internals.lcs(seq1, seq2)
ret = []
- string = seq1.kind_of? String
+ string = seq1.is_a? String
matches.each_index do |i|
next if matches[i].nil?
@@ -287,7 +287,7 @@ class << Diff::LCS
matches = Diff::LCS::Internals.lcs(seq1, seq2)
run_finished_a = run_finished_b = false
- string = seq1.kind_of?(String)
+ string = seq1.is_a?(String)
a_size = seq1.size
b_size = seq2.size
@@ -478,7 +478,7 @@ class << Diff::LCS
b_size = seq2.size
ai = bj = mb = 0
ma = -1
- string = seq1.kind_of?(String)
+ string = seq1.is_a?(String)
# Process all the lines in the match vector.
loop do
@@ -629,7 +629,7 @@ class << Diff::LCS
return src.respond_to?(:dup) ? src.dup : src unless has_changes
- string = src.kind_of?(String)
+ string = src.is_a?(String)
# Start with a new empty type of the source's class
res = src.class.new
diff --git a/lib/diff/lcs/change.rb b/lib/diff/lcs/change.rb
index f20d804..cebd3af 100644
--- a/lib/diff/lcs/change.rb
+++ b/lib/diff/lcs/change.rb
@@ -28,7 +28,7 @@ class Diff::LCS::Change
@action, @position, @element = *args
fail "Invalid Change Action '#{@action}'" unless Diff::LCS::Change.valid_action?(@action)
- fail "Invalid Position Type" unless @position.kind_of? IntClass
+ fail "Invalid Position Type" unless @position.is_a? IntClass
end
def inspect(*_args)
@@ -115,8 +115,8 @@ class Diff::LCS::ContextChange < Diff::LCS::Change
@action, @old_position, @old_element, @new_position, @new_element = *args
fail "Invalid Change Action '#{@action}'" unless Diff::LCS::Change.valid_action?(@action)
- fail "Invalid (Old) Position Type" unless @old_position.nil? || @old_position.kind_of?(IntClass)
- fail "Invalid (New) Position Type" unless @new_position.nil? || @new_position.kind_of?(IntClass)
+ fail "Invalid (Old) Position Type" unless @old_position.nil? || @old_position.is_a?(IntClass)
+ fail "Invalid (New) Position Type" unless @new_position.nil? || @new_position.is_a?(IntClass)
end
def to_a
diff --git a/lib/diff/lcs/internals.rb b/lib/diff/lcs/internals.rb
index b968917..8a9160a 100644
--- a/lib/diff/lcs/internals.rb
+++ b/lib/diff/lcs/internals.rb
@@ -13,7 +13,7 @@ class << Diff::LCS
if block
callbacks.diffs.map do |hunk|
- if hunk.kind_of? Array
+ if hunk.is_a? Array
hunk.map { |hunk_block| block[hunk_block] }
else
block[hunk]
@@ -64,7 +64,7 @@ class << Diff::LCS::Internals
thresh = []
links = []
- string = a.kind_of?(String)
+ string = a.is_a?(String)
(a_start..a_finish).each do |i|
ai = string ? a[i, 1] : a[i]
@@ -145,7 +145,7 @@ class << Diff::LCS::Internals
# Diff::LCS::Change as its source, as an array will cause the creation
# of one of the above.
def intuit_diff_direction(src, patchset, limit = nil)
- string = src.kind_of?(String)
+ string = src.is_a?(String)
count = left_match = left_miss = right_match = right_miss = 0
patchset.each do |change|
@@ -296,7 +296,7 @@ enumerable as either source or destination value."
# positions it occupies in the Enumerable, optionally restricted to the
# elements specified in the range of indexes specified by +interval+.
def position_hash(enum, interval)
- string = enum.kind_of?(String)
+ string = enum.is_a?(String)
hash = Hash.new { |h, k| h[k] = [] }
interval.each do |i|
k = string ? enum[i, 1] : enum[i]
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index acca2ef..9e3fea0 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -201,7 +201,7 @@ module Diff::LCS::SpecHelper
def format_diffs(diffs)
diffs.map { |e|
- if e.kind_of?(Array)
+ if e.is_a?(Array)
e.map { |f| f.to_a.join }.join(", ")
else
e.to_a.join