Sha256: d60cb3b6588db4c8c0f4c84fd5ca96f7a438f960dd447e5d828ea7eb6061307c
Contents?: true
Size: 1.02 KB
Versions: 2
Compression:
Stored size: 1.02 KB
Contents
$:.unshift File.expand_path(File.dirname(File.expand_path(__FILE__))) require 'amqp/spec' require 'amqp/buffer' require 'amqp/exchange' require 'amqp/frame' require 'amqp/header' require 'amqp/queue' require 'amqp/server' require 'amqp/protocol' class Carrot @logging = false class << self attr_accessor :logging end def self.logging? @logging end class Error < StandardError; end def self.queue(name, opts = {}) instance(opts).queue(name, opts) end def self.stop instance.stop end def self.instance(opts = {}) @instance ||= new(opts) end def initialize(opts = {}) @server = AMQP::Server.new(opts) end def queue(name, opts = {}) queues[name] ||= AMQP::Queue.new(@server, name, opts) end def stop @server.close end def queues @queues ||= {} end def send_data(data) @server.send_data(data) end def send_command(cmd) @server.send_command(cmd) end private def log(*args) return unless Carrot.logging? pp args puts end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
famoseagle-carrot-0.1.0 | lib/carrot.rb |
famoseagle-carrot-0.2.0 | lib/carrot.rb |