Class: Rake::LinkedList::EmptyLinkedList

Inherits:
Rake::LinkedList show all
Defined in:
lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/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

InvocationChain::EmptyInvocationChain

Instance Attribute Summary

Attributes inherited from Rake::LinkedList

#head, #tail

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Rake::LinkedList

#==, #conj, #each, empty, #inspect, make, #to_s

Methods included from Enumerable

#as_json, #compact_blank, #exclude?, #excluding, #in_order_of, #including, #index_by, #index_with, #many?, #maximum, #minimum, #pick, #pluck, #sole, #sum

Constructor Details

#initializeEmptyLinkedList

Returns a new instance of EmptyLinkedList.



98
99
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/lib/rake/linked_list.rb', line 98

def initialize
end

Class Method Details

.cons(head, tail) ⇒ Object



105
106
107
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/lib/rake/linked_list.rb', line 105

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

Instance Method Details

#empty?Boolean

Returns:

  • (Boolean)


101
102
103
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rake-13.0.6/lib/rake/linked_list.rb', line 101

def empty?
  true
end