Class: Thimblr::ArrayIO

Inherits:
Array
  • Object
show all
Defined in:
lib/thimblr/parser.rb

Instance Method Summary collapse

Instance Method Details

#advanceObject

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

#retreatObject

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

#tellObject



365
366
367
# File 'lib/thimblr/parser.rb', line 365

def tell
  @position
end