Class: FakeFtp::ServerCommands::Rnfr

Inherits:
Object
  • Object
show all
Defined in:
lib/fake_ftp/server_commands/rnfr.rb

Instance Method Summary collapse

Instance Method Details

#run(ctx, rename_from = '') ⇒ Object



6
7
8
9
10
11
12
13
14
15
# File 'lib/fake_ftp/server_commands/rnfr.rb', line 6

def run(ctx, rename_from = '', *)
  return '501 Send path name.' if rename_from.nil? || rename_from.empty?

  ctx.command_state[:rename_from] = if ctx.absolute?
                                      ctx.abspath(rename_from)
                                    else
                                      rename_from
                                    end
  '350 Send RNTO to complete rename.'
end