Class: ThriftyBunny::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/thrifty_bunny/config.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Config

Returns a new instance of Config.



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/thrifty_bunny/config.rb', line 8

def initialize(options={})
  @host = options[:host] || '127.0.0.1'
  @port = options[:port] || 5672

  @vhost = options[:vhost] || "/"
  @user = options[:user] || "guest"
  @password = options[:password] || "guest"
  @ssl = options[:ssl] || false

  @queue = options[:queue] || 'rpc_queue'
  @exchange = options[:exchange] || 'rpc_exchange'

  @timeout = options[:timeout] || 30 # seconds
  @log = options[:log].nil? ? true : options[:log]
end

Instance Attribute Details

#exchangeObject (readonly)

Returns the value of attribute exchange.



5
6
7
# File 'lib/thrifty_bunny/config.rb', line 5

def exchange
  @exchange
end

#hostObject (readonly)

Returns the value of attribute host.



5
6
7
# File 'lib/thrifty_bunny/config.rb', line 5

def host
  @host
end

#logObject (readonly)

Returns the value of attribute log.



5
6
7
# File 'lib/thrifty_bunny/config.rb', line 5

def log
  @log
end

#passwordObject (readonly)

Returns the value of attribute password.



5
6
7
# File 'lib/thrifty_bunny/config.rb', line 5

def password
  @password
end

#portObject (readonly)

Returns the value of attribute port.



5
6
7
# File 'lib/thrifty_bunny/config.rb', line 5

def port
  @port
end

#queueObject (readonly)

Returns the value of attribute queue.



5
6
7
# File 'lib/thrifty_bunny/config.rb', line 5

def queue
  @queue
end

#sslObject (readonly)

Returns the value of attribute ssl.



5
6
7
# File 'lib/thrifty_bunny/config.rb', line 5

def ssl
  @ssl
end

#timeoutObject (readonly)

Returns the value of attribute timeout.



5
6
7
# File 'lib/thrifty_bunny/config.rb', line 5

def timeout
  @timeout
end

#userObject (readonly)

Returns the value of attribute user.



5
6
7
# File 'lib/thrifty_bunny/config.rb', line 5

def user
  @user
end

#vhostObject (readonly)

Returns the value of attribute vhost.



5
6
7
# File 'lib/thrifty_bunny/config.rb', line 5

def vhost
  @vhost
end

Instance Method Details

#bunny_configObject



24
25
26
27
28
29
# File 'lib/thrifty_bunny/config.rb', line 24

def bunny_config
  { 
    host: host, port: port, vhost: vhost,
    user: user, password: password, ssl: ssl
  }
end