Class: Reenrb::Actions::Rename

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

Overview

Renames files

Instance Method Summary collapse

Constructor Details

#initialize(old_name, new_name) ⇒ Rename

Returns a new instance of Rename.



7
8
9
10
# File 'lib/reenrb/actions/rename.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/rename.rb', line 12

def call
  File.rename(@old_name, @new_name)
  nil
rescue Errno::ENOENT
  "No such target file or directory"
end