Class: ContainerConfig::Coercer::SslVerifyMode
- Defined in:
- lib/container_config/coercer/ssl_verify_mode.rb
Overview
SSL verification mode type coercer
Constant Summary collapse
- VALID_MODES =
Array of valid SSL verification modes
OpenSSL::SSL.constants.select { |c| c.to_s.start_with?("VERIFY") }.map(&:to_s)
Instance Method Summary collapse
-
#coerce(value) ⇒ Integer
Coerces the given value into an SSL verification mode.
- #name ⇒ Object
- #type ⇒ Object
Instance Method Details
#coerce(value) ⇒ Integer
Coerces the given value into an SSL verification mode
31 32 33 34 35 36 37 38 39 |
# File 'lib/container_config/coercer/ssl_verify_mode.rb', line 31 def coerce(value) value = value.to_s return Object.const_get("OpenSSL::SSL::#{value}") if VALID_MODES.include?(value) ContainerConfig.logger.warn do "Could not convert #{value.inspect} into a valid OpenSSL verification mode.\nValid modes: #{VALID_MODES.join(", ")}" end nil end |
#name ⇒ Object
15 16 17 |
# File 'lib/container_config/coercer/ssl_verify_mode.rb', line 15 def name "SSL Verification Mode" end |
#type ⇒ Object
20 21 22 |
# File 'lib/container_config/coercer/ssl_verify_mode.rb', line 20 def type :ssl_verify_mode end |