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)


52
53
54
# File 'lib/ssl_requirement.rb', line 52

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

.included(controller) ⇒ Object

called when Module is mixed in



58
59
60
61
# File 'lib/ssl_requirement.rb', line 58

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

.non_ssl_hostObject



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

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

.ssl_hostObject



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

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

.ssl_portObject



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

def self.ssl_port
  @@ssl_port
end

Instance Method Details

#non_ssl_hostObject



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

def non_ssl_host
  SslRequirement.non_ssl_host
end

#ssl_hostObject

mattr_reader would generate both ssl_host and self.ssl_host



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

def ssl_host
  SslRequirement.ssl_host
end

#ssl_portObject



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

def ssl_port
  SslRequirement.ssl_port
end