Class: Git::Lint::CLI::Actions::Hook

Inherits:
Sod::Action
  • Object
show all
Defined in:
lib/git/lint/cli/actions/hook.rb

Overview

Handles unsaved Git commit action.

Instance Method Summary collapse

Constructor Details

#initialize(analyzer: Analyzer.new) ⇒ Hook

Returns a new instance of Hook.



18
19
20
21
# File 'lib/git/lint/cli/actions/hook.rb', line 18

def initialize(analyzer: Analyzer.new, **)
  super(**)
  @analyzer = analyzer
end

Instance Method Details

#call(path) ⇒ Object



23
24
25
26
27
28
# File 'lib/git/lint/cli/actions/hook.rb', line 23

def call path
  analyzer.call commits: commits(path) do |collector, reporter|
    io.puts reporter
    kernel.abort if collector.errors?
  end
end