Class: CodeHunter::Runner

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(argv = []) ⇒ Runner

Returns a new instance of Runner.



9
10
11
# File 'lib/code_hunter/runner.rb', line 9

def initialize(argv = [])
  @options = OptionParser.parse!(argv)
end

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options.



3
4
5
# File 'lib/code_hunter/runner.rb', line 3

def options
  @options
end

Class Method Details

.run(*args) ⇒ Object



5
6
7
# File 'lib/code_hunter/runner.rb', line 5

def self.run(*args)
  new(*args).run
end

Instance Method Details

#resultObject



17
18
19
20
21
22
23
# File 'lib/code_hunter/runner.rb', line 17

def result
  results  = services.map(&:run).compact
  warnings = results.inject([], :+).map {|attributes| Warning.new(attributes) }
  warnings = warnings.select(&:has_git_metadata?)
  warnings = warnings.reject(&:ignore?)
  warnings.map(&:to_hash)
end

#runObject



13
14
15
# File 'lib/code_hunter/runner.rb', line 13

def run
  Renderer.render(result, :format => options[:format])
end