Class: FakeFtp::ServerCommands::Wat

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

Instance Method Summary collapse

Instance Method Details

#run(ctx) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/fake_ftp/server_commands/wat.rb', line 6

def run(ctx, *)
  if ctx.active? && ctx.command_state[:active_connection].nil?
    ctx.respond_with('425 Ain\'t no data port!')
    return
  end

  data_client = if ctx.active?
                  ctx.command_state[:active_connection]
                else
                  ctx.data_server.accept
                end
  data_client.write(invisible_bike)
  data_client.close
  ctx.command_state[:active_connection] = nil
  '418 Pizza Party'
end