From f85ec381137c6838600b16c353ff9dba3a05452c Mon Sep 17 00:00:00 2001 From: Austin Ziegler Date: Thu, 23 Dec 2021 10:44:44 -0500 Subject: standardrb --only Style/StringLiterals --fix --- lib/diff/lcs/change.rb | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) (limited to 'lib/diff/lcs/change.rb') diff --git a/lib/diff/lcs/change.rb b/lib/diff/lcs/change.rb index 76faf83..aa55360 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.kind_of? IntClass end def inspect(*_args) @@ -49,7 +49,7 @@ class Diff::LCS::Change when 3 Diff::LCS::Change.new(*(arr[0...3])) else - fail 'Invalid change array format provided.' + fail "Invalid change array format provided." end end @@ -70,27 +70,27 @@ class Diff::LCS::Change end def adding? - @action == '+' + @action == "+" end def deleting? - @action == '-' + @action == "-" end def unchanged? - @action == '=' + @action == "=" end def changed? - @action == '!' + @action == "!" end def finished_a? - @action == '>' + @action == ">" end def finished_b? - @action == '<' + @action == "<" end end @@ -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? or @old_position.kind_of? IntClass - fail 'Invalid (New) Position Type' unless @new_position.nil? or @new_position.kind_of? IntClass + fail "Invalid (Old) Position Type" unless @old_position.nil? or @old_position.kind_of? IntClass + fail "Invalid (New) Position Type" unless @new_position.nil? or @new_position.kind_of? IntClass end def to_a @@ -139,15 +139,15 @@ class Diff::LCS::ContextChange < Diff::LCS::Change ea = event.to_a case ea[0] - when '-' + when "-" ea[2][1] = nil - when '<' - ea[0] = '-' + when "<" + ea[0] = "-" ea[2][1] = nil - when '+' + when "+" ea[1][1] = nil - when '>' - ea[0] = '+' + when ">" + ea[0] = "+" ea[1][1] = nil end -- cgit v1.2.1 From cb9bebb30477e815cdbe8f8460f227f0940599a1 Mon Sep 17 00:00:00 2001 From: Austin Ziegler Date: Thu, 23 Dec 2021 10:45:50 -0500 Subject: standardrb --only Style/PercentLiteralDelimiters --fix --- lib/diff/lcs/change.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/diff/lcs/change.rb') diff --git a/lib/diff/lcs/change.rb b/lib/diff/lcs/change.rb index aa55360..a82f3e6 100644 --- a/lib/diff/lcs/change.rb +++ b/lib/diff/lcs/change.rb @@ -10,7 +10,7 @@ class Diff::LCS::Change # (no change), '!' (changed), '<' (tail changes from first sequence), or # '>' (tail changes from second sequence). The last two ('<>') are only # found with Diff::LCS::diff and Diff::LCS::sdiff. - VALID_ACTIONS = %w(+ - = ! > <).freeze + VALID_ACTIONS = %w[+ - = ! > <].freeze def self.valid_action?(action) VALID_ACTIONS.include? action -- cgit v1.2.1 From 22303f04b44d97455b5c862176d2d93c02a2b2ba Mon Sep 17 00:00:00 2001 From: Austin Ziegler Date: Thu, 23 Dec 2021 10:58:14 -0500 Subject: Fix Style/AndOr --- lib/diff/lcs/change.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/diff/lcs/change.rb') diff --git a/lib/diff/lcs/change.rb b/lib/diff/lcs/change.rb index a82f3e6..f20d804 100644 --- a/lib/diff/lcs/change.rb +++ b/lib/diff/lcs/change.rb @@ -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? or @old_position.kind_of? IntClass - fail "Invalid (New) Position Type" unless @new_position.nil? or @new_position.kind_of? IntClass + 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) end def to_a -- cgit v1.2.1 From 99af1369a86b38585f6c63e9d50ac7040932916a Mon Sep 17 00:00:00 2001 From: Austin Ziegler Date: Thu, 23 Dec 2021 11:14:10 -0500 Subject: standardrb --only Style/ClassCheck --fix --- lib/diff/lcs/change.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'lib/diff/lcs/change.rb') 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 -- cgit v1.2.1 From b160187f3d94f84b38faadb0726f7b0ae773d7eb Mon Sep 17 00:00:00 2001 From: Austin Ziegler Date: Thu, 23 Dec 2021 11:25:43 -0500 Subject: standardrb --only Style/Alias --fix --- lib/diff/lcs/change.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/diff/lcs/change.rb') diff --git a/lib/diff/lcs/change.rb b/lib/diff/lcs/change.rb index cebd3af..c86f102 100644 --- a/lib/diff/lcs/change.rb +++ b/lib/diff/lcs/change.rb @@ -39,7 +39,7 @@ class Diff::LCS::Change [@action, @position, @element] end - alias to_ary to_a + alias_method :to_ary, :to_a def self.from_a(arr) arr = arr.flatten(1) @@ -127,7 +127,7 @@ class Diff::LCS::ContextChange < Diff::LCS::Change ] end - alias to_ary to_a + alias_method :to_ary, :to_a def self.from_a(arr) Diff::LCS::Change.from_a(arr) -- cgit v1.2.1