Class: Bane::Behaviors::Responders::DelugeResponse

Inherits:
Object
  • Object
show all
Defined in:
lib/bane/behaviors/responders/deluge_response.rb

Overview

Sends a large response. Response consists of a repeated ‘x’ character.

Options

- length: The size in bytes of the response to send. Default: 1,000,000 bytes

Direct Known Subclasses

DelugeResponseForEachLine

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ DelugeResponse

Returns a new instance of DelugeResponse.



10
11
12
# File 'lib/bane/behaviors/responders/deluge_response.rb', line 10

def initialize(options = {})
  @options = {length: 1_000_000}.merge(options)
end

Instance Method Details

#serve(io) ⇒ Object



14
15
16
17
18
# File 'lib/bane/behaviors/responders/deluge_response.rb', line 14

def serve(io)
  length = @options[:length]

  length.times { io.write('x') }
end