Class: Elevate::Channel Private

Inherits:
Object
  • Object
show all
Defined in:
lib/elevate/channel.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

A simple unidirectional stream of data with a single consumer.

Instance Method Summary collapse

Constructor Details

#initialize(block) ⇒ Channel

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Channel.



6
7
8
# File 'lib/elevate/channel.rb', line 6

def initialize(block)
  @target = block
end

Instance Method Details

#<<(obj) ⇒ void

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

This method returns an undefined value.

Pushes data to consumers immediately



15
16
17
# File 'lib/elevate/channel.rb', line 15

def <<(obj)
  @target.call(obj)
end