Class: Qswarm::Speakers::Nc

Inherits:
Qswarm::Speaker show all
Defined in:
lib/qswarm/speakers/nc.rb

Constant Summary collapse

@@connections =
{}

Instance Attribute Summary

Attributes inherited from Qswarm::Speaker

#agent, #heard, #metadata, #name

Instance Method Summary collapse

Methods inherited from Qswarm::Speaker

#arg, #bind, #get_broker, #initialize, #log, #parse

Methods included from DSL

#dsl_accessor

Methods included from Loggable

#logger, logger

Constructor Details

This class inherits a constructor from Qswarm::Speaker

Instance Method Details

#inject(format = :text, msg) ⇒ Object



6
7
8
# File 'lib/qswarm/speakers/nc.rb', line 6

def inject(format = :text, msg)
  publish format, msg
end

#runObject



10
11
12
13
14
15
16
17
18
# File 'lib/qswarm/speakers/nc.rb', line 10

def run
  @name.match(/([^#]*):(\d+)/) do
    @host = $1.empty? ? 'localhost' : $1
    @port = $2
    @server = @host + ':' + @port
    # @service = $3
  end
  connect
end