Module: Webbed::Helpers::SchemeHelper

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

Overview

Request helper for the schemes

Instance Method Summary collapse

Instance Method Details

#default_portFixnum?

The default port for the designated scheme

This method returns 80 if you're using HTTP and 443 if you're using HTTPS.

Returns:

  • (Fixnum, nil)


18
19
20
21
22
23
# File 'lib/webbed/helpers/scheme_helper.rb', line 18

def default_port
  case scheme
  when 'http' then 80
  when 'https' then 443
  end
end

#secure?Boolean

Whether or not the request was sent securely (using HTTPS)

Returns:

  • (Boolean)


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

def secure?
  scheme == 'https'
end