Class: Guard::Reek::Runner

Inherits:
Object
  • Object
show all
Defined in:
lib/guard/reek/runner.rb

Overview

This class runs ‘reek` command, retrieves result and notifies. An instance of this class is intended to invoke `reek` only once in its lifetime.

Defined Under Namespace

Classes: Paths

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ Runner

Returns a new instance of Runner.



10
11
12
13
14
15
# File 'lib/guard/reek/runner.rb', line 10

def initialize(options)
  @cli = options[:cli]
  @all = options[:all] || '*'
  @notifier = options[:notifier] || Notifier
  @ui = options[:ui] || UI
end

Instance Attribute Details

#notifierObject (readonly)

Returns the value of attribute notifier.



8
9
10
# File 'lib/guard/reek/runner.rb', line 8

def notifier
  @notifier
end

#resultObject (readonly)

Returns the value of attribute result.



8
9
10
# File 'lib/guard/reek/runner.rb', line 8

def result
  @result
end

#uiObject (readonly)

Returns the value of attribute ui.



8
9
10
# File 'lib/guard/reek/runner.rb', line 8

def ui
  @ui
end

Instance Method Details

#run(paths = []) ⇒ Object



38
39
40
41
42
43
44
45
46
# File 'lib/guard/reek/runner.rb', line 38

def run(paths = [])
  result = run_reek_cmd(paths)

  if result
    notifier.notify('Reek Results', title: 'Passed', image: :success)
  else
    notifier.notify('Reek Results', title: 'Failed', image: :failed)
  end
end