Class: Bane::Behaviors::Responders::CloseAfterPause
- Inherits:
-
Object
- Object
- Bane::Behaviors::Responders::CloseAfterPause
- 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
-
#initialize(options = {}) ⇒ CloseAfterPause
constructor
A new instance of CloseAfterPause.
- #serve(io) ⇒ Object
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 = {duration: 30}.merge() 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 |