Module: Fluffle::Connectable

Included in:
Client
Defined in:
lib/fluffle/connectable.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(klass) ⇒ Object



3
4
5
6
7
# File 'lib/fluffle/connectable.rb', line 3

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

Instance Method Details

#connect(*args) ⇒ Object



9
10
11
12
13
14
# File 'lib/fluffle/connectable.rb', line 9

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

  @connection = Bunny.new *args
  @connection.start
end

#connected?Boolean

Returns:

  • (Boolean)


16
17
18
# File 'lib/fluffle/connectable.rb', line 16

def connected?
  @connection&.connected?
end