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.



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

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'
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

#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

#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



20
21
22
23
24
25
# File 'lib/thrifty_bunny/config.rb', line 20

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