Module: Webbed::Helpers::EntityHeadersHelper
Overview
Request and Response helper for Entity Headers
Instance Method Summary (collapse)
-
- (<Webbed::Method>?) allowed_methods
The allowed Methods of the Entity (as defined in the Allow Header).
-
- allowed_methods=(allowed_methods)
Sets the allowed Methods of the Entity (as defined in the Allow Header).
-
- (Fixnum?) content_length
The Content-Length of the Entity (as defined in the Content-Length Header).
-
- content_length=(content_length)
Sets the Content-Length of the Entity (as defined in the Content-Length Header).
-
- (Addressable::URI?) content_location
The Content-Location of the Entity (as defined in the Content-Location Header).
-
- content_location=(content_location)
Sets the Content-Location of the Entity (as defined in the Content-Location Header).
-
- (String?) content_md5
The Content-MD5 of the Entity (as defined in the Content-MD5 Header).
-
- content_md5=(content_md5)
Sets the Content-MD5 of the Entity (as defined in the Content-MD5 Header).
-
- (Webbed::MediaType?) content_type
The Content-Type of the Entity (as defined in the Content-Type Header).
-
- content_type=(content_type)
Sets the Content-Type of the Entity (as defined in the Content-Type Header).
Instance Method Details
- (<Webbed::Method>?) allowed_methods
The allowed Methods of the Entity (as defined in the Allow Header).
64 65 66 67 68 69 70 71 72 |
# File 'lib/webbed/helpers/entity_headers_helper.rb', line 64 def allowed_methods if headers['Allow'] headers['Allow'].split(/\s*,\s*/).map do |method| Webbed::Method.lookup(method) end else nil end end |
- allowed_methods=(allowed_methods)
Sets the allowed Methods of the Entity (as defined in the Allow Header).
77 78 79 |
# File 'lib/webbed/helpers/entity_headers_helper.rb', line 77 def allowed_methods=(allowed_methods) headers['Allow'] = allowed_methods.join(', ') end |
- (Fixnum?) content_length
The Content-Length of the Entity (as defined in the Content-Length Header).
8 9 10 |
# File 'lib/webbed/helpers/entity_headers_helper.rb', line 8 def content_length headers['Content-Length'] ? headers['Content-Length'].to_i : nil end |
- content_length=(content_length)
Sets the Content-Length of the Entity (as defined in the Content-Length Header).
15 16 17 |
# File 'lib/webbed/helpers/entity_headers_helper.rb', line 15 def content_length=(content_length) headers['Content-Length'] = content_length.to_s end |
- (Addressable::URI?) content_location
The Content-Location of the Entity (as defined in the Content-Location Header).
22 23 24 |
# File 'lib/webbed/helpers/entity_headers_helper.rb', line 22 def content_location headers['Content-Location'] ? Addressable::URI.parse(headers['Content-Location']) : nil end |
- content_location=(content_location)
Sets the Content-Location of the Entity (as defined in the Content-Location Header).
29 30 31 |
# File 'lib/webbed/helpers/entity_headers_helper.rb', line 29 def content_location=(content_location) headers['Content-Location'] = content_location.to_s end |
- (String?) content_md5
The Content-MD5 of the Entity (as defined in the Content-MD5 Header).
36 37 38 |
# File 'lib/webbed/helpers/entity_headers_helper.rb', line 36 def content_md5 headers['Content-MD5'] end |
- content_md5=(content_md5)
Sets the Content-MD5 of the Entity (as defined in the Content-MD5 Header).
43 44 45 |
# File 'lib/webbed/helpers/entity_headers_helper.rb', line 43 def content_md5=(content_md5) headers['Content-MD5'] = content_md5 end |
- (Webbed::MediaType?) content_type
The Content-Type of the Entity (as defined in the Content-Type Header).
50 51 52 |
# File 'lib/webbed/helpers/entity_headers_helper.rb', line 50 def content_type headers['Content-Type'] ? Webbed::MediaType.new(headers['Content-Type']) : nil end |
- content_type=(content_type)
Sets the Content-Type of the Entity (as defined in the Content-Type Header).
57 58 59 |
# File 'lib/webbed/helpers/entity_headers_helper.rb', line 57 def content_type=(content_type) headers['Content-Type'] = content_type.to_s end |