Class: Intelligence::MessageContent::Text
- Inherits:
-
Base
- Object
- Base
- Intelligence::MessageContent::Text
show all
- Defined in:
- lib/intelligence/message_content/text.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Methods inherited from Base
#initialize
Instance Attribute Details
#text ⇒ Object
Returns the value of attribute text.
10
11
12
|
# File 'lib/intelligence/message_content/text.rb', line 10
def text
@text
end
|
Instance Method Details
#merge(other) ⇒ Object
16
17
18
19
20
21
22
|
# File 'lib/intelligence/message_content/text.rb', line 16
def merge( other )
other_text = other.text
text = @text
text = ( @text || '' ) + other_text if other_text
self.class.new( text: text )
end
|
#to_h ⇒ Object
24
25
26
|
# File 'lib/intelligence/message_content/text.rb', line 24
def to_h
{ type: :text, text: text }
end
|
#valid? ⇒ Boolean
12
13
14
|
# File 'lib/intelligence/message_content/text.rb', line 12
def valid?
( text || false ) && text.respond_to?( :empty? ) && !text.empty?
end
|