Sha256: 35bd810013371224eb01f2e06c6dbc707b2e9c442715553763f7d7a62f98f698

Contents?: true

Size: 448 Bytes

Versions: 1

Compression:

Stored size: 448 Bytes

Contents

begin
  require 'fiber'
rescue LoadError
  require 'riak/util/fiber1.8'
end

module Riak
  class Client
    # @private
    class Pump      
      def initialize(block)
        @fiber = Fiber.new do
          loop do
            block.call Fiber.yield
          end
        end
        @fiber.resume
      end

      def pump(input)
        @fiber.resume input
      end

      def to_proc
        method(:pump).to_proc
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
seomoz-riak-client-1.0.0.pre lib/riak/client/pump.rb