Class: Stupidedi::Reader::AbstractInput
- Inherits:
-
Object
- Object
- Stupidedi::Reader::AbstractInput
- Includes:
- Inspect
- Defined in:
- lib/stupidedi/reader/input/abstract_input.rb
Overview
Provides an abstract interface for a positioned cursor within an element-based input stream. The main operations are implemented by the #take and #drop methods.
The DelegatedInput subclass wraps values that already implement the
interface, like String and Array. The FileInput subclass wraps
opened IO streams like File, and possibly others.
Direct Known Subclasses
Querying the Position (collapse)
-
- (Integer) column
The column of the current position.
-
- (Integer) line
The line of the current position.
-
- (Integer) offset
The current position as the number of elements previously read.
-
- (String) path
The file name, URI, etc that identifies the input stream.
-
- (Position) position
The Position value that describes the position of the input stream.
Reading the Input (collapse)
-
- (Integer) index
Returns the smallest
n, where #at(n)==element.
Advancing the Cursor (collapse)
-
- (AbstractInput) drop
Advance the cursor forward
nelements.
Methods included from Inspect
Instance Method Details
- (Integer) column
The column of the current position. The column resets to 1 each time
a newline is read
74 |
# File 'lib/stupidedi/reader/input/abstract_input.rb', line 74 delegate :column, :to => :position |
- (AbstractInput) drop
Advance the cursor forward n elements
112 |
# File 'lib/stupidedi/reader/input/abstract_input.rb', line 112 abstract :drop, :args => %w(n) |
- (Integer) index
Returns the smallest n, where #at(n) == element
102 |
# File 'lib/stupidedi/reader/input/abstract_input.rb', line 102 abstract :index, :args => %w(value) |
- (Integer) line
The line of the current position
68 |
# File 'lib/stupidedi/reader/input/abstract_input.rb', line 68 delegate :line, :to => :position |
- (Integer) offset
The current position as the number of elements previously read
63 |
# File 'lib/stupidedi/reader/input/abstract_input.rb', line 63 delegate :offset, :to => :position |
- (String) path
The file name, URI, etc that identifies the input stream
79 |
# File 'lib/stupidedi/reader/input/abstract_input.rb', line 79 delegate :path, :to => :position |