Class: FileTransactions::CreateDirectoryCommand
- Inherits:
-
BaseCommand
- Object
- BaseCommand
- FileTransactions::CreateDirectoryCommand
- Defined in:
- lib/file_transactions/create_directory_command.rb
Overview
This command creates a new directory. It will also create parent directories if the given path contains directories that doesn’t exist.
When this command has been executed, the created directories can be removed again by calling #undo.
Examples
# Pass in the new directory name to ::new
cmd1 = CreateDirectoryCommand.new('directory_name')
# The new directory name may be a path of multiple non exsting directories (like `mkdir -p`)
cmd2 = CreateDirectoryCommand.new('non_existing_dir1/non_existing_dir2/new_dir')
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
-
#initialize(name) ⇒ CreateDirectoryCommand
constructor
A new instance of CreateDirectoryCommand.
Methods inherited from BaseCommand
execute, #execute, #executed?, #failed?, #register, #undo
Constructor Details
#initialize(name) ⇒ CreateDirectoryCommand
Returns a new instance of CreateDirectoryCommand.
23 24 25 |
# File 'lib/file_transactions/create_directory_command.rb', line 23 def initialize(name) @name = name end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
20 21 22 |
# File 'lib/file_transactions/create_directory_command.rb', line 20 def name @name end |