Class: TurboBoost::Commands::Responder
- Inherits:
-
Object
- Object
- TurboBoost::Commands::Responder
- Defined in:
- lib/turbo_boost/commands/responder.rb
Instance Attribute Summary collapse
-
#headers ⇒ Object
Returns the value of attribute headers.
Instance Method Summary collapse
- #add_content(content) ⇒ Object
- #add_header(key, value) ⇒ Object
- #body ⇒ Object
-
#initialize ⇒ Responder
constructor
A new instance of Responder.
Constructor Details
#initialize ⇒ Responder
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
#headers ⇒ Object
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 |
#body ⇒ Object
11 12 13 |
# File 'lib/turbo_boost/commands/responder.rb', line 11 def body @body.join.html_safe end |