Module: Webbed::Helpers::EntityHeadersHelper

Included in:
Request, Response
Defined in:
lib/webbed/helpers/entity_headers_helper.rb

Overview

Request and Response helper for Entity Headers

Instance Method Summary collapse

Instance Method Details

#content_lengthFixnum?

The Content-Length of the Entity (as defined in the Content-Length Header).

Returns:

  • (Fixnum, nil)


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).

Parameters:

  • content_length (#to_s)


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

#content_locationAddressable::URI?

The Content-Location of the Entity (as defined in the Content-Location Header).

Returns:

  • (Addressable::URI, nil)


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).

Parameters:

  • content_location (#to_s)


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

#content_md5String?

The Content-MD5 of the Entity (as defined in the Content-MD5 Header).

Returns:

  • (String, nil)


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).

Parameters:

  • content_md5 (String)


43
44
45
# File 'lib/webbed/helpers/entity_headers_helper.rb', line 43

def content_md5=(content_md5)
  headers['Content-MD5'] = content_md5
end

#content_typeMediaType?

The Content-Type of the Entity (as defined in the Content-Type Header).

Returns:



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).

Parameters:

  • content_type (#to_s)


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