Class: Concurrent::Channel::Selector::TakeClause
Relationships & Source Files | |
Inherits: | Object |
Defined in: | lib/concurrent-ruby-edge/concurrent/channel/selector/take_clause.rb |
Class Method Summary
- .new(channel, block) ⇒ TakeClause constructor
Instance Method Summary
Constructor Details
.new(channel, block) ⇒ TakeClause
# File 'lib/concurrent-ruby-edge/concurrent/channel/selector/take_clause.rb', line 9
def initialize(channel, block) @channel = channel @block = block end
Instance Method Details
#execute
[ GitHub ]# File 'lib/concurrent-ruby-edge/concurrent/channel/selector/take_clause.rb', line 14
def execute if (result = @channel.poll?).just? Concurrent::Maybe.just(@block.call(result.value)) else Concurrent::Maybe.nothing end end