Class: FileTransactions::DeleteFileCommand

Inherits:
BaseCommand
  • Object
show all
Defined in:
lib/file_transactions/delete_file_command.rb

Overview

This command supports deleting a file.

When this command has been executed, the file can be restored by calling #undo

Examples

# Pass in the filename  name to ::new
cmd1 = DeleteFileCommand.new('some_existing_file')

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from BaseCommand

execute, #execute, #executed?, #failed?, #register, #undo

Constructor Details

#initialize(name) ⇒ DeleteFileCommand

Returns a new instance of DeleteFileCommand.

Parameters:

  • name (String)

    The name of the file to be deleted. May be just a name or an absolut or relative path



20
21
22
# File 'lib/file_transactions/delete_file_command.rb', line 20

def initialize(name)
  @name = name
end

Instance Attribute Details

#blockObject (readonly)

Returns the value of attribute block.



17
18
19
# File 'lib/file_transactions/delete_file_command.rb', line 17

def block
  @block
end

#nameObject (readonly)

Returns the value of attribute name.



17
18
19
# File 'lib/file_transactions/delete_file_command.rb', line 17

def name
  @name
end