class PPZ::FileDocParser

Public Class Methods

new(path) click to toggle source
Calls superclass method PPZ::AbstractDocParser::new
# File lib/doc/parser/file.rb, line 2
def initialize path
  super()
  unless File.exist? path
    throw '文件不存在,可能是路径错了(需要绝对路径):' + path
  end
  @file = File.new path
  @end = false
end

Private Instance Methods

readline() click to toggle source
# File lib/doc/parser/file.rb, line 11
        def readline
  return nil if @end

  begin
    line = @file.readline
    return line[-1] == '\n'? line[0...-1] : line
  rescue EOFError => err
    @end = true
    return nil
  end
end