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.



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

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

Instance Method Details

#serve(io) ⇒ Object



14
15
16
# File 'lib/bane/behaviors/responders/close_after_pause.rb', line 14

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