Methods
A
E
T
Instance Public methods
add_to_list(obj)
# File sample/list.rb, line 26
def add_to_list(obj)
  elt = MyElem.new(obj)
  if @head
    @tail.succ = elt
  else
    @head = elt
  end
  @tail = elt
end
each()
# File sample/list.rb, line 36
def each
  elt = @head
  while elt
    yield elt
    elt = elt.succ
  end
end
to_s()

the method to convert object into string. redefining this will affect print.

# File sample/list.rb, line 46
def to_s
  str = "<MyList:\n";
  for elt in self
    # short form of ``str = str + elt.data.to_s + "\n"''
    str += elt.data.to_s + "\n"
  end
  str += ">"
  str
end