Module: Anthropic::Models::Beta::BetaMemoryTool20250818Command

Extended by:
Internal::Type::Union
Defined in:
lib/anthropic/models/beta/beta_memory_tool_20250818_command.rb

Class Method Summary collapse

Methods included from Internal::Type::Union

==, ===, coerce, derefed_variants, dump, hash, inspect, to_sorbet_type, variants

Methods included from Internal::Util::SorbetRuntimeSupport

#const_missing, #define_sorbet_constant!, #sorbet_constant_defined?, #to_sorbet_type, to_sorbet_type

Methods included from Internal::Type::Converter

#coerce, coerce, #dump, dump, #inspect, inspect, meta_info, new_coerce_state, type_info

Class Method Details

.new(command:, **args) ⇒ Anthropic::Models::Beta::BetaMemoryTool20250818ViewCommand, ...

Creates a new instance of the variant class whose command matches the given value, passing the remaining arguments to its constructor.

Parameters:

  • command (Symbol, String)
  • args (Hash{Symbol=>Object})

    Attributes for the chosen variant.

    @option args [String] :path Path to directory or file to view

    @option args [Array] :view_range Optional line range for viewing specific lines

    @option args [String] :file_text Content to write to the file

    @option args [String] :new_str Text to replace with

    @option args [String] :old_str Text to search for and replace

    @option args [Integer] :insert_line Line number where text should be inserted

    @option args [String] :insert_text Text to insert at the specified line

    @option args [String] :new_path New path for the file or directory

    @option args [String] :old_path Current path of the file or directory

Returns:

Raises:

  • (ArgumentError)


53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# File 'lib/anthropic/models/beta/beta_memory_tool_20250818_command.rb', line 53

def self.new(command:, **args)
  case command.to_sym
  when :view
    Anthropic::Beta::BetaMemoryTool20250818ViewCommand.new(**args)
  when :create
    Anthropic::Beta::BetaMemoryTool20250818CreateCommand.new(**args)
  when :str_replace
    Anthropic::Beta::BetaMemoryTool20250818StrReplaceCommand.new(**args)
  when :insert
    Anthropic::Beta::BetaMemoryTool20250818InsertCommand.new(**args)
  when :delete
    Anthropic::Beta::BetaMemoryTool20250818DeleteCommand.new(**args)
  when :rename
    Anthropic::Beta::BetaMemoryTool20250818RenameCommand.new(**args)
  else
    raise ArgumentError, "unknown command: #{command}"
  end
end