Class: Rake::LinkedList::EmptyLinkedList
- Inherits:
-
Rake::LinkedList
- Object
- Rake::LinkedList
- Rake::LinkedList::EmptyLinkedList
- Defined in:
- lib/rake/linked_list.rb
Overview
Represent an empty list, using the Null Object Pattern.
When inheriting from the 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).
Direct Known Subclasses
Instance Attribute Summary
Attributes inherited from Rake::LinkedList
Class Method Summary collapse
Instance Method Summary collapse
- #empty? ⇒ Boolean
-
#initialize ⇒ EmptyLinkedList
constructor
A new instance of EmptyLinkedList.
Methods inherited from Rake::LinkedList
#==, #conj, #each, empty, #inspect, make, #to_s
Constructor Details
#initialize ⇒ EmptyLinkedList
Returns a new instance of EmptyLinkedList.
97 98 |
# File 'lib/rake/linked_list.rb', line 97 def initialize end |
Class Method Details
.cons(head, tail) ⇒ Object
104 105 106 |
# File 'lib/rake/linked_list.rb', line 104 def self.cons(head, tail) @parent.cons(head, tail) end |
Instance Method Details
#empty? ⇒ Boolean
100 101 102 |
# File 'lib/rake/linked_list.rb', line 100 def empty? true end |