Class: SleepingKingStudios::Docs::Commands::WriteFile
- Inherits:
-
Cuprum::Command
- Object
- Cuprum::Command
- SleepingKingStudios::Docs::Commands::WriteFile
- Includes:
- Cuprum::ExceptionHandling
- Defined in:
- lib/sleeping_king_studios/docs/commands/write_file.rb
Overview
Writes the given contents to a file.
Instance Method Summary collapse
-
#call(contents: , file_path: ) ⇒ Cuprum::Result, Cuprum::Result<Cuprum::Error>
Writes the given contents to the specified file.
-
#force? ⇒ Boolean
If true, overwrites an existing file.
-
#initialize(force: false) ⇒ WriteFile
constructor
A new instance of WriteFile.
Constructor Details
#initialize(force: false) ⇒ WriteFile
Returns a new instance of WriteFile.
29 30 31 32 33 |
# File 'lib/sleeping_king_studios/docs/commands/write_file.rb', line 29 def initialize(force: false) super() @force = force end |
Instance Method Details
#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.
|
|
# File 'lib/sleeping_king_studios/docs/commands/write_file.rb', line 15
|
#force? ⇒ Boolean
Returns if true, overwrites an existing file.
36 37 38 |
# File 'lib/sleeping_king_studios/docs/commands/write_file.rb', line 36 def force? @force end |