summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAustin Ziegler <austin@zieglers.ca>2021-12-23 10:44:44 -0500
committerAustin Ziegler <austin@zieglers.ca>2022-07-04 20:26:10 -0400
commitf85ec381137c6838600b16c353ff9dba3a05452c (patch)
tree7a2718961e97c56d4c70dc0a6ebe6b17aee005fc /lib
parentef23b66e9a495206f2bf1cd9ce0df50d363d26ef (diff)
downloaddiff-lcs-f85ec381137c6838600b16c353ff9dba3a05452c.tar.gz
standardrb --only Style/StringLiterals --fix
Diffstat (limited to 'lib')
-rw-r--r--lib/diff-lcs.rb2
-rw-r--r--lib/diff/lcs.rb64
-rw-r--r--lib/diff/lcs/array.rb2
-rw-r--r--lib/diff/lcs/block.rb8
-rw-r--r--lib/diff/lcs/callbacks.rb6
-rw-r--r--lib/diff/lcs/change.rb32
-rw-r--r--lib/diff/lcs/htmldiff.rb12
-rw-r--r--lib/diff/lcs/hunk.rb20
-rw-r--r--lib/diff/lcs/internals.rb16
-rw-r--r--lib/diff/lcs/ldiff.rb46
10 files changed, 104 insertions, 104 deletions
diff --git a/lib/diff-lcs.rb b/lib/diff-lcs.rb
index 250392f..bc07bf9 100644
--- a/lib/diff-lcs.rb
+++ b/lib/diff-lcs.rb
@@ -1,3 +1,3 @@
# frozen_string_literal: true
-require 'diff/lcs'
+require "diff/lcs"
diff --git a/lib/diff/lcs.rb b/lib/diff/lcs.rb
index 234fd03..e6d817b 100644
--- a/lib/diff/lcs.rb
+++ b/lib/diff/lcs.rb
@@ -49,11 +49,11 @@ module Diff; end unless defined? Diff # rubocop:disable Style/Documentation
# a x b y c z p d q
# a b c a x b y c z
module Diff::LCS
- VERSION = '1.5.0'
+ VERSION = "1.5.0"
end
-require 'diff/lcs/callbacks'
-require 'diff/lcs/internals'
+require "diff/lcs/callbacks"
+require "diff/lcs/internals"
module Diff::LCS # rubocop:disable Style/Documentation
# Returns an Array containing the longest common subsequence(s) between
@@ -299,7 +299,7 @@ class << Diff::LCS
ax = string ? seq1[ai, 1] : seq1[ai]
bx = string ? seq2[bj, 1] : seq2[bj]
- event = Diff::LCS::ContextChange.new('-', ai, ax, bj, bx)
+ event = Diff::LCS::ContextChange.new("-", ai, ax, bj, bx)
event = yield event if block_given?
callbacks.discard_a(event)
end
@@ -310,13 +310,13 @@ class << Diff::LCS
break unless bj < b_line
bx = string ? seq2[bj, 1] : seq2[bj]
- event = Diff::LCS::ContextChange.new('+', ai, ax, bj, bx)
+ event = Diff::LCS::ContextChange.new("+", ai, ax, bj, bx)
event = yield event if block_given?
callbacks.discard_b(event)
bj += 1
end
bx = string ? seq2[bj, 1] : seq2[bj]
- event = Diff::LCS::ContextChange.new('=', ai, ax, bj, bx)
+ event = Diff::LCS::ContextChange.new("=", ai, ax, bj, bx)
event = yield event if block_given?
callbacks.match(event)
bj += 1
@@ -332,7 +332,7 @@ class << Diff::LCS
if callbacks.respond_to?(:finished_a) and !run_finished_a
ax = string ? seq1[-1, 1] : seq1[-1]
bx = string ? seq2[bj, 1] : seq2[bj]
- event = Diff::LCS::ContextChange.new('>', (a_size - 1), ax, bj, bx)
+ event = Diff::LCS::ContextChange.new(">", (a_size - 1), ax, bj, bx)
event = yield event if block_given?
callbacks.finished_a(event)
run_finished_a = true
@@ -340,7 +340,7 @@ class << Diff::LCS
ax = string ? seq1[ai, 1] : seq1[ai]
loop do
bx = string ? seq2[bj, 1] : seq2[bj]
- event = Diff::LCS::ContextChange.new('+', ai, ax, bj, bx)
+ event = Diff::LCS::ContextChange.new("+", ai, ax, bj, bx)
event = yield event if block_given?
callbacks.discard_b(event)
bj += 1
@@ -354,7 +354,7 @@ class << Diff::LCS
if callbacks.respond_to?(:finished_b) and !run_finished_b
ax = string ? seq1[ai, 1] : seq1[ai]
bx = string ? seq2[-1, 1] : seq2[-1]
- event = Diff::LCS::ContextChange.new('<', ai, ax, (b_size - 1), bx)
+ event = Diff::LCS::ContextChange.new("<", ai, ax, (b_size - 1), bx)
event = yield event if block_given?
callbacks.finished_b(event)
run_finished_b = true
@@ -362,7 +362,7 @@ class << Diff::LCS
bx = string ? seq2[bj, 1] : seq2[bj]
loop do
ax = string ? seq1[ai, 1] : seq1[ai]
- event = Diff::LCS::ContextChange.new('-', ai, ax, bj, bx)
+ event = Diff::LCS::ContextChange.new("-", ai, ax, bj, bx)
event = yield event if block_given?
callbacks.discard_a(event)
ai += 1
@@ -374,7 +374,7 @@ class << Diff::LCS
if ai < a_size
ax = string ? seq1[ai, 1] : seq1[ai]
bx = string ? seq2[bj, 1] : seq2[bj]
- event = Diff::LCS::ContextChange.new('-', ai, ax, bj, bx)
+ event = Diff::LCS::ContextChange.new("-", ai, ax, bj, bx)
event = yield event if block_given?
callbacks.discard_a(event)
ai += 1
@@ -383,7 +383,7 @@ class << Diff::LCS
if bj < b_size
ax = string ? seq1[ai, 1] : seq1[ai]
bx = string ? seq2[bj, 1] : seq2[bj]
- event = Diff::LCS::ContextChange.new('+', ai, ax, bj, bx)
+ event = Diff::LCS::ContextChange.new("+", ai, ax, bj, bx)
event = yield event if block_given?
callbacks.discard_b(event)
bj += 1
@@ -500,29 +500,29 @@ class << Diff::LCS
case [(ai < ma), (bj < mb)]
when [true, true]
if callbacks.respond_to?(:change)
- event = Diff::LCS::ContextChange.new('!', ai, ax, bj, bx)
+ event = Diff::LCS::ContextChange.new("!", ai, ax, bj, bx)
event = yield event if block_given?
callbacks.change(event)
ai += 1
else
- event = Diff::LCS::ContextChange.new('-', ai, ax, bj, bx)
+ event = Diff::LCS::ContextChange.new("-", ai, ax, bj, bx)
event = yield event if block_given?
callbacks.discard_a(event)
ai += 1
ax = string ? seq1[ai, 1] : seq1[ai]
- event = Diff::LCS::ContextChange.new('+', ai, ax, bj, bx)
+ event = Diff::LCS::ContextChange.new("+", ai, ax, bj, bx)
event = yield event if block_given?
callbacks.discard_b(event)
end
bj += 1
when [true, false]
- event = Diff::LCS::ContextChange.new('-', ai, ax, bj, bx)
+ event = Diff::LCS::ContextChange.new("-", ai, ax, bj, bx)
event = yield event if block_given?
callbacks.discard_a(event)
ai += 1
when [false, true]
- event = Diff::LCS::ContextChange.new('+', ai, ax, bj, bx)
+ event = Diff::LCS::ContextChange.new("+", ai, ax, bj, bx)
event = yield event if block_given?
callbacks.discard_b(event)
bj += 1
@@ -532,7 +532,7 @@ class << Diff::LCS
# Match
ax = string ? seq1[ai, 1] : seq1[ai]
bx = string ? seq2[bj, 1] : seq2[bj]
- event = Diff::LCS::ContextChange.new('=', ai, ax, bj, bx)
+ event = Diff::LCS::ContextChange.new("=", ai, ax, bj, bx)
event = yield event if block_given?
callbacks.match(event)
ai += 1
@@ -546,29 +546,29 @@ class << Diff::LCS
case [(ai < a_size), (bj < b_size)]
when [true, true]
if callbacks.respond_to?(:change)
- event = Diff::LCS::ContextChange.new('!', ai, ax, bj, bx)
+ event = Diff::LCS::ContextChange.new("!", ai, ax, bj, bx)
event = yield event if block_given?
callbacks.change(event)
ai += 1
else
- event = Diff::LCS::ContextChange.new('-', ai, ax, bj, bx)
+ event = Diff::LCS::ContextChange.new("-", ai, ax, bj, bx)
event = yield event if block_given?
callbacks.discard_a(event)
ai += 1
ax = string ? seq1[ai, 1] : seq1[ai]
- event = Diff::LCS::ContextChange.new('+', ai, ax, bj, bx)
+ event = Diff::LCS::ContextChange.new("+", ai, ax, bj, bx)
event = yield event if block_given?
callbacks.discard_b(event)
end
bj += 1
when [true, false]
- event = Diff::LCS::ContextChange.new('-', ai, ax, bj, bx)
+ event = Diff::LCS::ContextChange.new("-", ai, ax, bj, bx)
event = yield event if block_given?
callbacks.discard_a(event)
ai += 1
when [false, true]
- event = Diff::LCS::ContextChange.new('+', ai, ax, bj, bx)
+ event = Diff::LCS::ContextChange.new("+", ai, ax, bj, bx)
event = yield event if block_given?
callbacks.discard_b(event)
bj += 1
@@ -577,8 +577,8 @@ class << Diff::LCS
end
PATCH_MAP = { #:nodoc:
- :patch => { '+' => '+', '-' => '-', '!' => '!', '=' => '=' }.freeze,
- :unpatch => { '+' => '-', '-' => '+', '!' => '!', '=' => '=' }.freeze
+ :patch => { "+" => "+", "-" => "-", "!" => "!", "=" => "=" }.freeze,
+ :unpatch => { "+" => "-", "-" => "+", "!" => "!", "=" => "=" }.freeze
}.freeze
# Applies a +patchset+ to the sequence +src+ according to the +direction+
@@ -655,14 +655,14 @@ class << Diff::LCS
end
case action
- when '-' # Remove details from the old string
+ when "-" # Remove details from the old string
while ai < op
res << (string ? src[ai, 1] : src[ai])
ai += 1
bj += 1
end
ai += 1
- when '+'
+ when "+"
while bj < np
res << (string ? src[ai, 1] : src[ai])
ai += 1
@@ -671,7 +671,7 @@ class << Diff::LCS
res << el
bj += 1
- when '='
+ when "="
# This only appears in sdiff output with the SDiff callback.
# Therefore, we only need to worry about dealing with a single
# element.
@@ -679,7 +679,7 @@ class << Diff::LCS
ai += 1
bj += 1
- when '!'
+ when "!"
while ai < op
res << (string ? src[ai, 1] : src[ai])
ai += 1
@@ -693,14 +693,14 @@ class << Diff::LCS
end
when Diff::LCS::Change
case action
- when '-'
+ when "-"
while ai < change.position
res << (string ? src[ai, 1] : src[ai])
ai += 1
bj += 1
end
ai += 1
- when '+'
+ when "+"
while bj < change.position
res << (string ? src[ai, 1] : src[ai])
ai += 1
@@ -736,4 +736,4 @@ class << Diff::LCS
end
end
-require 'diff/lcs/backports'
+require "diff/lcs/backports"
diff --git a/lib/diff/lcs/array.rb b/lib/diff/lcs/array.rb
index 5c250f6..663918a 100644
--- a/lib/diff/lcs/array.rb
+++ b/lib/diff/lcs/array.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-require 'diff/lcs'
+require "diff/lcs"
class Array
include Diff::LCS
diff --git a/lib/diff/lcs/block.rb b/lib/diff/lcs/block.rb
index 430702d..226ed6f 100644
--- a/lib/diff/lcs/block.rb
+++ b/lib/diff/lcs/block.rb
@@ -25,13 +25,13 @@ class Diff::LCS::Block
def op
case [@remove.empty?, @insert.empty?]
when [false, false]
- '!'
+ "!"
when [false, true]
- '-'
+ "-"
when [true, false]
- '+'
+ "+"
else # [true, true]
- '^'
+ "^"
end
end
end
diff --git a/lib/diff/lcs/callbacks.rb b/lib/diff/lcs/callbacks.rb
index 2a7665b..c075327 100644
--- a/lib/diff/lcs/callbacks.rb
+++ b/lib/diff/lcs/callbacks.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-require 'diff/lcs/change'
+require "diff/lcs/change"
module Diff::LCS # rubocop:disable Style/Documentation
# This callback object implements the default set of callback events,
@@ -131,11 +131,11 @@ class Diff::LCS::DiffCallbacks
end
def discard_a(event)
- @hunk << Diff::LCS::Change.new('-', event.old_position, event.old_element)
+ @hunk << Diff::LCS::Change.new("-", event.old_position, event.old_element)
end
def discard_b(event)
- @hunk << Diff::LCS::Change.new('+', event.new_position, event.new_element)
+ @hunk << Diff::LCS::Change.new("+", event.new_position, event.new_element)
end
def finish_hunk
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
diff --git a/lib/diff/lcs/htmldiff.rb b/lib/diff/lcs/htmldiff.rb
index f12220b..41858d5 100644
--- a/lib/diff/lcs/htmldiff.rb
+++ b/lib/diff/lcs/htmldiff.rb
@@ -1,6 +1,6 @@
# frozen_string_literal: true
-require 'cgi'
+require "cgi"
# Produce a simple HTML diff view.
class Diff::LCS::HTMLDiff
@@ -19,13 +19,13 @@ class Diff::LCS::HTMLDiff
@output = output
options ||= {}
- @match_class = options[:match_class] || 'match'
- @only_a_class = options[:only_a_class] || 'only_a'
- @only_b_class = options[:only_b_class] || 'only_b'
+ @match_class = options[:match_class] || "match"
+ @only_a_class = options[:only_a_class] || "only_a"
+ @only_b_class = options[:only_b_class] || "only_b"
end
def htmlize(element, css_class)
- element = '&nbsp;' if element.empty?
+ element = "&nbsp;" if element.empty?
%Q(<pre class="#{__send__(css_class)}">#{element}</pre>\n)
end
private :htmlize
@@ -103,7 +103,7 @@ h1 { margin-left: 2em; }
@options[:css] ||= DEFAULT_CSS.dup
- @options[:title] ||= 'diff'
+ @options[:title] ||= "diff"
end
private :verify_options
diff --git a/lib/diff/lcs/hunk.rb b/lib/diff/lcs/hunk.rb
index d27b024..2a9645d 100644
--- a/lib/diff/lcs/hunk.rb
+++ b/lib/diff/lcs/hunk.rb
@@ -1,13 +1,13 @@
# frozen_string_literal: true
-require 'diff/lcs/block'
+require "diff/lcs/block"
# A Hunk is a group of Blocks which overlap because of the context surrounding
# each block. (So if we're not using context, every hunk will contain one
# block.) Used in the diff program (bin/ldiff).
class Diff::LCS::Hunk
- OLD_DIFF_OP_ACTION = { '+' => 'a', '-' => 'd', '!' => 'c' }.freeze #:nodoc:
- ED_DIFF_OP_ACTION = { '+' => 'a', '-' => 'd', '!' => 'c' }.freeze #:nodoc:
+ OLD_DIFF_OP_ACTION = { "+" => "a", "-" => "d", "!" => "c" }.freeze #:nodoc:
+ ED_DIFF_OP_ACTION = { "+" => "a", "-" => "d", "!" => "c" }.freeze #:nodoc:
private_constant :OLD_DIFF_OP_ACTION, :ED_DIFF_OP_ACTION if respond_to?(:private_constant)
@@ -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
@@ -133,7 +133,7 @@ class Diff::LCS::Hunk
# Note that an old diff can't have any context. Therefore, we know that
# there's only one block in the hunk.
def old_diff(_last = false)
- warn 'Expecting only one block in an old diff hunk!' if @blocks.size > 1
+ warn "Expecting only one block in an old diff hunk!" if @blocks.size > 1
block = @blocks[0]
@@ -144,13 +144,13 @@ class Diff::LCS::Hunk
# If removing anything, just print out all the remove lines in the hunk
# which is just all the remove lines in the block.
unless block.remove.empty?
- @data_old[@start_old..@end_old].each { |e| s << encode('< ') + e.chomp + encode("\n") }
+ @data_old[@start_old..@end_old].each { |e| s << encode("< ") + e.chomp + encode("\n") }
end
- s << encode("---\n") if block.op == '!'
+ s << encode("---\n") if block.op == "!"
unless block.insert.empty?
- @data_new[@start_new..@end_new].each { |e| s << encode('> ') + e.chomp + encode("\n") }
+ @data_new[@start_new..@end_new].each { |e| s << encode("> ") + e.chomp + encode("\n") }
end
s
@@ -213,7 +213,7 @@ class Diff::LCS::Hunk
def context_diff(last = false)
s = encode("***************\n")
s << encode("*** #{context_range(:old, ',', last)} ****\n")
- r = context_range(:new, ',', last)
+ r = context_range(:new, ",", last)
if last
old_missing_newline = missing_last_newline?(@data_old)
@@ -269,7 +269,7 @@ class Diff::LCS::Hunk
private :context_diff
def ed_diff(format, _last = false)
- warn 'Expecting only one block in an old diff hunk!' if @blocks.size > 1
+ warn "Expecting only one block in an old diff hunk!" if @blocks.size > 1
s =
if format == :reverse_ed
diff --git a/lib/diff/lcs/internals.rb b/lib/diff/lcs/internals.rb
index ef77667..2ed713f 100644
--- a/lib/diff/lcs/internals.rb
+++ b/lib/diff/lcs/internals.rb
@@ -100,7 +100,7 @@ class << Diff::LCS::Internals
# the object form of same) and detection of whether the patchset represents
# changes to be made.
def analyze_patchset(patchset, depth = 0)
- fail 'Patchset too complex' if depth > 1
+ fail "Patchset too complex" if depth > 1
has_changes = false
new_patchset = []
@@ -157,22 +157,22 @@ class << Diff::LCS::Internals
re = string ? src[change.new_position, 1] : src[change.new_position]
case change.action
- when '-' # Remove details from the old string
+ when "-" # Remove details from the old string
if le == change.old_element
left_match += 1
else
left_miss += 1
end
- when '+'
+ when "+"
if re == change.new_element
right_match += 1
else
right_miss += 1
end
- when '='
+ when "="
left_miss += 1 if le != change.old_element
right_miss += 1 if re != change.new_element
- when '!'
+ when "!"
if le == change.old_element
left_match += 1
elsif re == change.new_element
@@ -189,19 +189,19 @@ class << Diff::LCS::Internals
element = string ? src[change.position, 1] : src[change.position]
case change.action
- when '-'
+ when "-"
if element == change.element
left_match += 1
else
left_miss += 1
end
- when '+'
+ when "+"
if element == change.element
right_match += 1
else
right_miss += 1
end
- when '='
+ when "="
if element != change.element
left_miss += 1
right_miss += 1
diff --git a/lib/diff/lcs/ldiff.rb b/lib/diff/lcs/ldiff.rb
index 17b374c..c4a60d0 100644
--- a/lib/diff/lcs/ldiff.rb
+++ b/lib/diff/lcs/ldiff.rb
@@ -1,8 +1,8 @@
# frozen_string_literal: true
-require 'optparse'
-require 'ostruct'
-require 'diff/lcs/hunk'
+require "optparse"
+require "ostruct"
+require "diff/lcs/hunk"
module Diff::LCS::Ldiff #:nodoc:
BANNER = <<-COPYRIGHT
@@ -28,48 +28,48 @@ class << Diff::LCS::Ldiff
args.options do |o|
o.banner = "Usage: #{File.basename($0)} [options] oldfile newfile"
- o.separator ''
+ o.separator ""
o.on(
- '-c', '-C', '--context [LINES]', Integer,
- 'Displays a context diff with LINES lines', 'of context. Default 3 lines.'
+ "-c", "-C", "--context [LINES]", Integer,
+ "Displays a context diff with LINES lines", "of context. Default 3 lines."
) do |ctx|
@format = :context
@lines = ctx || 3
end
o.on(
- '-u', '-U', '--unified [LINES]', Integer,
- 'Displays a unified diff with LINES lines', 'of context. Default 3 lines.'
+ "-u", "-U", "--unified [LINES]", Integer,
+ "Displays a unified diff with LINES lines", "of context. Default 3 lines."
) do |ctx|
@format = :unified
@lines = ctx || 3
end
- o.on('-e', 'Creates an \'ed\' script to change', 'oldfile to newfile.') do |_ctx|
+ o.on("-e", "Creates an 'ed' script to change", "oldfile to newfile.") do |_ctx|
@format = :ed
end
- o.on('-f', 'Creates an \'ed\' script to change', 'oldfile to newfile in reverse order.') do |_ctx|
+ o.on("-f", "Creates an 'ed' script to change", "oldfile to newfile in reverse order.") do |_ctx|
@format = :reverse_ed
end
o.on(
- '-a', '--text',
- 'Treat the files as text and compare them', 'line-by-line, even if they do not seem', 'to be text.'
+ "-a", "--text",
+ "Treat the files as text and compare them", "line-by-line, even if they do not seem", "to be text."
) do |_txt|
@binary = false
end
- o.on('--binary', 'Treats the files as binary.') do |_bin|
+ o.on("--binary", "Treats the files as binary.") do |_bin|
@binary = true
end
- o.on('-q', '--brief', 'Report only whether or not the files', 'differ, not the details.') do |_ctx|
+ o.on("-q", "--brief", "Report only whether or not the files", "differ, not the details.") do |_ctx|
@format = :report
end
- o.on_tail('--help', 'Shows this text.') do
+ o.on_tail("--help", "Shows this text.") do
error << o
return 0
end
- o.on_tail('--version', 'Shows the version of Diff::LCS.') do
+ o.on_tail("--version", "Shows the version of Diff::LCS.") do
error << Diff::LCS::Ldiff::BANNER
return 0
end
- o.on_tail ''
+ o.on_tail ""
o.on_tail 'By default, runs produces an "old-style" diff, with output like UNIX diff.'
o.parse!
end
@@ -87,11 +87,11 @@ class << Diff::LCS::Ldiff
case @format
when :context
- char_old = '*' * 3
- char_new = '-' * 3
+ char_old = "*" * 3
+ char_new = "-" * 3
when :unified
- char_old = '-' * 3
- char_new = '+' * 3
+ char_old = "-" * 3
+ char_new = "+" * 3
end
# After we've read up to a certain point in each file, the number of
@@ -129,9 +129,9 @@ class << Diff::LCS::Ldiff
end
if (@format == :unified) or (@format == :context)
- ft = File.stat(file_old).mtime.localtime.strftime('%Y-%m-%d %H:%M:%S.000000000 %z')
+ ft = File.stat(file_old).mtime.localtime.strftime("%Y-%m-%d %H:%M:%S.000000000 %z")
output << "#{char_old} #{file_old}\t#{ft}\n"
- ft = File.stat(file_new).mtime.localtime.strftime('%Y-%m-%d %H:%M:%S.000000000 %z')
+ ft = File.stat(file_new).mtime.localtime.strftime("%Y-%m-%d %H:%M:%S.000000000 %z")
output << "#{char_new} #{file_new}\t#{ft}\n"
end