Class: ParallelSpecs::RSpec::LoggerBase

Inherits:
RSpec::Core::Formatters::BaseTextFormatter
  • Object
show all
Defined in:
lib/parallel_specs/rspec/logger_base.rb

Direct Known Subclasses

RuntimeLogger

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ LoggerBase

Returns a new instance of LoggerBase.



13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/parallel_specs/rspec/logger_base.rb', line 13

def initialize(*args)
  super

  @output ||= args[0]
  case @output
  when String
    FileUtils.mkdir_p(File.dirname(@output))
    File.open(@output, 'w') {}
    @output = File.open(@output, 'a')
  when File
    @output.close
    @output = File.open(@output.path, 'a')
  end
end

Instance Method Details

#closeObject



28
29
30
# File 'lib/parallel_specs/rspec/logger_base.rb', line 28

def close(*)
  @output.close if IO === @output && @output != $stdout
end