lib/amqp.rb in amqp-0.5.5 vs lib/amqp.rb in amqp-0.5.9

- old
+ new

@@ -1,7 +1,7 @@ module AMQP - VERSION = '0.5.5' + VERSION = '0.5.9' DIR = File.expand_path(File.dirname(File.expand_path(__FILE__))) $:.unshift DIR require 'ext/em' @@ -12,21 +12,33 @@ end class << self @logging = false attr_accessor :logging + attr_reader :conn + alias :connection :conn end def self.connect *args Client.connect *args end def self.settings @settings ||= { + # server address + :host => '127.0.0.1', + :port => PORT, + + # login details :user => 'guest', :pass => 'guest', :vhost => '/', + + # connection timeout + :timeout => nil, + + # logging :logging => false } end def self.start *args @@ -38,7 +50,15 @@ @conn.close{ yield if block_given? @conn = nil } end + end + + def self.run *args + EM.run{ + AMQP.start(*args).callback{ + yield + } + } end end \ No newline at end of file