Class: Bane::Behaviors::Responders::FixedResponse

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

Overview

Sends a static response.

Options:

- message: The response message to send. Default: "Hello, world!"

Direct Known Subclasses

FixedResponseForEachLine

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ FixedResponse

Returns a new instance of FixedResponse.



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

def initialize(options = {})
  @options = {message: "Hello, world!"}.merge(options)
end

Instance Method Details

#serve(io) ⇒ Object



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

def serve(io)
  io.write @options[:message]
end