Class: Concurrent::Channel::Selector::PutClause
- Inherits:
-
Object
- Object
- Concurrent::Channel::Selector::PutClause
- Defined in:
- lib-edge/concurrent/channel/selector/put_clause.rb
Instance Method Summary collapse
- #execute ⇒ undocumented
-
#initialize(channel, message, block) ⇒ PutClause
constructor
A new instance of PutClause.
Constructor Details
#initialize(channel, message, block) ⇒ PutClause
Returns a new instance of PutClause
9 10 11 12 13 |
# File 'lib-edge/concurrent/channel/selector/put_clause.rb', line 9 def initialize(channel, , block) @channel = channel @message = @block = block end |
Instance Method Details
#execute ⇒ undocumented
15 16 17 18 19 20 21 22 |
# File 'lib-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 |