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