Sha256: 1558a3bc1e2f44cb0251592390f9b50568720c2e9757c39e4b331e2dc7fee4de

Contents?: true

Size: 405 Bytes

Versions: 3

Compression:

Stored size: 405 Bytes

Contents

module Buster
  class Context

    attr_accessor :context

    def initialize(context)
      @context = context
      @sockets = []
    end

    def socket(type)
      socket = @context.socket(type)
      @sockets << socket
      socket
    end

    def terminate
      @sockets.reverse.each do |s|
        s.setsockopt(ZMQ::LINGER, 0)
        s.close
      end
      @context.terminate
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
buster-0.1.3 lib/buster/context.rb
buster-0.1.2 lib/buster/context.rb
buster-0.1.1 lib/buster/context.rb