Class: FakeFtp::ServerCommands::Mdtm

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

Instance Method Summary collapse

Instance Method Details

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



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

def run(ctx, filename = '', *)
  ctx.respond_with('501 No filename given') && return if filename.empty?
  server_file = ctx.file(filename)
  ctx.respond_with('550 File not found') && return if server_file.nil?

  ctx.respond_with(
    "213 #{server_file.last_modified_time.strftime('%Y%m%d%H%M%S')}"
  )
end