Class: Bane::Behaviors::Responders::CloseAfterPause

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

Overview

Accepts a connection, pauses a fixed duration, then closes the connection.

Options:

- duration: The number of seconds to wait before disconnect.  Default: 30

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ CloseAfterPause

Returns a new instance of CloseAfterPause.



12
13
14
# File 'lib/bane/behaviors/responders/close_after_pause.rb', line 12

def initialize(options = {})
  @options = {duration: 30}.merge(options)
end

Instance Method Details

#serve(io) ⇒ Object



16
17
18
# File 'lib/bane/behaviors/responders/close_after_pause.rb', line 16

def serve(io)
  sleep(@options[:duration])
end