Class: SleepingKingStudios::Docs::Commands::WriteFile
- Parent Namespace
- SleepingKingStudios::Docs::Commands
- Inherited Classes
- Cuprum::Command
>
Object
- Included Modules
- Cuprum::ExceptionHandling
- Defined In
- lib/sleeping_king_studios/docs/commands/write_file.rb
Table Of Contents
Overview
Writes the given contents to a file.
Back To Top
Constructor
#initialize(force: false) => WriteFile
Parameters
- force (Boolean) — if true, overwrites an existing file.
Returns
- (WriteFile) — a new instance of WriteFile
Back To Top
Instance Methods
#call(contents:, file_path:) => Cuprum::Result, Cuprum::Result<Cuprum::Error>
Writes the given contents to the specified file.
Recursively generates the required directories, if needed.
Parameters
- contents (String) — the contents to write.
- file_path (String) — the path of the file.
Returns
- (Cuprum::Result) — a passing result if the directories are
successfully created and the file is successfully written.
- (Cuprum::Result<Cuprum::Error>) — a failing result if the command
was unable to create the directories or write the file.
#force? => Boolean
Returns
- (Boolean) — if true, overwrites an existing file.
Back To Top
Back to
Documentation |
Reference
|
SleepingKingStudios
|
SleepingKingStudios::Docs
|
SleepingKingStudios::Docs::Commands