Module: Cucumber::Formatter::Io::ClassMethods

Defined in:
lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-8.0.0/lib/cucumber/formatter/io.rb

Instance Method Summary collapse

Instance Method Details

#new(*args, &block) ⇒ Object



29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-8.0.0/lib/cucumber/formatter/io.rb', line 29

def new(*args, &block)
  instance = super

  config = args[0]
  if config.respond_to? :on_event
    config.on_event :test_run_finished do
      ios = instance.instance_variable_get(:@io_objects_to_close) || []
      ios.each do |io|
        at_exit do
          unless io.closed?
            io.flush
            io.close
          end
        end
      end
    end
  end

  instance
end