module Cucumber::Formatter::Io
def ensure_io(path_or_url_or_io, error_stream)
def ensure_io(path_or_url_or_io, error_stream) return nil if path_or_url_or_io.nil? return path_or_url_or_io if io?(path_or_url_or_io) io = if url?(path_or_url_or_io) url = path_or_url_or_io reporter = url.start_with?(Cucumber::Cli::Options::CUCUMBER_PUBLISH_URL) ? URLReporter.new(error_stream) : NoReporter.new HTTPIO.open(url, nil, reporter) else File.open(path_or_url_or_io, Cucumber.file_mode('w')) end @io_objects_to_close ||= [] @io_objects_to_close.push(io) io end