Class: Rake::LinkedList::EmptyLinkedList

Relationships & Source Files
Extension / Inclusion / Inheritance Descendants
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
Instance Chain:
self, ::Rake::LinkedList, Enumerable
Inherits: Rake::LinkedList
Defined in: lib/rake/linked_list.rb


Represent an empty list, using the Null Object Pattern.

When inheriting from the ::Rake::LinkedList class, you should implement a type specific Empty class as well. Make sure you set the class instance variable @parent to the associated list class (this allows conj, cons and make to work polymorphically).

Constant Summary

::Rake::LinkedList - Inherited


Class Method Summary

::Rake::LinkedList - Inherited


Cons a new head onto the tail list.


The standard empty list class for the given ::Rake::LinkedList class.


Make a list out of the given arguments.


Instance Attribute Summary

::Rake::LinkedList - Inherited


Is the list empty? make guards against a list being empty making any instantiated ::Rake::LinkedList object not empty by default You should consider overriding this method if you implement your own make method.

#head, #tail

Instance Method Summary

::Rake::LinkedList - Inherited


Lists are structurally equivalent.


Polymorphically add a new element to the head of a list.


For each item in the list.


Same as #to_s, but with inspected items.


Convert to string: LL(item, item…).

Constructor Details


[ GitHub ]

# File 'lib/rake/linked_list.rb', line 98

def initialize

Class Method Details

.cons(head, tail)

[ GitHub ]

# File 'lib/rake/linked_list.rb', line 105

def self.cons(head, tail)
  @parent.cons(head, tail)

Instance Attribute Details

#empty?Boolean (readonly)

[ GitHub ]

# File 'lib/rake/linked_list.rb', line 101

def empty?