class RSpec::LogSplit::Config

Public Class Methods

new(mod, dir) click to toggle source
# File lib/rspec/log_split.rb, line 39
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.rb, line 54
def logger(path)
  file = File.open(path, "a")
  file.sync = true
  Logger.new(file)
end
run(example, &block) click to toggle source
# File lib/rspec/log_split.rb, line 47
def run(example, &block)
  example_path = @path.join(example.location)
  example_path.parent.mkpath
  example_logger = logger(example_path.to_path)
  MyExample.new(@logger, @mod, example, example_logger).run(&block)
end