Class: A2A::Part::Text
- Inherits:
-
Object
- Object
- A2A::Part::Text
- Defined in:
- lib/a2a/part/text.rb
Instance Attribute Summary collapse
-
#filename ⇒ Object
readonly
Returns the value of attribute filename.
-
#media_type ⇒ Object
readonly
Returns the value of attribute media_type.
-
#metadata ⇒ Object
readonly
Returns the value of attribute metadata.
-
#text ⇒ Object
readonly
Returns the value of attribute text.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(text:, media_type: nil, filename: nil, metadata: nil) ⇒ Text
constructor
A new instance of Text.
- #to_h ⇒ Object
Constructor Details
#initialize(text:, media_type: nil, filename: nil, metadata: nil) ⇒ Text
Returns a new instance of Text.
8 9 10 11 12 13 |
# File 'lib/a2a/part/text.rb', line 8 def initialize(text:, media_type: nil, filename: nil, metadata: nil) @text = text @media_type = media_type @filename = filename @metadata = end |
Instance Attribute Details
#filename ⇒ Object (readonly)
Returns the value of attribute filename.
6 7 8 |
# File 'lib/a2a/part/text.rb', line 6 def filename @filename end |
#media_type ⇒ Object (readonly)
Returns the value of attribute media_type.
6 7 8 |
# File 'lib/a2a/part/text.rb', line 6 def media_type @media_type end |
#metadata ⇒ Object (readonly)
Returns the value of attribute metadata.
6 7 8 |
# File 'lib/a2a/part/text.rb', line 6 def @metadata end |
#text ⇒ Object (readonly)
Returns the value of attribute text.
6 7 8 |
# File 'lib/a2a/part/text.rb', line 6 def text @text end |
Class Method Details
.from_h(hash) ⇒ Object
15 16 17 18 19 20 21 22 |
# File 'lib/a2a/part/text.rb', line 15 def self.from_h(hash) new( text: hash.fetch("text"), media_type: hash["mediaType"], filename: hash["filename"], metadata: hash["metadata"] ) end |
Instance Method Details
#to_h ⇒ Object
24 25 26 27 28 29 30 31 |
# File 'lib/a2a/part/text.rb', line 24 def to_h { "text" => text, "mediaType" => media_type, "filename" => filename, "metadata" => }.compact end |