Class: PageMountController::ProxyResponse
- Inherits:
-
Object
- Object
- PageMountController::ProxyResponse
- Defined in:
- app/controllers/page_mount_controller.rb
Constant Summary collapse
- DEFAULT_CONTENT_DISPOSITION =
'inline'
- FILE_CONTENT_TYPES =
%w( application/octet-stream application/javascript text/plain # js.map application/json )
Instance Attribute Summary collapse
-
#response ⇒ Object
readonly
Returns the value of attribute response.
Instance Method Summary collapse
- #content_disposition ⇒ Object
- #content_type ⇒ Object
- #file? ⇒ Boolean
- #headers ⇒ Object
-
#initialize(response) ⇒ ProxyResponse
constructor
A new instance of ProxyResponse.
Constructor Details
#initialize(response) ⇒ ProxyResponse
Returns a new instance of ProxyResponse.
116 117 118 |
# File 'app/controllers/page_mount_controller.rb', line 116 def initialize(response) @response = response end |
Instance Attribute Details
#response ⇒ Object (readonly)
Returns the value of attribute response.
114 115 116 |
# File 'app/controllers/page_mount_controller.rb', line 114 def response @response end |
Instance Method Details
#content_disposition ⇒ Object
135 136 137 |
# File 'app/controllers/page_mount_controller.rb', line 135 def content_disposition headers[:content_disposition] || DEFAULT_CONTENT_DISPOSITION end |
#content_type ⇒ Object
131 132 133 |
# File 'app/controllers/page_mount_controller.rb', line 131 def content_type headers[:content_type].split(';').first end |
#file? ⇒ Boolean
127 128 129 |
# File 'app/controllers/page_mount_controller.rb', line 127 def file? headers.key?(:content_disposition) || FILE_CONTENT_TYPES.include?(content_type) end |
#headers ⇒ Object
141 142 143 |
# File 'app/controllers/page_mount_controller.rb', line 141 def headers @response.body.headers end |