Class: Stupidedi::Reader::AbstractInput
- Inherits:
-
Object
- Object
- Stupidedi::Reader::AbstractInput
- Includes:
- Inspect
- Defined in:
- lib/stupidedi/reader/input/abstract_input.rb
Overview
The monkey-patched classes String and Array provide compatible implementations of the abstract methods, so code written to target this interface is backward-compatable with plain unwrapped String and Array values.
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
-
#position ⇒ String
The file name, URI, etc that identifies the input stream.
Reading the Input collapse
-
#index ⇒ Integer
Returns the smallest ‘n`, where #at`(n)` == `element`.
Advancing the Cursor collapse
-
#drop ⇒ AbstractInput
Advance the cursor forward ‘n` elements.
Methods included from Inspect
Instance Method Details
#drop ⇒ AbstractInput
Advance the cursor forward ‘n` elements
117 |
# File 'lib/stupidedi/reader/input/abstract_input.rb', line 117 abstract :drop, :args => %w(n) |
#index ⇒ Integer
Returns the smallest ‘n`, where #at`(n)` == `element`
107 |
# File 'lib/stupidedi/reader/input/abstract_input.rb', line 107 abstract :index, :args => %w(element) |
#position ⇒ String
The file name, URI, etc that identifies the input stream
60 |
# File 'lib/stupidedi/reader/input/abstract_input.rb', line 60 abstract :position |