Sha256: c7c3c41ef25642e99111d9f23ac0c4e1bb83c42d56ca8196f17a05d51dda42f2

Contents?: true

Size: 512 Bytes

Versions: 19

Compression:

Stored size: 512 Bytes

Contents

require 'concurrent/maybe'

module Concurrent
  class Channel
    class Selector

      class PutClause

        def initialize(channel, message, block)
          @channel = channel
          @message = message
          @block = block
        end

        def execute
          if @channel.offer?(@message).just?
            result = @block ? @block.call : nil
            Concurrent::Maybe.just(result)
          else
            Concurrent::Maybe.nothing
          end
        end
      end
    end
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
concurrent-ruby-edge-0.7.1 lib/concurrent-ruby-edge/concurrent/channel/selector/put_clause.rb
concurrent-ruby-edge-0.7.0 lib/concurrent-ruby-edge/concurrent/channel/selector/put_clause.rb
concurrent-ruby-edge-0.6.0 lib/concurrent-ruby-edge/concurrent/channel/selector/put_clause.rb
concurrent-ruby-edge-0.6.0.pre1 lib/concurrent-ruby-edge/concurrent/channel/selector/put_clause.rb
concurrent-ruby-edge-0.5.0 lib-edge/concurrent/channel/selector/put_clause.rb
concurrent-ruby-edge-0.4.1 lib-edge/concurrent/channel/selector/put_clause.rb
concurrent-ruby-edge-0.4.0.pre2 lib-edge/concurrent/channel/selector/put_clause.rb
concurrent-ruby-edge-0.4.0.pre1 lib-edge/concurrent/channel/selector/put_clause.rb
concurrent-ruby-edge-0.2.4 lib/concurrent/channel/selector/put_clause.rb
concurrent-ruby-edge-0.3.1 lib/concurrent/channel/selector/put_clause.rb
concurrent-ruby-edge-0.3.0 lib/concurrent/channel/selector/put_clause.rb
concurrent-ruby-edge-0.2.3 lib/concurrent/channel/selector/put_clause.rb
concurrent-ruby-edge-0.2.3.pre3 lib/concurrent/channel/selector/put_clause.rb
concurrent-ruby-edge-0.2.2 lib/concurrent/channel/selector/put_clause.rb
concurrent-ruby-edge-0.2.1 lib/concurrent/channel/selector/put_clause.rb
concurrent-ruby-edge-0.2.0 lib/concurrent/channel/selector/put_clause.rb
concurrent-ruby-edge-0.2.0.pre5 lib/concurrent/channel/selector/put_clause.rb
concurrent-ruby-edge-0.2.0.pre4 lib/concurrent/channel/selector/put_clause.rb
concurrent-ruby-edge-0.2.0.pre3 lib/concurrent/channel/selector/put_clause.rb