Class: Ask::Content::Text
Overview
A text block within a multi-modal message.
Instance Attribute Summary collapse
-
#text ⇒ String
readonly
The text content.
Instance Method Summary collapse
- #==(other) ⇒ Object (also: #eql?)
- #hash ⇒ Object
-
#initialize(text) ⇒ Text
constructor
A new instance of Text.
- #to_h ⇒ Object
Methods included from Block
Constructor Details
#initialize(text) ⇒ Text
Returns a new instance of Text.
55 56 57 58 |
# File 'lib/ask/content.rb', line 55 def initialize(text) @text = text freeze end |
Instance Attribute Details
#text ⇒ String (readonly)
Returns the text content.
52 53 54 |
# File 'lib/ask/content.rb', line 52 def text @text end |
Instance Method Details
#==(other) ⇒ Object Also known as: eql?
60 61 62 |
# File 'lib/ask/content.rb', line 60 def ==(other) other.is_a?(Text) && @text == other.text end |
#hash ⇒ Object
65 66 67 |
# File 'lib/ask/content.rb', line 65 def hash @text.hash end |
#to_h ⇒ Object
69 70 71 |
# File 'lib/ask/content.rb', line 69 def to_h { type: "text", text: @text } end |