Class: Cottontail::Consumer::Session
- Inherits:
-
Object
- Object
- Cottontail::Consumer::Session
- Defined in:
- lib/cottontail/consumer/session.rb
Overview
:nodoc:
Instance Method Summary collapse
-
#initialize(consumer) ⇒ Session
constructor
A new instance of Session.
- #start ⇒ Object
- #stop ⇒ Object
Constructor Details
#initialize(consumer) ⇒ Session
Returns a new instance of Session.
6 7 8 9 10 |
# File 'lib/cottontail/consumer/session.rb', line 6 def initialize(consumer) @consumer = consumer , @block = @consumer.config.get(:session) @session = nil end |
Instance Method Details
#start ⇒ Object
12 13 14 15 16 17 18 19 |
# File 'lib/cottontail/consumer/session.rb', line 12 def start stop unless @session.nil? @session = Bunny.new() @session.start @consumer.instance_exec(@consumer, @session, &@block) end |
#stop ⇒ Object
21 22 23 24 |
# File 'lib/cottontail/consumer/session.rb', line 21 def stop @session.stop if @session.respond_to?(:stop) @session = nil end |