class SanitizeEmail::Config
The API for configuring SanitizeEmail
is via `SanitizeEmail.config` Available configuration options are listed in the `DEFAULTS` constant.
Constants
- DEFAULTS
- INIT_KEYS
Attributes
config[RW]
Public Class Methods
config_force_sanitize_deprecation_warning()
click to toggle source
# File lib/sanitize_email/config.rb, line 85 def self.config_force_sanitize_deprecation_warning return nil if @config[:force_sanitize].nil? deprecation_warning_message( <<-DEPRECATION SanitizeEmail::Config.config[:force_sanitize] is deprecated. Please use SanitizeEmail.force_sanitize or SanitizeEmail.sanitary instead. Refer to https://github.com/pboling/sanitize_email/wiki for examples. DEPRECATION ) SanitizeEmail.force_sanitize = @config[:force_sanitize] end
configure() { |config| ... }
click to toggle source
# File lib/sanitize_email/config.rb, line 64 def self.configure yield @config # Gracefully handle deprecated config values. # Actual deprecation warnings are thrown in the top SanitizeEmail module # thanks to our use of dynamic methods. if @config[:local_environments] && defined?(Rails) @config[:activation_proc] = proc do SanitizeEmail.local_environments.include?(Rails.env) end end if @config[:sanitized_recipients] # calling it to trigger the deprecation warning. # Won't actually be set with any value, # because we are still inside the configure block. SanitizeEmail.sanitized_recipients @config[:sanitized_to] = @config[:sanitized_recipients] end config_force_sanitize_deprecation_warning end
to_init()
click to toggle source
# File lib/sanitize_email/config.rb, line 98 def self.to_init @config.select { |key, _value| INIT_KEYS.include?(key) } end