class Stream(T)

Included Modules

Defined in:

sys/stream.cr

Instance Method Summary

Instance Method Detail

def all(between a : Stream(M), and b : Stream(K), now = false) forall M, K #

Pumps objects from this stream to the returned stream when a receives an object, and stops pumping when b receives a value.


[View source]
def each(&func : T -> ) #

Calls func before pumping an object unchanged.


[View source]
def except(&func : T -> Bool) #

Pumps only those objects for which func returns false.


[View source]
def except(pattern) #

Pumps only those objects that do not match against pattern (using ===).


[View source]
def map(&func : T -> U) forall U #

Pumps an object transformed by func.


[View source]
def pump(sender, object : T) #

Pumps object to listening streams.


[View source]
def pump(sender, object) : NoReturn #

Pumps object to listening streams.


[View source]
def pump(object : T) #

Pumps object to listening streams.


[View source]
def sub(listener : BaseStream) : BaseStream #

Subscribes listener to events in this stream.


[View source]
def uniq(&func : T -> U) forall U #

Pumps only if the result of func over the pumped object is not equal (==) to its previous result.

The first pumped object is always pumped.


[View source]
def uniq #

Pumps only if the pumped object is not equal to the previous pumped object.


[View source]
def unsub(listener : BaseStream) #

Un-subscribes listener from events in this stream.


[View source]
def when(&func : T -> Bool) #

Pumps only those objects for which func returns true.


[View source]
def when(type : U.class) forall U #

Pumps only those objects that are of the given type.


[View source]
def when(pattern) #

Pumps only those objects that match against pattern (using ===).


[View source]