class Immutable::Realizable

Common behavior for other classes which implement various kinds of `List`s @private

Public Class Methods

new() click to toggle source
# File lib/immutable/list.rb, line 1387
def initialize
  @head, @tail, @size = Undefined, Undefined, nil
end

Public Instance Methods

cached_size?() click to toggle source
# File lib/immutable/list.rb, line 1412
def cached_size?
  @size != nil
end
empty?() click to toggle source
# File lib/immutable/list.rb, line 1402
def empty?
  realize if @head == Undefined
  @size == 0
end
first()
Alias for: head
head() click to toggle source
# File lib/immutable/list.rb, line 1391
def head
  realize if @head == Undefined
  @head
end
Also aliased as: first
length()
Alias for: size
realized?() click to toggle source
# File lib/immutable/list.rb, line 1416
def realized?
  @head != Undefined
end
size() click to toggle source
Calls superclass method Immutable::List#size
# File lib/immutable/list.rb, line 1407
def size
  @size ||= super
end
Also aliased as: length
tail() click to toggle source
# File lib/immutable/list.rb, line 1397
def tail
  realize if @tail == Undefined
  @tail
end