Class: Intelligence::MessageContent::Text

Inherits:
Base
  • Object
show all
Defined in:
lib/intelligence/message_content/text.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base

build, build!, #initialize

Constructor Details

This class inherits a constructor from Intelligence::MessageContent::Base

Instance Attribute Details

#textObject (readonly)

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

#to_hObject



16
17
18
# File 'lib/intelligence/message_content/text.rb', line 16

def to_h
  { type: :text, text: text }
end

#valid?Boolean

Returns:

  • (Boolean)


12
13
14
# File 'lib/intelligence/message_content/text.rb', line 12

def valid?
  ( text || false ) && text.respond_to?( :empty? ) && !text.empty? 
end