Class: BunnyBurrow::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/bunny_burrow/base.rb

Direct Known Subclasses

Client, Server

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize {|_self| ... } ⇒ Base

Returns a new instance of Base.

Yields:

  • (_self)

Yield Parameters:



27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/bunny_burrow/base.rb', line 27

def initialize
  @log_request = false
  @log_response = false
  @timeout = 60
  @verify_peer = true
  @own_connection = true

  yield self if block_given?

  @connection = @rabbitmq_connection
  @own_connection = @connection.nil?
end

Instance Attribute Details

#log_prefixObject

Returns the value of attribute log_prefix.



11
12
13
# File 'lib/bunny_burrow/base.rb', line 11

def log_prefix
  @log_prefix
end

#log_requestObject Also known as: log_request?

Returns the value of attribute log_request.



11
12
13
# File 'lib/bunny_burrow/base.rb', line 11

def log_request
  @log_request
end

#log_responseObject Also known as: log_response?

Returns the value of attribute log_response.



11
12
13
# File 'lib/bunny_burrow/base.rb', line 11

def log_response
  @log_response
end

#loggerObject

Returns the value of attribute logger.



11
12
13
# File 'lib/bunny_burrow/base.rb', line 11

def logger
  @logger
end

#rabbitmq_connectionObject

Returns the value of attribute rabbitmq_connection.



11
12
13
# File 'lib/bunny_burrow/base.rb', line 11

def rabbitmq_connection
  @rabbitmq_connection
end

#rabbitmq_exchangeObject

Returns the value of attribute rabbitmq_exchange.



11
12
13
# File 'lib/bunny_burrow/base.rb', line 11

def rabbitmq_exchange
  @rabbitmq_exchange
end

#rabbitmq_urlObject

Returns the value of attribute rabbitmq_url.



11
12
13
# File 'lib/bunny_burrow/base.rb', line 11

def rabbitmq_url
  @rabbitmq_url
end

#timeoutObject

Returns the value of attribute timeout.



11
12
13
# File 'lib/bunny_burrow/base.rb', line 11

def timeout
  @timeout
end

#verify_peerObject Also known as: verify_peer?

Returns the value of attribute verify_peer.



11
12
13
# File 'lib/bunny_burrow/base.rb', line 11

def verify_peer
  @verify_peer
end

Instance Method Details

#shutdownObject



40
41
42
43
44
45
46
# File 'lib/bunny_burrow/base.rb', line 40

def shutdown
  return if @shutdown
  log 'Shutting down'
  channel.close
  connection.close if @own_connection
  @shutdown = true
end