class TaskJuggler::TextParser::Scanner::FileStreamHandle

Specialized version of StreamHandle for operations on files.

Attributes

fileName[R]

Public Class Methods

new(fileName, log, textScanner) click to toggle source
# File lib/taskjuggler/TextParser/Scanner.rb, line 169
def initialize(fileName, log, textScanner)
  super(log, textScanner)
  @fileName = fileName.dup.untaint
  data = (fileName == '.' ? $stdin : File.new(@fileName, 'r')).read
  begin
    @stream = StringIO.new(data.forceUTF8Encoding)
  rescue
    error('fileEncoding', $!.message)
  end
  @log.msg { "Parsing file #{@fileName} ..." }
  @log.startProgressMeter("Reading file #{fileName}")
end

Public Instance Methods

close() click to toggle source
# File lib/taskjuggler/TextParser/Scanner.rb, line 182
def close
  @stream.close unless @stream == $stdin
  super
end