Class: Lab42::Stream::Empty
Constant Summary
ConstraintError, EmptyStream, IllegalState, Version
Instance Attribute Summary
#promise
Instance Method Summary
collapse
#__combine_streams__, #combine_streams, #drop, #to_stream
#iterate
#__combine__, #combine, #split_into
Methods included from Enumerable
#__filter__, #__flatmap__, #__flatmap_with_each__, #__inject_while__, #__lazy_take__, #__lazy_take_until__, #__lazy_take_while__, #__map__, #__scan__, #__zip__, #drop_until, #drop_while, #each, #each_without_loops, #filter, #flatmap, #flatmap_with_each, #force_all, #lazy_take, #lazy_take_until, #lazy_take_while, #make_cyclic, #map, #reduce, #reduce_while, #reject, #take, #take_until, #take_while, #to_a, #zip, #zip_as_ary
Methods included from Utility
#__segment__, #segment, #with_index
Instance Method Details
#append(other) ⇒ Object
Also known as:
+
22
23
24
25
26
|
# File 'lib/lab42/stream/empty.rb', line 22
def append other
raise ArgumentError, "not a stream #{other}" unless self.class.superclass === other
other.to_stream
end
|
#empty? ⇒ Boolean
29
|
# File 'lib/lab42/stream/empty.rb', line 29
def empty?; true end
|
#head ⇒ Object
32
|
# File 'lib/lab42/stream/empty.rb', line 32
def head; raise StopIteration, "head called on empty stream" end
|
#inject(*args) ⇒ Object
Also known as:
__inject__
36
|
# File 'lib/lab42/stream/empty.rb', line 36
def inject *args; args.first end
|
#itself(*args, &blk) ⇒ Object
TODO: Move this into lab42/core as Object#itself
40
|
# File 'lib/lab42/stream/empty.rb', line 40
def itself *args, &blk; self end
|
#scan(initial, *args, &blk) ⇒ Object
42
43
44
|
# File 'lib/lab42/stream/empty.rb', line 42
def scan initial, *args, &blk
[initial]
end
|
#scan1(*args, &blk) ⇒ Object
46
47
48
|
# File 'lib/lab42/stream/empty.rb', line 46
def scan1 *args, &blk
[]
end
|
#tail ⇒ Object
33
|
# File 'lib/lab42/stream/empty.rb', line 33
def tail; raise StopIteration, "tail called on empty stream" end
|