In Files

  • rake/linked_list.rb

Rake::LinkedList::EmptyLinkedList

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 assocated list class (this allows conj, cons and make to work polymorphically).

Public Class Methods

cons(head, tail) click to toggle source
 
               # File rake/linked_list.rb, line 95
def self.cons(head, tail)
  @parent.cons(head, tail)
end
            
new() click to toggle source
 
               # File rake/linked_list.rb, line 88
def initialize
end
            

Public Instance Methods

empty?() click to toggle source
 
               # File rake/linked_list.rb, line 91
def empty?
  true
end
            

Commenting is here to help enhance the documentation. For example, code samples, or clarification of the documentation.

If you have questions about Ruby or the documentation, please post to one of the Ruby mailing lists. You will get better, faster, help that way.

If you wish to post a correction of the docs, please do so, but also file bug report so that it can be corrected for the next release. Thank you.

If you want to help improve the Ruby documentation, please visit Documenting-ruby.org.

blog comments powered by Disqus