Class: EventDb::EventReader::DatafileParser
- Inherits:
-
Object
- Object
- EventDb::EventReader::DatafileParser
- Includes:
- LogUtils::Logging
- Defined in:
- lib/eventdb/reader.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(text) ⇒ DatafileParser
constructor
A new instance of DatafileParser.
- #parse ⇒ Object
Constructor Details
#initialize(text) ⇒ DatafileParser
Returns a new instance of DatafileParser.
41 42 43 |
# File 'lib/eventdb/reader.rb', line 41 def initialize( text ) @text = text end |
Class Method Details
.parse(text) ⇒ Object
37 |
# File 'lib/eventdb/reader.rb', line 37 def self.parse( text ) new( text ).parse; end |
Instance Method Details
#parse ⇒ Object
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# 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 |