Class: Qswarm::Speakers::Mysql

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

Constant Summary collapse

@@db_servers =
{}

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



8
9
10
11
# File 'lib/qswarm/speakers/mysql.rb', line 8

def inject(format = :text, msg)
  logger.debug "[#{@agent.name}] Sending '#{msg}' to channel #{@name}"
  publish format, @name, msg
end

#runObject



13
14
15
# File 'lib/qswarm/speakers/mysql.rb', line 13

def run
  @name.match(/([^#]*)(#.+)/) { db_connect $1.empty? ? 'localhost' : $1, $2 }
end