Class: RubyCoded::Tools::DeletePathTool
- Defined in:
- lib/ruby_coded/tools/delete_path_tool.rb
Overview
Delete a file or an empty directory at the given path
Constant Summary
Constants inherited from BaseTool
BaseTool::CONFIRM_RISK, BaseTool::DANGEROUS_RISK, BaseTool::SAFE_RISK
Instance Method Summary collapse
Methods inherited from BaseTool
Constructor Details
This class inherits a constructor from RubyCoded::Tools::BaseTool
Instance Method Details
#execute(path:) ⇒ Object
17 18 19 20 21 22 23 |
# File 'lib/ruby_coded/tools/delete_path_tool.rb', line 17 def execute(path:) run_pipeline(path: path, forbid_root: true) do |full_path| next { error: "Path not found: #{path}" } unless File.exist?(full_path) perform_delete(path, full_path) end end |