Class: WitBot::Bot::Conversation::Participant
- Inherits:
-
Object
- Object
- WitBot::Bot::Conversation::Participant
- Defined in:
- lib/wit_bot/bot/conversation/participant.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#conversation ⇒ Object
readonly
Returns the value of attribute conversation.
Instance Method Summary collapse
- #bot? ⇒ Boolean
-
#initialize(conversation) ⇒ Participant
constructor
A new instance of Participant.
- #send_message(text, meta = nil) ⇒ Object (also: #output)
- #update(type, message) ⇒ Object
Constructor Details
#initialize(conversation) ⇒ Participant
Returns a new instance of Participant.
7 8 9 10 |
# File 'lib/wit_bot/bot/conversation/participant.rb', line 7 def initialize(conversation) @conversation = conversation @conversation.add_observer self end |
Instance Attribute Details
#conversation ⇒ Object (readonly)
Returns the value of attribute conversation.
5 6 7 |
# File 'lib/wit_bot/bot/conversation/participant.rb', line 5 def conversation @conversation end |
Instance Method Details
#bot? ⇒ Boolean
12 13 14 |
# File 'lib/wit_bot/bot/conversation/participant.rb', line 12 def bot? true end |
#send_message(text, meta = nil) ⇒ Object Also known as: output
16 17 18 |
# File 'lib/wit_bot/bot/conversation/participant.rb', line 16 def (text, =nil) @conversation. text, self, end |
#update(type, message) ⇒ Object
23 24 25 26 27 28 29 30 |
# File 'lib/wit_bot/bot/conversation/participant.rb', line 23 def update(type, ) case type when :input self.on_input if self.respond_to? :on_input, true when :output self.on_output if self.respond_to? :on_output, true end end |