Class: StringLineReader
- Inherits:
-
Object
- Object
- StringLineReader
- Includes:
- LogUtils::Logging
- Defined in:
- lib/textutils/reader/line_reader.rb
Overview
fix/todo: move to/merge into LineReader itself
e.g. use fromString c'tor ??? or similar??
Instance Method Summary collapse
- #each_line ⇒ Object
-
#initialize(data) ⇒ StringLineReader
constructor
A new instance of StringLineReader.
Constructor Details
#initialize(data) ⇒ StringLineReader
Returns a new instance of StringLineReader.
11 12 13 |
# File 'lib/textutils/reader/line_reader.rb', line 11 def initialize( data ) @data = data end |
Instance Method Details
#each_line ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/textutils/reader/line_reader.rb', line 16 def each_line @data.each_line do |line| if line =~ /^\s*#/ # skip komments and do NOT copy to result (keep comments secret!) logger.debug 'skipping comment line' next end if line =~ /^\s*$/ # kommentar oder leerzeile überspringen logger.debug 'skipping blank line' next end # remove leading and trailing whitespace line = line.strip yield( line ) end # each lines end |