Sha256: 5890fb0c508f4cb5c8c8f64cdf179646fc6529f9b19c32f8295fe6f2abdb9e8a

Contents?: true

Size: 599 Bytes

Versions: 5

Compression:

Stored size: 599 Bytes

Contents

# -*- coding: binary -*-
require 'rex/ui'

module Rex
module Ui
module Text

###
#
# This class implements output against a file
#
###
class Output::File < Rex::Ui::Text::Output

  attr_accessor :fd

  def initialize(path, mode='wb')
    self.fd = ::File.open(path, mode)
  end

  def supports_color?
    false
  end

  #
  # Prints the supplied message to file output.
  #
  def print_raw(msg = '')
    return if not self.fd
    self.fd.write(msg)
    self.fd.flush
    msg
  end
  alias_method :write, :print_raw

  def close
    self.fd.close if self.fd
    self.fd = nil
  end
end

end
end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rex-2.0.13 lib/rex/ui/text/output/file.rb
rex-2.0.12 lib/rex/ui/text/output/file.rb
rex-2.0.11 lib/rex/ui/text/output/file.rb
rex-2.0.10 lib/rex/ui/text/output/file.rb
rex-2.0.9 lib/rex/ui/text/output/file.rb