Module: Webbed::Helpers::RequestURIHelper
- Included in:
- Request
- Defined in:
- lib/webbed/helpers/request_uri_helper.rb
Overview
Request helper for the Request-URI
Class Method Summary collapse
-
.included(base)
Aliases the Request#request_uri method to
#request_url
.
Instance Method Summary collapse
-
#uri ⇒ Addressable::URI
(also: #url)
The URI of the actual location of the requested resource.
Class Method Details
.included(base)
Aliases the Request#request_uri method to #request_url
.
6 7 8 9 10 |
# File 'lib/webbed/helpers/request_uri_helper.rb', line 6 def self.included(base) base.class_eval do alias :request_url :request_uri end end |
Instance Method Details
#uri ⇒ Addressable::URI Also known as: url
The URI of the actual location of the requested resource.
If the Request-URI is an absolute URI or there is no Host header, it returns the Request-URI.
If the Request-URI is a relative URI, it combines the Host header with the Request-URI.
21 22 23 24 25 26 27 28 29 30 |
# File 'lib/webbed/helpers/request_uri_helper.rb', line 21 def uri if host && !request_uri.host request_uri.dup.tap do |uri| uri.scheme = 'http' uri.host = host end else request_uri end end |