Class: OmniAI::Tools::Disk::DirectoryCreateTool

Inherits:
BaseTool
  • Object
show all
Defined in:
lib/omniai/tools/disk/directory_move_tool.rb,
lib/omniai/tools/disk/directory_create_tool.rb

Overview

Examples:

tool = OmniAI::Tools::Disk::DirectoryCreateTool.new(root: "./project")
tool.execute(path: "./foo/bar")

Instance Method Summary collapse

Methods inherited from BaseTool

#initialize

Constructor Details

This class inherits a constructor from OmniAI::Tools::Disk::BaseTool

Instance Method Details

#execute(path:) ⇒ String

Parameters:

  • path (String)

Returns:

  • (String)


21
22
23
24
25
26
27
28
# File 'lib/omniai/tools/disk/directory_move_tool.rb', line 21

def execute(old_path:, new_path:)
  @logger.info("#{self.class.name}#execute path=#{path.inspect}")

  FileUtils.mv(old_path, new_path)
rescue SecurityError => e
  @logger.error(e.message)
  raise e
end