Class: Tapout::AbstractParser

Inherits:
Object
  • Object
show all
Defined in:
lib/tapout/parsers/abstract.rb

Direct Known Subclasses

JsonParser, PerlParser, YamlParser

Constant Summary collapse

PAUSE_DOCUMENT =

ASCII DLE (Data Link Escape)

16.chr + "\n"
RESUME_DOCUMENT =

ASCII ETB (End of Transmission Block)

23.chr + "\n"

Instance Method Summary collapse

Instance Method Details

#passthru(doc = nil) ⇒ Object

Passthru incoming data directly to ‘$stdout`.



15
16
17
18
19
20
21
22
# File 'lib/tapout/parsers/abstract.rb', line 15

def passthru(doc=nil)
  $stdout << doc if doc
  while line = @input.gets
    return line if RESUME_DOCUMENT === line
    $stdout << line
  end
  return ''
end