class EventDb::EventReader::DatafileParser

Public Class Methods

new( text ) click to toggle source
# File lib/eventdb/reader.rb, line 41
def initialize( text )
  @text = text
end
parse( text ) click to toggle source
# File lib/eventdb/reader.rb, line 37
def self.parse( text )  new( text ).parse; end

Public Instance Methods

parse() click to toggle source
# File lib/eventdb/reader.rb, line 45
def parse
  events = []

  @text.each_line do |line|
     line = line.strip
     next if line.empty?               ## skip empty lines
     next if line.start_with?( '#')    ## skip comment lines

     ## todo/check: add inline comments too - why? why not?

     puts "    reading >#{line}<..."
     events += EventReader.read( line )
  end

  events
end