Class: Alephant::Broker::Response::Base
- Inherits:
-
Object
- Object
- Alephant::Broker::Response::Base
- Includes:
- Logger
- Defined in:
- lib/alephant/broker/response/base.rb
Direct Known Subclasses
Constant Summary collapse
- STATUS_CODE_MAPPING =
{ 200 => "ok", 404 => "Not found", 500 => "Error retrieving content" }
Instance Attribute Summary collapse
-
#content ⇒ Object
readonly
Returns the value of attribute content.
-
#headers ⇒ Object
readonly
Returns the value of attribute headers.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
Instance Method Summary collapse
-
#initialize(status = 200, content_type = "text/html") ⇒ Base
constructor
A new instance of Base.
Constructor Details
#initialize(status = 200, content_type = "text/html") ⇒ Base
Returns a new instance of Base.
21 22 23 24 25 26 27 28 29 |
# File 'lib/alephant/broker/response/base.rb', line 21 def initialize(status = 200, content_type = "text/html") @content = STATUS_CODE_MAPPING[status] @headers = { "Content-Type" => content_type } @headers.merge!(Broker.config[:headers]) if Broker.config.has_key?(:headers) @status = status log_status setup end |
Instance Attribute Details
#content ⇒ Object (readonly)
Returns the value of attribute content.
13 14 15 |
# File 'lib/alephant/broker/response/base.rb', line 13 def content @content end |
#headers ⇒ Object (readonly)
Returns the value of attribute headers.
13 14 15 |
# File 'lib/alephant/broker/response/base.rb', line 13 def headers @headers end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
13 14 15 |
# File 'lib/alephant/broker/response/base.rb', line 13 def status @status end |