lib/nasa_explorer_app/facing.rb
def _build_linked_list(list)
      # Initialize everything to the first item in the list
      @current = head = prev = Direction.new(list.shift, nil, nil)

      # Create a doubly-linked list for directions
      list.each do |val|
        @current = Direction.new(val, prev, nil)
        prev.next = @current
        prev = @current
      end

      # Make the doubly-linked list circular
      @current.next = head
      head.prev = @current

      # Make current point to the head again
      @current = head
    end
# Model the Node of the linked-list as Struct
Model the Node of the linked-list as Struct
Model the Node of the linked - list as Struct
def _build_linked_list(list)
      @current = head = prev = Direction.new(list.shift, nil, nil)
      list.each do |val|
        @current = Direction.new(val, prev, nil)
        prev.next = @current
        prev = @current
      end
      @current.next = head
      head.prev = @current
      @current = head
    end
def _build_linked_list ( list ) @current = head = prev = Direction . new ( list . shift , nil , nil ) list . each do | val | @current = Direction . new ( val , prev , nil ) prev . next = @current prev = @current end @current . next = head head . prev = @current @current = head end
Model the Node of the linked-list as Struct
Model the Node of the linked - list as Struct
# Initialize everything to the first item in the list # Create a doubly-linked list for directions # Make the doubly-linked list circular # Make current point to the head again
list