module Protocool

Public Instance Methods

https() click to toggle source
# File lib/protocool.rb, line 5
def https
  use_ssl? ? 'https' : 'http'
end
protocol() click to toggle source
# File lib/protocool.rb, line 9
def protocol
  "#{Protocool.https}://"
end

Private Instance Methods

use_ssl?() click to toggle source
# File lib/protocool.rb, line 15
def use_ssl?
  # Allow the user to override any defaults
  # This is useful for booting a Rails app with production environment locally
  return false if ENV['PROTOCOOL_FORCE_INSECURE'] == 'true'
  # Let the Rails config decide
  return true if Rails.respond_to?(:application) && Rails.application.config.force_ssl
  # Otherwise use default
  !Rails.env.development? && !Rails.env.test?
end