Class: Looped::Tools::WriteFile
- Inherits:
-
DSPy::Tools::Base
- Object
- DSPy::Tools::Base
- Looped::Tools::WriteFile
- Extended by:
- T::Sig
- Defined in:
- lib/looped/tools/write_file.rb
Instance Method Summary collapse
Instance Method Details
#call(path:, content:) ⇒ Object
15 16 17 18 19 20 21 22 23 24 |
# File 'lib/looped/tools/write_file.rb', line 15 def call(path:, content:) resolved_path = resolve_path(path) FileUtils.mkdir_p(File.dirname(resolved_path)) File.write(resolved_path, content) "Successfully wrote #{content.length} bytes to #{path}" rescue Errno::EACCES "Error: Permission denied: #{path}" rescue StandardError => e "Error: #{e.}" end |