Class: Converse::Conversation
- Inherits:
-
Object
- Object
- Converse::Conversation
- Defined in:
- lib/converse/comms/conversation.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#body ⇒ Object
Returns the value of attribute body.
-
#connection ⇒ Object
Returns the value of attribute connection.
-
#headers ⇒ Object
Returns the value of attribute headers.
-
#host ⇒ Object
Returns the value of attribute host.
-
#path ⇒ Object
Returns the value of attribute path.
-
#port ⇒ Object
Returns the value of attribute port.
-
#request ⇒ Object
Returns the value of attribute request.
-
#response ⇒ Object
Returns the value of attribute response.
-
#subscribers ⇒ Object
Returns the value of attribute subscribers.
-
#uri ⇒ Object
Returns the value of attribute uri.
Instance Method Summary collapse
- #ask ⇒ Object
-
#initialize(uri) ⇒ Conversation
constructor
A new instance of Conversation.
- #notify_subscribers(data) ⇒ Object
- #say ⇒ Object
- #subscribe(subscriber) ⇒ Object
Constructor Details
#initialize(uri) ⇒ Conversation
Returns a new instance of Conversation.
14 15 16 17 18 19 20 21 |
# File 'lib/converse/comms/conversation.rb', line 14 def initialize(uri) @uri = uri parsed = URI.parse(uri) @host = parsed.host @port = parsed.port @path = parsed.path @subscribers = [] end |
Instance Attribute Details
#body ⇒ Object
Returns the value of attribute body.
4 5 6 |
# File 'lib/converse/comms/conversation.rb', line 4 def body @body end |
#connection ⇒ Object
Returns the value of attribute connection.
6 7 8 |
# File 'lib/converse/comms/conversation.rb', line 6 def connection @connection end |
#headers ⇒ Object
Returns the value of attribute headers.
5 6 7 |
# File 'lib/converse/comms/conversation.rb', line 5 def headers @headers end |
#host ⇒ Object
Returns the value of attribute host.
7 8 9 |
# File 'lib/converse/comms/conversation.rb', line 7 def host @host end |
#path ⇒ Object
Returns the value of attribute path.
9 10 11 |
# File 'lib/converse/comms/conversation.rb', line 9 def path @path end |
#port ⇒ Object
Returns the value of attribute port.
8 9 10 |
# File 'lib/converse/comms/conversation.rb', line 8 def port @port end |
#request ⇒ Object
Returns the value of attribute request.
10 11 12 |
# File 'lib/converse/comms/conversation.rb', line 10 def request @request end |
#response ⇒ Object
Returns the value of attribute response.
11 12 13 |
# File 'lib/converse/comms/conversation.rb', line 11 def response @response end |
#subscribers ⇒ Object
Returns the value of attribute subscribers.
12 13 14 |
# File 'lib/converse/comms/conversation.rb', line 12 def subscribers @subscribers end |
#uri ⇒ Object
Returns the value of attribute uri.
3 4 5 |
# File 'lib/converse/comms/conversation.rb', line 3 def uri @uri end |
Instance Method Details
#ask ⇒ Object
23 24 25 |
# File 'lib/converse/comms/conversation.rb', line 23 def ask raise NotImplementedError.new end |
#notify_subscribers(data) ⇒ Object
35 36 37 38 39 |
# File 'lib/converse/comms/conversation.rb', line 35 def notify_subscribers(data) @subscribers.each do |subscriber| subscriber.notify(data) end end |
#say ⇒ Object
27 28 29 |
# File 'lib/converse/comms/conversation.rb', line 27 def say raise NotImplementedError.new end |
#subscribe(subscriber) ⇒ Object
31 32 33 |
# File 'lib/converse/comms/conversation.rb', line 31 def subscribe(subscriber) @subscribers << subscriber end |