module Asciidoctor::Writer

A module that can be used to mix the {#write} method into a {Converter} implementation to allow the converter to control how the output is written to disk.

Public Instance Methods

write(output, target) click to toggle source

Public: Writes the output to the specified target file name or stream.

output - The output String to write target - The String file name or stream object to which the output should

be written.

Returns nothing

# File lib/asciidoctor/converter.rb, line 200
def write output, target
  if target.respond_to? :write
    target.write output.chomp
    # ensure there's a trailing endline to be nice to terminals
    target.write EOL
  else
    ::File.open(target, 'w') {|f| f.write output }
  end
  nil
end