Class: Rodent::Server
- Inherits:
-
Object
- Object
- Rodent::Server
- Defined in:
- lib/rodent/server.rb
Class Attribute Summary collapse
-
.settings ⇒ Object
Returns the value of attribute settings.
Class Method Summary collapse
Class Attribute Details
.settings ⇒ Object
Returns the value of attribute settings.
6 7 8 |
# File 'lib/rodent/server.rb', line 6 def settings @settings end |
Class Method Details
.configure(&block) ⇒ Object
8 9 10 11 |
# File 'lib/rodent/server.rb', line 8 def configure(&block) @settings ||= {} yield end |
.run(&block) ⇒ Object
17 18 19 20 21 22 23 |
# File 'lib/rodent/server.rb', line 17 def run(&block) EM.run do AMQP.connection ||= AMQP.connect(settings[:connection]) block.call.each(&:bind) end end |
.set(attr, value) ⇒ Object
13 14 15 |
# File 'lib/rodent/server.rb', line 13 def set(attr, value) settings[attr] = value end |
.stop ⇒ Object
25 26 27 |
# File 'lib/rodent/server.rb', line 25 def stop AMQP.connection.close { EM.stop } end |