Class: Rack::Request

Inherits:
Object
  • Object
show all
Defined in:
lib/sinatra-hat.rb

Instance Method Summary collapse

Instance Method Details

#url(path = nil) ⇒ Object



127
128
129
130
131
132
133
134
135
136
# File 'lib/sinatra-hat.rb', line 127

def url(path=nil)
  url = scheme + "://"
  url << host
  if scheme == "https" && port != 443 ||
    scheme == "http" && port != 80
    url << ":#{port}"
  end
  url << (path ? path : fullpath)
  url
end