class Symbol

Public Instance Methods

sym <= trans → new_trans click to toggle source
sym <= enum → new_enum

Equivalent to sym.to_trans <= trans/enum, except that it uses a more efficient implementation.

# File lib/coroutines/operators.rb, line 85
def <=(source)
        to_proc <= source
end
sym >= trans → new_trans click to toggle source
sym >= sink → new_consumer

Equivalent to sym.to_trans >= trans/sink, except that it uses a more efficient implementation.

# File lib/coroutines/operators.rb, line 95
def >=(sink)
        to_proc >= sink
end
to_trans → transformer click to toggle source

Allows implicit conversion of Symbol to Transformer. The transformer accepts any objects as input, calls the method given by sym on each and outputs all non-nil results of the method. See Proc#to_trans for details.

example:

collector = [] <= :to_s
collector << 1 << 4 << 9
collector.close # => ["1", "4", "9"]
# File lib/coroutines/operators.rb, line 70
def to_trans
        Transformer.new do |y|
                loop do
                        value = y.await.send self
                        y.yield value unless value.nil?
                end
        end
end