Class: Guard::Reek::Runner

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

Overview

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ Runner

Returns a new instance of Runner.



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

def initialize(options)
  @options = options
  @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



16
17
18
19
20
21
22
23
24
# File 'lib/guard/reek/runner.rb', line 16

def run(paths = [])
  paths = [] if paths.include?('.reek')
  ui_message(paths)

  command = ['reek'].concat(paths)
  @result = system(*command)

  notify_about_result
end