Sha256: 42feaf80a60b211708394e6ab64ff3ddfad42aa62ed310501cbf789092d9e1b0

Contents?: true

Size: 783 Bytes

Versions: 2

Compression:

Stored size: 783 Bytes

Contents

require 'ffi-rzmq'

require 'celluloid/io'
require 'celluloid/zmq/mailbox'
require 'celluloid/zmq/reactor'
require 'celluloid/zmq/version'
require 'celluloid/zmq/waker'

module Celluloid
  # Actors which run alongside 0MQ sockets
  module ZMQ
    class << self
      attr_writer :context

      # Included hook to pull in Celluloid
      def included(klass)
        klass.send :include, ::Celluloid
        klass.use_mailbox Celluloid::ZMQ::Mailbox
      end

      # Obtain a 0MQ context (or lazily initialize it)
      def context
        @context ||= ::ZMQ::Context.new(1)
      end
    end

    extend Forwardable

    # Wait for the given IO object to become readable/writeable
    def_delegators 'current_actor.mailbox.reactor',
      :wait_readable, :wait_writeable
  end
end

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
dcell-0.8.0 celluloid-zmq/lib/celluloid/zmq.rb
celluloid-zmq-0.8.0 lib/celluloid/zmq.rb