Sha256: 2ed7c8d6baf9a5e042178aa5cc52399500dd182de1de0b2a862b2e446c7aab2d
Contents?: true
Size: 586 Bytes
Versions: 2
Compression:
Stored size: 586 Bytes
Contents
class FnordMetric::InboundDatagram < EventMachine::Connection class << self attr_accessor :opts end def self.start(opts) self.opts = opts EM.open_datagram_socket(*(opts[:inbound_stream] << self << opts)) end def receive_data(event) events << event push_next_event end def push_next_event return true if events.empty? api.event(@events.pop) EM.next_tick(&method(:push_next_event)) end def unbind api.disconnect end def api @api ||= FnordMetric::API.new(self.class.opts) end def events @events ||= [] end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
fnordmetric-0.7.5 | lib/fnordmetric/inbound_datagram.rb |
fnordmetric-0.7.4 | lib/fnordmetric/inbound_datagram.rb |