Class: Thimblr::ArrayIO
- Inherits:
-
Array
- Object
- Array
- Thimblr::ArrayIO
- Defined in:
- lib/thimblr/parser.rb
Instance Method Summary collapse
-
#advance ⇒ Object
Returns the currently selected item and advances the pointer.
-
#retreat ⇒ Object
Returns the currently selected item and moves the pointer back one.
- #seek(n) ⇒ Object
- #tell ⇒ Object
Instance Method Details
#advance ⇒ Object
Returns the currently selected item and advances the pointer
350 351 352 353 |
# File 'lib/thimblr/parser.rb', line 350 def advance @position = @position + 1 rescue 1 self[@position - 1] end |
#retreat ⇒ Object
Returns the currently selected item and moves the pointer back one
356 357 358 359 |
# File 'lib/thimblr/parser.rb', line 356 def retreat @position = @position - 1 rescue -1 self[@position + 1] end |
#seek(n) ⇒ Object
361 362 363 |
# File 'lib/thimblr/parser.rb', line 361 def seek(n) self[@position = n] end |
#tell ⇒ Object
365 366 367 |
# File 'lib/thimblr/parser.rb', line 365 def tell @position end |