Module: Webbed::Helpers::RequestHeadersHelper

Included in:
Request
Defined in:
lib/webbed/helpers/request_headers_helper.rb

Overview

Request helper for Request Headers

Instance Method Summary collapse

Instance Method Details

#fromString?

The From email of the Request (as defined in the From Header)

Returns:

  • (String, nil)


22
23
24
# File 'lib/webbed/helpers/request_headers_helper.rb', line 22

def from
  headers['From']
end

#from=(from)

Sets the From email of the Request (as defined in the From Header)

Parameters:

  • from (String)


29
30
31
# File 'lib/webbed/helpers/request_headers_helper.rb', line 29

def from=(from)
  headers['From'] = from
end

#hostString?

The Host of the Request (as defined in the Host Header)

Returns:

  • (String, nil)


8
9
10
# File 'lib/webbed/helpers/request_headers_helper.rb', line 8

def host
  headers['Host']
end

#host=(host)

Sets the Host of the Request (as defined in the Host Header)

Parameters:

  • host (String)


15
16
17
# File 'lib/webbed/helpers/request_headers_helper.rb', line 15

def host=(host)
  headers['Host'] = host
end

#max_forwardsFixnum?

The Max-Forwards of the Request (as defined in the Max-Forwards Header)

Returns:

  • (Fixnum, nil)


36
37
38
# File 'lib/webbed/helpers/request_headers_helper.rb', line 36

def max_forwards
  headers['Max-Forwards'] ? headers['Max-Forwards'].to_i : nil
end

#max_forwards=(max_forwards)

Sets the Max-Forwards of the Request (as defined in the Max-Forwards Header)

Parameters:

  • max_forwards (#to_s)


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

def max_forwards=(max_forwards)
  headers['Max-Forwards'] = max_forwards.to_s
end

#refererAddressable::URI?

The Referer of the Request (as defined in the Referer Header)

Returns:

  • (Addressable::URI, nil)


50
51
52
# File 'lib/webbed/helpers/request_headers_helper.rb', line 50

def referer
  headers['Referer'] ? Addressable::URI.parse(headers['Referer']) : nil
end

#referer=(referer)

Sets the Referer of the Request (as defined in the Referer Header)

Parameters:

  • referer (#to_s)


57
58
59
# File 'lib/webbed/helpers/request_headers_helper.rb', line 57

def referer=(referer)
  headers['Referer'] = referer.to_s
end