Class: Bundesstrasse::QueueDevice

Inherits:
Device
  • Object
show all
Defined in:
lib/bundesstrasse/devices.rb

Instance Attribute Summary collapse

Attributes inherited from Device

#backend, #frontend

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Device

#start

Methods included from Errors

#errno, #error_check, #error_string

Constructor Details

#initialize(context, frontend, backend) ⇒ QueueDevice

Returns a new instance of QueueDevice.



4
5
6
7
# File 'lib/bundesstrasse/devices.rb', line 4

def initialize(context, frontend, backend)
  super(ZMQ::QUEUE, frontend, backend)
  @context = context
end

Instance Attribute Details

#contextObject (readonly)

Returns the value of attribute context.



3
4
5
# File 'lib/bundesstrasse/devices.rb', line 3

def context
  @context
end

Class Method Details

.create(context) ⇒ Object



13
14
15
16
17
# File 'lib/bundesstrasse/devices.rb', line 13

def self.create(context)
  frontend = context.socket(ZMQ::ROUTER)
  backend = context.socket(ZMQ::DEALER)
  new(context, frontend, backend)
end

Instance Method Details

#create_endpoint!(options = {}) ⇒ Object



9
10
11
# File 'lib/bundesstrasse/devices.rb', line 9

def create_endpoint!(options={})
  @context.socket(ZMQ::REP, options)
end