Class: TurboBoost::Commands::Responder

Inherits:
Object
  • Object
show all
Defined in:
lib/turbo_boost/commands/responder.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeResponder

Returns a new instance of Responder.



6
7
8
9
# File 'lib/turbo_boost/commands/responder.rb', line 6

def initialize
  @headers = HashWithIndifferentAccess.new
  @body = Set.new
end

Instance Attribute Details

#headersObject

Returns the value of attribute headers.



4
5
6
# File 'lib/turbo_boost/commands/responder.rb', line 4

def headers
  @headers
end

Instance Method Details

#add_content(content) ⇒ Object



19
20
21
# File 'lib/turbo_boost/commands/responder.rb', line 19

def add_content(content)
  @body << sanitizer.sanitize(content) + "\n"
end

#add_header(key, value) ⇒ Object



15
16
17
# File 'lib/turbo_boost/commands/responder.rb', line 15

def add_header(key, value)
  headers[key.to_s.downcase] = value.to_s
end

#bodyObject



11
12
13
# File 'lib/turbo_boost/commands/responder.rb', line 11

def body
  @body.join.html_safe
end