Class/Module Index [+]

Quicksearch

Cucumber::Formatter::Io

Public Instance Methods

ensure_dir(path, name) click to toggle source
# File lib/cucumber/formatter/io.rb, line 25
def ensure_dir(path, name)
  raise "You *must* specify --out DIR for the #{name} formatter" unless String === path
  raise "I can't write #{name} reports to a file - it has to be a directory" if File.file?(path)
  FileUtils.mkdir_p(path) unless File.directory?(path)
  path
end
ensure_file(path, name) click to toggle source
# File lib/cucumber/formatter/io.rb, line 19
def ensure_file(path, name)
  raise "You *must* specify --out FILE for the #{name} formatter" unless String === path
  raise "I can't write #{name} to a directory - it has to be a file" if File.directory?(path)
  ensure_io(path, name)
end
ensure_io(path_or_io, name) click to toggle source
# File lib/cucumber/formatter/io.rb, line 6
def ensure_io(path_or_io, name)
  return nil if path_or_io.nil?
  return path_or_io if ColorIO === path_or_io || path_or_io.respond_to?(:write)
  file = File.open(path_or_io, Cucumber.file_mode('w'))
  at_exit do
    unless file.closed?
      file.flush
      file.close
    end
  end
  file
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.