123456789_123456789_123456789_123456789_123456789_

Class: Rake::LinkedList::EmptyLinkedList

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

Overview

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).

Class Method Summary

Instance Attribute Summary

Constructor Details

.newEmptyLinkedList

[ GitHub ]

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

def initialize
end

Class Method Details

.cons(head, tail)

[ GitHub ]

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

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

Instance Attribute Details

#empty?Boolean (readonly)

[ GitHub ]

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

def empty?
  true
end