Class: ClaudeAgentSDK::Type
- Inherits:
-
Object
- Object
- ClaudeAgentSDK::Type
- Defined in:
- lib/claude_agent_sdk/types.rb
Overview
Base class for all types.
Direct Known Subclasses
AgentDefinition, AssistantMessage, AsyncHookJSONOutput, AuthStatusMessage, BaseHookInput, ClaudeAgentOptions, CompactMetadata, CwdChangedHookSpecificOutput, FileChangedHookSpecificOutput, ForkSessionResult, HookContext, HookMatcher, McpClaudeAIProxyServerConfig, McpHttpServerConfig, McpSSEServerConfig, McpSdkServerConfig, McpSdkServerConfigStatus, McpServerInfo, McpServerStatus, McpStatusResponse, McpStdioServerConfig, McpToolAnnotations, McpToolInfo, NotificationHookSpecificOutput, PermissionDeniedHookSpecificOutput, PermissionRequestHookSpecificOutput, PermissionResultAllow, PermissionResultDeny, PermissionRuleValue, PermissionUpdate, PostToolUseFailureHookSpecificOutput, PostToolUseHookSpecificOutput, PreToolUseHookSpecificOutput, PromptSuggestionMessage, RateLimitEvent, RateLimitInfo, ResultMessage, SandboxFilesystemConfig, SandboxNetworkConfig, SandboxSettings, SdkMcpPrompt, SdkMcpResource, SdkMcpTool, SdkPluginConfig, SessionStartHookSpecificOutput, SetupHookSpecificOutput, StreamEvent, SubagentStartHookSpecificOutput, SyncHookJSONOutput, SystemMessage, SystemPromptFile, SystemPromptPreset, TaskBudget, TaskUsage, TextBlock, ThinkingBlock, ThinkingConfigAdaptive, ThinkingConfigDisabled, ThinkingConfigEnabled, ToolPermissionContext, ToolProgressMessage, ToolResultBlock, ToolUseBlock, ToolUseSummaryMessage, ToolsPreset, UnknownBlock, UserMessage, UserPromptSubmitHookSpecificOutput
Class Method Summary collapse
Instance Method Summary collapse
- #[](name) ⇒ Object
- #[]=(name, value) ⇒ Object
-
#initialize(attributes = {}) ⇒ Type
constructor
A new instance of Type.
-
#to_h ⇒ Object
Subclasses should override this to return a hash representation of the object.
Constructor Details
#initialize(attributes = {}) ⇒ Type
Returns a new instance of Type.
75 76 77 78 |
# File 'lib/claude_agent_sdk/types.rb', line 75 def initialize(attributes = {}) assign_attributes(attributes) if attributes super() end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name) ⇒ Object (private)
Allow camelCase attribute access
96 97 98 99 100 101 102 103 104 |
# File 'lib/claude_agent_sdk/types.rb', line 96 def method_missing(method_name, ...) normalized = normalize_name(method_name) if normalized != method_name.to_s && respond_to?(normalized) public_send(normalized, ...) else super end end |
Class Method Details
.from_hash(hash) ⇒ Object
69 70 71 72 73 |
# File 'lib/claude_agent_sdk/types.rb', line 69 def self.from_hash(hash) return unless hash.is_a?(Hash) new(hash) end |
.wrap(object) ⇒ Object
62 63 64 65 66 67 |
# File 'lib/claude_agent_sdk/types.rb', line 62 def self.wrap(object) return object if object.is_a?(self) return nil if object.nil? new(object) end |
Instance Method Details
#[](name) ⇒ Object
80 81 82 |
# File 'lib/claude_agent_sdk/types.rb', line 80 def [](name) read_attribute(name) end |
#[]=(name, value) ⇒ Object
84 85 86 |
# File 'lib/claude_agent_sdk/types.rb', line 84 def []=(name, value) assign_attribute(name, value) end |
#to_h ⇒ Object
Subclasses should override this to return a hash representation of the object.
89 90 91 |
# File 'lib/claude_agent_sdk/types.rb', line 89 def to_h {} end |