Class: ClaudeAgentSDK::UserMessage
- Defined in:
- lib/claude_agent_sdk/types.rb
Overview
User message
Instance Attribute Summary collapse
-
#content ⇒ Object
Returns the value of attribute content.
-
#parent_tool_use_id ⇒ Object
Returns the value of attribute parent_tool_use_id.
-
#tool_use_result ⇒ Object
Returns the value of attribute tool_use_result.
-
#uuid ⇒ Object
Returns the value of attribute uuid.
Instance Method Summary collapse
-
#text ⇒ Object
(also: #to_s)
Concatenated text of this message.
Methods inherited from Type
#[], #[]=, from_hash, #initialize, #to_h, wrap
Constructor Details
This class inherits a constructor from ClaudeAgentSDK::Type
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class ClaudeAgentSDK::Type
Instance Attribute Details
#content ⇒ Object
Returns the value of attribute content.
193 194 195 |
# File 'lib/claude_agent_sdk/types.rb', line 193 def content @content end |
#parent_tool_use_id ⇒ Object
Returns the value of attribute parent_tool_use_id.
193 194 195 |
# File 'lib/claude_agent_sdk/types.rb', line 193 def parent_tool_use_id @parent_tool_use_id end |
#tool_use_result ⇒ Object
Returns the value of attribute tool_use_result.
193 194 195 |
# File 'lib/claude_agent_sdk/types.rb', line 193 def tool_use_result @tool_use_result end |
#uuid ⇒ Object
Returns the value of attribute uuid.
193 194 195 |
# File 'lib/claude_agent_sdk/types.rb', line 193 def uuid @uuid end |
Instance Method Details
#text ⇒ Object Also known as: to_s
Concatenated text of this message. Handles both String content (plain-text user prompt) and Array-of-blocks content (typed content). Returns “” when there is no text.
198 199 200 201 202 203 204 |
# File 'lib/claude_agent_sdk/types.rb', line 198 def text case content when String then content when Array then content.grep(TextBlock).map(&:text).join("\n\n") else '' end end |