summaryrefslogtreecommitdiff
path: root/lib/diff/lcs/callbacks.rb
diff options
context:
space:
mode:
authorAustin Ziegler <austin@zieglers.ca>2022-07-05 15:43:30 -0400
committerGitHub <noreply@github.com>2022-07-05 15:43:30 -0400
commitcab33a91e2894558b962b4b2236a213c6d63c54e (patch)
treefc14bc4c8a44e20026e1252a8cd435907d412ee1 /lib/diff/lcs/callbacks.rb
parent3062997fbbe19cb6099a65a5dbcd0aba7b9b17c7 (diff)
parent0270cb87e09dd444ad6822a777bb7999fd6f6e85 (diff)
downloaddiff-lcs-main.tar.gz
Merge pull request #81 from halostatue/switch-to-standardrb-formattingHEADmain
Switch to standardrb formatting
Diffstat (limited to 'lib/diff/lcs/callbacks.rb')
-rw-r--r--lib/diff/lcs/callbacks.rb16
1 files changed, 9 insertions, 7 deletions
diff --git a/lib/diff/lcs/callbacks.rb b/lib/diff/lcs/callbacks.rb
index 2a7665b..2c5a779 100644
--- a/lib/diff/lcs/callbacks.rb
+++ b/lib/diff/lcs/callbacks.rb
@@ -1,8 +1,8 @@
# frozen_string_literal: true
-require 'diff/lcs/change'
+require "diff/lcs/change"
-module Diff::LCS # rubocop:disable Style/Documentation
+module Diff::LCS
# This callback object implements the default set of callback events,
# which only returns the event itself. Note that #finished_a and
# #finished_b are not implemented -- I haven't yet figured out where they
@@ -50,7 +50,9 @@ module Diff::LCS # rubocop:disable Style/Documentation
BalancedCallbacks = DefaultCallbacks
def self.callbacks_for(callbacks)
- callbacks.new rescue callbacks
+ callbacks.new
+ rescue
+ callbacks
end
end
@@ -107,7 +109,7 @@ class Diff::LCS::DiffCallbacks
# Returns the difference set collected during the diff process.
attr_reader :diffs
- def initialize # :yields self:
+ def initialize # :yields: self
@hunk = []
@diffs = []
@@ -131,11 +133,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
@@ -302,7 +304,7 @@ class Diff::LCS::SDiffCallbacks
# Returns the difference set collected during the diff process.
attr_reader :diffs
- def initialize #:yields self:
+ def initialize # :yields: self
@diffs = []
yield self if block_given?
end