Class: Attentive::Message
- Inherits:
-
Object
- Object
- Attentive::Message
- Defined in:
- lib/attentive/message.rb
Instance Attribute Summary collapse
-
#contexts ⇒ Object
readonly
Returns the value of attribute contexts.
-
#text ⇒ Object
(also: #to_s)
readonly
Returns the value of attribute text.
Instance Method Summary collapse
-
#initialize(text, params = {}) ⇒ Message
constructor
A new instance of Message.
- #inspect ⇒ Object
- #tokens ⇒ Object
Constructor Details
#initialize(text, params = {}) ⇒ Message
Returns a new instance of Message.
8 9 10 11 12 |
# File 'lib/attentive/message.rb', line 8 def initialize(text, params={}) @text = text @contexts = Set.new(params.fetch(:contexts, [])) contexts << :conversation if tokens.grep(Attentive::Tokens::Invocation).any? end |
Instance Attribute Details
#contexts ⇒ Object (readonly)
Returns the value of attribute contexts.
6 7 8 |
# File 'lib/attentive/message.rb', line 6 def contexts @contexts end |
#text ⇒ Object (readonly) Also known as: to_s
Returns the value of attribute text.
6 7 8 |
# File 'lib/attentive/message.rb', line 6 def text @text end |