Method: Liste#push
- Defined in:
- lib/prct06/list.rb
#push(obj) ⇒ string
Pushes a new Object at the end of the list.
40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/prct06/list.rb', line 40 def push(obj) a = Node.new(obj, nil, @tail) if size > 0 @tail.next = a else @head = a end @tail = a @size += 1 return a.value.to_s end |