Class: Lintress::Runner

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeRunner

Returns a new instance of Runner.



10
11
12
# File 'lib/lintress/runner.rb', line 10

def initialize
  @rubocop = RuboCop::CLI.new
end

Instance Attribute Details

#offensesObject (readonly)

Returns the value of attribute offenses.



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

def offenses
  @offenses
end

Instance Method Details

#runObject



14
15
16
17
18
19
20
21
22
23
24
# File 'lib/lintress/runner.rb', line 14

def run
  nsout = StringIO.new
  osout = $stdout # store the old STDOUT construct
  $stdout = nsout
  @rubocop.run
  @offenses = $stdout.string

  # return to old STDOUT
  $stdout = osout
  # puts @offenses
end