Sha256: 836f026fc8b39cb657240479f82d9abefd013c51eac3624a13975ede0d3d8a13

Contents?: true

Size: 807 Bytes

Versions: 14

Compression:

Stored size: 807 Bytes

Contents

# -*- coding: utf-8; mode: ruby; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- vim:fenc=utf-8:filetype=ruby:et:sw=2:ts=2:sts=2

module GitCommitNotifier
  # Callback for Diff::LCS.traverse_balanced method.
  class DiffCallback
    # Gets collected tags.
    # @return [Array(Hash)] Collected tags.
    attr_reader :tags

    def initialize
      @tags = []
    end

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

    # Adds discarded B side to {#tags}.
    def discard_b(event)
      @tags << { :action => :discard_b, :token => event.new_element }
    end

    # Adds discarded A side to {#tags}.
    def discard_a(event)
      @tags << { :action => :discard_a, :token => event.old_element }
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
git-commit-notifier-0.12.10 lib/git_commit_notifier/diff_callback.rb
git-commit-notifier-0.12.6 lib/git_commit_notifier/diff_callback.rb
git-commit-notifier-0.12.5 lib/git_commit_notifier/diff_callback.rb
git-commit-notifier-0.12.3 lib/git_commit_notifier/diff_callback.rb
git-commit-notifier-0.12.2 lib/git_commit_notifier/diff_callback.rb
git-commit-notifier-0.12.1 lib/git_commit_notifier/diff_callback.rb
git-commit-notifier-0.12.0 lib/git_commit_notifier/diff_callback.rb
git-commit-notifier-0.11.11 lib/git_commit_notifier/diff_callback.rb
git-commit-notifier-0.11.10 lib/git_commit_notifier/diff_callback.rb
git-commit-notifier-0.11.9 lib/git_commit_notifier/diff_callback.rb
git-commit-notifier-0.11.6 lib/git_commit_notifier/diff_callback.rb
git-commit-notifier-0.11.5 lib/git_commit_notifier/diff_callback.rb
git-commit-notifier-0.11.4 lib/git_commit_notifier/diff_callback.rb
git-commit-notifier-0.11.3 lib/git_commit_notifier/diff_callback.rb