Sha256: 0219f5ecf4ac26c25cb20696208e718fdc8b10bdc4200ed59295af5827d8d216
Contents?: true
Size: 731 Bytes
Versions: 2
Compression:
Stored size: 731 Bytes
Contents
require 'aggro/nanomsg_transport/publish' module Aggro module NanomsgTransport # Public: Handles publishing messages on a given endpoint. class Publisher def initialize(endpoint) ObjectSpace.define_finalizer self, method(:close_socket) @endpoint = endpoint end def close_socket pub_socket.terminate if @open @pub_socket = nil @open = false end def open_socket return @pub_socket if @open @open = true @pub_socket = Publish.new(@endpoint) end def publish(message) pub_socket.send_msg message end private def pub_socket @pub_socket || open_socket end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
aggro-0.0.3 | lib/aggro/nanomsg_transport/publisher.rb |
aggro-0.0.2 | lib/aggro/nanomsg_transport/publisher.rb |