class Lab42::Stream::Empty

Public Class Methods

new() click to toggle source
# File lib/lab42/stream/empty.rb, line 47
def self.new
  @__instance__ ||= allocate
end

Public Instance Methods

+(other)
Alias for: append
__inject__(*args;)
Alias for: inject
append(other) click to toggle source
# File lib/lab42/stream/empty.rb, line 19
def append other
  raise ArgumentError, "not a stream #{other}" unless self.class.superclass === other
  # ??? Is the to_stream message a good idea
  other.to_stream
end
Also aliased as: +
empty?() click to toggle source
# File lib/lab42/stream/empty.rb, line 26
def empty?; true end
head() click to toggle source
# File lib/lab42/stream/empty.rb, line 29
def head; raise StopIteration, "head called on empty stream" end
inject(*args;) click to toggle source
# File lib/lab42/stream/empty.rb, line 33
def inject *args; args.first end
Also aliased as: __inject__
itself(*;) click to toggle source
# File lib/lab42/stream/empty.rb, line 36
def itself *; self end
scan( initial, * ) click to toggle source
# File lib/lab42/stream/empty.rb, line 38
def scan( initial, * )
  [initial]
end
scan1( * ) click to toggle source
# File lib/lab42/stream/empty.rb, line 42
def scan1( * )
  []
end
tail() click to toggle source
# File lib/lab42/stream/empty.rb, line 30
def tail; raise StopIteration, "tail called on empty stream" end