Class: MultipleMan::Connection
- Inherits:
-
Object
- Object
- MultipleMan::Connection
- Defined in:
- lib/multiple_man/connection.rb
Instance Attribute Summary collapse
-
#topic ⇒ Object
readonly
Returns the value of attribute topic.
Class Method Summary collapse
Instance Method Summary collapse
- #close! ⇒ Object
-
#initialize ⇒ Connection
constructor
A new instance of Connection.
- #topic_name ⇒ Object
Constructor Details
#initialize ⇒ Connection
Returns a new instance of Connection.
16 17 18 19 20 |
# File 'lib/multiple_man/connection.rb', line 16 def initialize init_connection! init_channel! self.topic = channel.topic(topic_name) end |
Instance Attribute Details
#topic ⇒ Object
Returns the value of attribute topic.
14 15 16 |
# File 'lib/multiple_man/connection.rb', line 14 def topic @topic end |
Class Method Details
.connect ⇒ Object
7 8 9 10 11 12 |
# File 'lib/multiple_man/connection.rb', line 7 def self.connect connection = new yield connection if block_given? ensure connection.close! if connection end |
Instance Method Details
#close! ⇒ Object
26 27 28 29 |
# File 'lib/multiple_man/connection.rb', line 26 def close! channel.close if channel connection.close if connection end |
#topic_name ⇒ Object
22 23 24 |
# File 'lib/multiple_man/connection.rb', line 22 def topic_name MultipleMan.configuration.topic_name end |