class Atatus::Context::Request::Url

@api private

Constants

SKIPPED_PORTS

Attributes

full[R]
hash[R]
hostname[R]
pathname[R]
port[R]
protocol[R]

Public Class Methods

new(req) click to toggle source
# File lib/atatus/context/request/url.rb, line 32
def initialize(req)
  @protocol = req.scheme
  @hostname = req.host
  @port = req.port.to_s
  @pathname = req.path
  @search = req.query_string
  @hash = nil
  @full = build_full_url req
end

Private Instance Methods

build_full_url(req) click to toggle source
# File lib/atatus/context/request/url.rb, line 47
def build_full_url(req)
  url = "#{req.scheme}://#{req.host}"

  if req.port != SKIPPED_PORTS[req.scheme]
    url += ":#{req.port}"
  end

  url + req.fullpath
end