Class: NCRENAME_RENAME_VARIABLE_cmd

Inherits:
InplaceCommand show all
Includes:
NCO_warning_filter
Defined in:
lib/file_command.rb

Instance Method Summary collapse

Methods included from NCO_warning_filter

#command_success?

Methods inherited from InplaceCommand

#cmd_txt, #inplace?

Methods inherited from FileCommand

#run

Constructor Details

#initialize(old_name, new_name) ⇒ NCRENAME_RENAME_VARIABLE_cmd

Returns a new instance of NCRENAME_RENAME_VARIABLE_cmd.



317
318
319
# File 'lib/file_command.rb', line 317

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

Instance Method Details

#cmd_txt_inplace(file) ⇒ Object



321
322
323
324
325
326
327
# File 'lib/file_command.rb', line 321

def cmd_txt_inplace(file)
  if @old_name == @new_name
    %Q(#{SYSTEM_COMMANDS::SHELLNOOP}) # shell noop as ncrename fails with an error if the new name is the same as the old name
  else
    %Q(#{SYSTEM_COMMANDS::NCRENAME} -h -v #{@old_name},#{@new_name} #{file})
  end
end