Sha256: 04e1e5535a5cfd19827284a2e4667ee6bc5ca163ae57a727ae4cd90960aeb469
Contents?: true
Size: 1.43 KB
Versions: 2
Compression:
Stored size: 1.43 KB
Contents
#-- # Ruby Whois # # An intelligent pure Ruby WHOIS client and parser. # # Copyright (c) 2009-2011 Simone Carletti <weppos@weppos.net> #++ module Whois class Record class Parser module Scanners # Represents the abstract base scanner class, # containing common scanner methods. # # Concrete classes should implement the following methods: # # * {#parse_content} # # @abstract # class Base def initialize(content) @input = StringScanner.new(content) end def parse @ast = {} while !@input.eos? parse_content end @ast end # This method is the core of the parser. # # It should include the parser logic # to analyze, trim or consume a line. # # @abstract Implement in your parser. def parse_content raise NotImplementedError end def trim_empty_line @input.skip(/^\n/) end def trim_newline @input.skip(/\n/) end def error!(message) if @input.eos? raise ParserError, "Unexpected end of input." else raise ParserError, "#{message}: #{@input.peek(@input.string.length)}" end end end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
whois-2.2.0 | lib/whois/record/parser/scanners/base.rb |
whois-2.1.0 | lib/whois/record/parser/scanners/base.rb |