class X_List::ListIterator

Attributes

head[RW]

protected - in ruby this doesn't play well with static/inline methods

val[RW]

Public Class Methods

new(head) click to toggle source
# File lib/lib/x_list/list_iterator.rb, line 7
def initialize(head)
  @head = head
  @val = nil
end

Public Instance Methods

_next() click to toggle source
# File lib/lib/x_list/list_iterator.rb, line 23
def _next 
  @val = @head[0]
  @head = @head[1]
  @val
end
has_next() click to toggle source
# File lib/lib/x_list/list_iterator.rb, line 19
def has_next 
  @head != nil
end