Class: Bunnicula::Rabbit
- Extended by:
- DslBase
- Defined in:
- lib/bunnicula/rabbit.rb
Direct Known Subclasses
Instance Method Summary collapse
-
#initialize(constr = nil) ⇒ Rabbit
constructor
A new instance of Rabbit.
- #to_h ⇒ Object
Methods included from DslBase
Constructor Details
#initialize(constr = nil) ⇒ Rabbit
Returns a new instance of Rabbit.
13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/bunnicula/rabbit.rb', line 13 def initialize(constr=nil) return unless constr if (constr =~ /amqp:\/\//) uri = URI.parse(constr) host uri.host port uri.port || 5672 username uri.user || "guest" password uri.password || "guest" vhost uri.path.strip.length < 1 ? "/" : uri.path else host(constr) end end |
Instance Method Details
#to_h ⇒ Object
27 28 29 30 31 32 33 34 35 |
# File 'lib/bunnicula/rabbit.rb', line 27 def to_h { :host=>host, :port=>port, :username=>username, :password=>password, :vhost=>vhost } end |