Sha256: 2a0792beb837e0eccceab2264703af7f5cf02d8bbe8299c3155c2ee3274c97a5

Contents?: true

Size: 451 Bytes

Versions: 22

Compression:

Stored size: 451 Bytes

Contents

module Fluffle
  module Connectable
    def self.included(klass)
      klass.class_eval do
        attr_reader :connection
      end
    end

    def connect(*args)
      self.stop if self.connected?

      @connection =
        if args.first.is_a? Bunny::Session
          args.first
        else
          Bunny.new *args
        end

      @connection.start
    end

    def connected?
      @connection && @connection.connected?
    end
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
fluffle-1.1.0 lib/fluffle/connectable.rb
fluffle-1.0.1 lib/fluffle/connectable.rb
fluffle-1.0.0 lib/fluffle/connectable.rb
fluffle-0.9.1 lib/fluffle/connectable.rb
fluffle-0.9.0 lib/fluffle/connectable.rb
fluffle-0.8.1 lib/fluffle/connectable.rb
fluffle-0.8.0 lib/fluffle/connectable.rb
fluffle-0.7.2 lib/fluffle/connectable.rb
fluffle-0.7.1 lib/fluffle/connectable.rb
fluffle-0.7.0 lib/fluffle/connectable.rb
fluffle-0.6.3 lib/fluffle/connectable.rb
fluffle-0.6.2 lib/fluffle/connectable.rb
fluffle-0.6.1 lib/fluffle/connectable.rb
fluffle-0.6.0 lib/fluffle/connectable.rb
fluffle-0.5.2 lib/fluffle/connectable.rb
fluffle-0.5.1 lib/fluffle/connectable.rb
fluffle-0.5.0 lib/fluffle/connectable.rb
fluffle-0.4.0 lib/fluffle/connectable.rb
fluffle-0.3.1 lib/fluffle/connectable.rb
fluffle-0.3.0 lib/fluffle/connectable.rb