Module: SslRequirement

Defined in:
lib/ssl_requirement.rb

Overview

Copyright © 2005 David Heinemeier Hansson

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.disable_ssl_check?Boolean

Returns:

  • (Boolean)

43
44
45
# File 'lib/ssl_requirement.rb', line 43

def self.disable_ssl_check?
  @@disable_ssl_check ||= false
end

.included(controller) ⇒ Object

called when Module is mixed in


49
50
51
52
# File 'lib/ssl_requirement.rb', line 49

def self.included(controller)
  controller.extend(ClassMethods)
  controller.before_filter(:ensure_proper_protocol)
end

.non_ssl_hostObject


30
31
32
# File 'lib/ssl_requirement.rb', line 30

def self.non_ssl_host
  determine_host(@@non_ssl_host) rescue nil
end

.ssl_hostObject


26
27
28
# File 'lib/ssl_requirement.rb', line 26

def self.ssl_host
  determine_host(@@ssl_host) rescue nil
end

Instance Method Details

#non_ssl_hostObject


39
40
41
# File 'lib/ssl_requirement.rb', line 39

def non_ssl_host
  SslRequirement.non_ssl_host
end

#ssl_hostObject

mattr_reader would generate both ssl_host and self.ssl_host


35
36
37
# File 'lib/ssl_requirement.rb', line 35

def ssl_host
  SslRequirement.ssl_host
end