class Source


A Source can be searched for patterns, and wraps buffers and other objects and provides consumption of text

Attributes

Methods


Attributes

buffer (reader) The current buffer (what we're going to read next)
line (reader) The line number of the last consumed text

Methods

current_line

Returns the current line in the source

empty

Returns true if the Source is exhausted

encoding


Taken from code contributed by Ernest Ellingson <erne@powernav.com>

initialize


Constructor

match


scan

Returns the pattern, if found, or nil if the Source is empty or the pattern is not found.
Scans the source for a given pattern. Note, that this is not your usual scan() method. For one thing, the pattern argument has some requirements; for another, the source can be consumed. You can easily confuse this method. Originally, the patterns were easier to construct and this method more robust, because this method generated search regexes on the fly; however, this was computationally expensive and slowed down the entire REXML package considerably, since this is by far the most commonly called method.

utf8_enc


Taken from code contributed by Ernest Ellingson <erne@powernav.com>