NOTE: This file is rather a temporary hack to fix github.com/ruby-amqp/bunny/issues/9 then some permanent solution. It's mostly copied from the AMQP and AMQ Client gems. Later on we should use AMQ Client directly and just inherit from the AMQ::Client::Sync::Consumer class.
if we don't require the version file the same way as in the gemspec, the version file will be loaded twice. and we hate warnings.
Print deprecation warning.
# File lib/bunny.rb, line 29 def self.deprecation_warning(method, version, explanation) warn "~ #{method} will be removed in Bunny #{version}. #{explanation}" end
Instantiates new Bunny::Client
# File lib/bunny.rb, line 35 def self.new(connection_string_or_opts = Hash.new, opts = Hash.new) # Set up Bunny if connection_string_or_opts.respond_to?(:keys) && opts.empty? opts = connection_string_or_opts end # Return client setup(connection_string_or_opts, opts) end
Runs a code block using a Bunny connection
# File lib/bunny.rb, line 46 def self.run(connection_string_or_opts = {}, opts = {}, &block) raise ArgumentError, 'Bunny#run requires a block' unless block # Set up Bunny client = setup(connection_string_or_opts, opts) begin client.start block.call(client) ensure client.stop end # Return success :run_ok end
Returns the Bunny version number
# File lib/bunny.rb, line 24 def self.version VERSION end
Generated with the Darkfish Rdoc Generator 2.