Class: GitCommitNotifier::DiffCallback

Inherits:
Object
  • Object
show all
Defined in:
lib/git_commit_notifier/diff_callback.rb

Overview

Callback for Diff::LCS.traverse_balanced method.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeDiffCallback

Returns a new instance of DiffCallback.



10
11
12
# File 'lib/git_commit_notifier/diff_callback.rb', line 10

def initialize
  @tags = []
end

Instance Attribute Details

#tagsArray(Hash) (readonly)

Gets collected tags.

Returns:

  • (Array(Hash))

    Collected tags.



8
9
10
# File 'lib/git_commit_notifier/diff_callback.rb', line 8

def tags
  @tags
end

Instance Method Details

#discard_a(event) ⇒ Object

Adds discarded A side to #tags.



25
26
27
# File 'lib/git_commit_notifier/diff_callback.rb', line 25

def discard_a(event)
  @tags << { :action => :discard_a, :token => event.old_element }
end

#discard_b(event) ⇒ Object

Adds discarded B side to #tags.



20
21
22
# File 'lib/git_commit_notifier/diff_callback.rb', line 20

def discard_b(event)
  @tags << { :action => :discard_b, :token => event.new_element }
end

#match(event) ⇒ Object

Adds diff match to #tags.



15
16
17
# File 'lib/git_commit_notifier/diff_callback.rb', line 15

def match(event)
  @tags << { :action => :match, :token => event.old_element }
end