Sha256: 3fef280cefc7d832dc6ec4ff2ba12792421685423da86e9d543c24ce4bebe6c5
Contents?: true
Size: 793 Bytes
Versions: 11
Compression:
Stored size: 793 Bytes
Contents
module IMW module Parsers class Flat attr_accessor :io attr_accessor :state attr_accessor :accumulated attr_accessor :current def initialize io self.io = io self.state = nil self.accumulated = [] self.current = nil end def read_next! self.current = io.readline.chomp end def parse! while (! complete?) read_next! react_to_input! end end def accumulate! self.accumulated << current end def complete? io.eof? end def react_to_input! raise IMW::NotImplementedError.new("Override the `react_to_input!' method of the #{self.class} class") end end end end
Version data entries
11 entries across 11 versions & 1 rubygems