Class: Ehbrs::Tools::RunnerWith::FilesystemRenamer::RenameFile

Inherits:
Object
  • Object
show all
Defined in:
lib/ehbrs/tools/runner_with/filesystem_renamer.rb

Constant Summary collapse

CONFIRM_MESSAGE =
'Rename?'

Instance Method Summary collapse

Instance Method Details

#renameObject



29
30
31
32
33
34
# File 'lib/ehbrs/tools/runner_with/filesystem_renamer.rb', line 29

def rename
  return unless rename?

  show
  do_rename if runner.confirm?(CONFIRM_MESSAGE)
end

#rename?Boolean

Returns:

  • (Boolean)


37
38
39
# File 'lib/ehbrs/tools/runner_with/filesystem_renamer.rb', line 37

def rename?
  path.to_pathname != target_path.to_pathname
end

#showObject



21
22
23
24
25
26
27
# File 'lib/ehbrs/tools/runner_with/filesystem_renamer.rb', line 21

def show
  if rename?
    puts [target_path_to_s, '<='.green, path_to_s].join(' ')
  else
    puts path_to_s
  end
end