Class: Alephant::Broker::Response::Asset

Inherits:
Base
  • Object
show all
Includes:
Logger
Defined in:
lib/alephant/broker/response/asset.rb

Constant Summary

Constants inherited from Base

Base::STATUS_CODE_MAPPING

Instance Attribute Summary

Attributes inherited from Base

#content, #headers, #status

Instance Method Summary collapse

Constructor Details

#initialize(component, request_env) ⇒ Asset

Returns a new instance of Asset.



9
10
11
12
13
14
15
16
17
# File 'lib/alephant/broker/response/asset.rb', line 9

def initialize(component, request_env)
  @component = component

  @status = self.class.component_not_modified(@component.headers, request_env) ? 304 : component.status

  super(@status, component.content_type, request_env)

  @headers.merge!(@component.headers)
end

Instance Method Details

#setupObject



19
20
21
22
# File 'lib/alephant/broker/response/asset.rb', line 19

def setup
  @content = @component.content
  log if @component.is_a? Component
end