Class: IRuby::SessionAdapter::PyzmqAdapter

Inherits:
BaseAdapter
  • Object
show all
Defined in:
lib/iruby/session_adapter/pyzmq_adapter.rb

Class Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseAdapter

available?, #initialize, #make_rep_socket, #name

Constructor Details

This class inherits a constructor from IRuby::SessionAdapter::BaseAdapter

Class Attribute Details

.zmqObject (readonly)

Returns the value of attribute zmq.



12
13
14
# File 'lib/iruby/session_adapter/pyzmq_adapter.rb', line 12

def zmq
  @zmq
end

Class Method Details

.load_requirementsObject



4
5
6
7
8
9
# File 'lib/iruby/session_adapter/pyzmq_adapter.rb', line 4

def self.load_requirements
  require 'pycall'
  @zmq = PyCall.import_module('zmq')
rescue PyCall::PyError => error
  raise LoadError, error.message
end

Instance Method Details

#heartbeat_loop(sock) ⇒ Object



27
28
29
30
31
32
# File 'lib/iruby/session_adapter/pyzmq_adapter.rb', line 27

def heartbeat_loop(sock)
  PyCall.sys.path.append(File.expand_path('../pyzmq', __FILE__))
  heartbeat = PyCall.import_module('iruby.heartbeat')
  @heartbeat_thread = heartbeat.Heartbeat.new(sock)
  @heartbeat_thread.start
end

#make_pub_socket(protocol, host, port) ⇒ Object



19
20
21
# File 'lib/iruby/session_adapter/pyzmq_adapter.rb', line 19

def make_pub_socket(protocol, host, port)
  make_socket(:PUB, protocol, host, port)
end

#make_router_socket(protocol, host, port) ⇒ Object



15
16
17
# File 'lib/iruby/session_adapter/pyzmq_adapter.rb', line 15

def make_router_socket(protocol, host, port)
  make_socket(:ROUTER, protocol, host, port)
end