Class: ClaudeSDK::ContentBlock::Text

Inherits:
Object
  • Object
show all
Defined in:
lib/claude_sdk/types.rb

Overview

Text content block

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(text:) ⇒ Text

Returns a new instance of Text.

Parameters:

  • text (String)

    the text content



129
130
131
# File 'lib/claude_sdk/types.rb', line 129

def initialize(text:)
  @text = text
end

Instance Attribute Details

#textObject

the text content



125
126
127
128
129
130
131
132
133
134
135
136
137
# File 'lib/claude_sdk/types.rb', line 125

class Text
  attr_accessor :text

  # @param text [String] the text content
  def initialize(text:)
    @text = text
  end

  # @return [Hash] serialized representation
  def to_h
    { type: "text", text: text }
  end
end

Instance Method Details

#to_hHash

Returns serialized representation.

Returns:

  • (Hash)

    serialized representation



134
135
136
# File 'lib/claude_sdk/types.rb', line 134

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