Class: Hope::Source::Sub
Instance Attribute Summary collapse
-
#received ⇒ Object
readonly
Returns the value of attribute received.
Attributes inherited from Base
Instance Method Summary collapse
-
#initialize(name, opts = {}) ⇒ Sub
constructor
A new instance of Sub.
- #on_readable(socket, messages) ⇒ Object
Methods inherited from Base
event_types, #parse, #serializable_hash, #to_json
Constructor Details
#initialize(name, opts = {}) ⇒ Sub
Returns a new instance of Sub.
7 8 9 10 11 12 13 14 15 |
# File 'lib/hope/source/sub.rb', line 7 def initialize name, opts={} @name = name @socket = opts["socket"] || "ipc://hope" @event_type = opts["event_type"] @received = { :success => 0, :errors => 0, :latest_error => "" } @sub = Hope.ctx.connect ZMQ::SUB, @socket, self @sub.subscribe name Hope::Source.register self end |
Instance Attribute Details
#received ⇒ Object (readonly)
Returns the value of attribute received.
5 6 7 |
# File 'lib/hope/source/sub.rb', line 5 def received @received end |