Class: 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
-
#column ⇒ Integer
The column of the current position.
-
#line ⇒ Integer
The line of the current position.
-
#offset ⇒ Integer
The current position as the number of elements previously read.
-
#path ⇒ String
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
-
#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
#column ⇒ Integer
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 |
#drop ⇒ AbstractInput
Advance the cursor forward ‘n` elements
112 |
# File 'lib/stupidedi/reader/input/abstract_input.rb', line 112 abstract :drop, :args => %w(n) |
#index ⇒ Integer
Returns the smallest ‘n`, where #at`(n)` == `element`
102 |
# File 'lib/stupidedi/reader/input/abstract_input.rb', line 102 abstract :index, :args => %w(value) |
#line ⇒ Integer
The line of the current position
68 |
# File 'lib/stupidedi/reader/input/abstract_input.rb', line 68 delegate :line, :to => :position |
#offset ⇒ Integer
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 |
#path ⇒ String
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 |