Class: JRL::Channel
- Inherits:
-
SimpleDelegator
- Object
- SimpleDelegator
- JRL::Channel
- Defined in:
- lib/jretlang/channel.rb
Instance Method Summary collapse
-
#initialize ⇒ Channel
constructor
A new instance of Channel.
- #subscribe_on_fiber(fiber, &block) ⇒ Object
- #subscribe_on_fiber_with_batch(fiber, time, time_unit = JRL::Concurrent::TimeUnit::SECONDS, &block) ⇒ Object
- #subscribe_on_fiber_with_batch_and_key(fiber, key_lambda, time, time_unit = JRL::Concurrent::TimeUnit::SECONDS, &block) ⇒ Object
- #subscribe_on_fiber_with_filter(fiber, filter_lambda, &block) ⇒ Object
Constructor Details
Instance Method Details
#subscribe_on_fiber(fiber, &block) ⇒ Object
7 8 9 |
# File 'lib/jretlang/channel.rb', line 7 def subscribe_on_fiber( fiber, &block ) @mc.subscribe( strip_delegate( fiber ), &block ) end |
#subscribe_on_fiber_with_batch(fiber, time, time_unit = JRL::Concurrent::TimeUnit::SECONDS, &block) ⇒ Object
16 17 18 19 |
# File 'lib/jretlang/channel.rb', line 16 def subscribe_on_fiber_with_batch( fiber, time, time_unit=JRL::Concurrent::TimeUnit::SECONDS, &block ) batch = JRL::Channels::BatchSubscriber.new( strip_delegate( fiber ), block, time, time_unit ) @mc.subscribe( batch ) end |
#subscribe_on_fiber_with_batch_and_key(fiber, key_lambda, time, time_unit = JRL::Concurrent::TimeUnit::SECONDS, &block) ⇒ Object
21 22 23 24 |
# File 'lib/jretlang/channel.rb', line 21 def subscribe_on_fiber_with_batch_and_key( fiber, key_lambda, time, time_unit=JRL::Concurrent::TimeUnit::SECONDS, &block ) batch = JRL::Channels::KeyedBatchSubscriber.new( strip_delegate( fiber ), block, time, time_unit, key_lambda ) @mc.subscribe( batch ) end |
#subscribe_on_fiber_with_filter(fiber, filter_lambda, &block) ⇒ Object
11 12 13 14 |
# File 'lib/jretlang/channel.rb', line 11 def subscribe_on_fiber_with_filter( fiber, filter_lambda, &block ) subscription = JRL::Channels::ChannelSubscription.new( strip_delegate( fiber ), block, filter_lambda ) @mc.subscribe( subscription ) end |