Class: Reenrb::Actions::Delete

Inherits:
Object
  • Object
show all
Defined in:
lib/reenrb/actions/delete.rb

Overview

Deletes a file

Instance Method Summary collapse

Constructor Details

#initialize(old_name, new_name) ⇒ Delete

Returns a new instance of Delete.



7
8
9
10
# File 'lib/reenrb/actions/delete.rb', line 7

def initialize(old_name, new_name)
  @old_name = old_name
  @new_name = new_name
end

Instance Method Details

#callObject



12
13
14
15
16
17
# File 'lib/reenrb/actions/delete.rb', line 12

def call
  File.delete(@old_name)
  nil
rescue Errno::ENOENT
  "Could not delete"
end