class RSpec::LogSplit::Config

Public Class Methods

new(mod, dir) click to toggle source
# File lib/rspec/log_split/config.rb, line 4
def initialize(mod, dir)
  @mod = mod
  @path = Pathname.new(dir)
  @path.mkpath
  @logger = logger(@path.join("main"))
end

Public Instance Methods

logger(path) click to toggle source
# File lib/rspec/log_split/config.rb, line 18
def logger(path)
  file = File.open(path, "a")
  file.sync = true
  Logger.new(file)
end
run(example) click to toggle source
# File lib/rspec/log_split/config.rb, line 11
def run(example)
  example_path = @path.join(example.location)
  example_path.parent.mkpath
  example_logger = logger(example_path.to_path)
  Handler.new(@logger, @mod, example, example_logger).run
end