title: best linked list in ruby WITHOUT extending array?
body: <p>What is the best way to implement a linked list in Ruby without using/extending the Array class?  This is an implementation that I've used in the past, but it doesn't seem like the best way to go about it:</p>
  
  <pre><code>class Node
  
      attr_accessor :value, :next_node
  
      def initialize(value = nil)
          @value = value
      end
  
      def to_s
          @value
      end
  
  end
  
  class SinglyLinkedList
  
      attr_accessor :head
  
      def initialize(first_value=nil)
          @head = Node.new(first_value) if first_value
      end
  
      def add(value)
          #adds a new node to the list, amakes it the new head and links it to the former head
          new_node = Node.new(value)
          new_node.next_node = @head
  
          @head = new_node
      end
  
      def remove
          @head = @head.next_node
      end
  end
  </code></pre>