Class: RSpec::LogSplit::Config
- Inherits:
-
Object
- Object
- RSpec::LogSplit::Config
- Defined in:
- lib/rspec/log_split/config.rb
Instance Method Summary collapse
-
#initialize(mod, dir) ⇒ Config
constructor
A new instance of Config.
- #logger(path) ⇒ Object
- #run(example) ⇒ Object
Constructor Details
#initialize(mod, dir) ⇒ Config
Returns a new instance of Config.
4 5 6 7 8 9 |
# 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 |
Instance Method Details
#logger(path) ⇒ Object
18 19 20 21 22 |
# 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) ⇒ Object
11 12 13 14 15 16 |
# 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 |