Sha256: 851f8d6f8065cf58862d3b681d7e2c2987d1d64c6c25db8c0940f0eaafe573ff

Contents?: true

Size: 446 Bytes

Versions: 20

Compression:

Stored size: 446 Bytes

Contents

require 'concurrent/maybe'

module Concurrent
  class Channel
    class Selector

      class TakeClause

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

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

Version data entries

20 entries across 20 versions & 1 rubygems

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