Module: UserNotifier::Configuration
- Included in:
- UserNotifier
- Defined in:
- lib/user_notifier/configuration.rb
Constant Summary collapse
- VALID_CONFIG_KEYS =
[:system_email, :email_layout, :user_class_name, :from_email, :from_name, :use_xsmtp_api].freeze
- DEFAULT_SYSTEM_EMAIL =
nil- DEFAULT_EMAIL_LAYOUT =
'email'- DEFAULT_USER_CLASS_NAME =
'User'- DEFAULT_FROM_EMAIL =
'no-reply@yourdomain'- DEFAULT_FROM_NAME =
'please configure a default from name'- DEFAULT_USE_XSMTP_API =
false
Class Method Summary collapse
-
.extended(base) ⇒ Object
Make sure we have the default values set when we get ‘extended’.
Instance Method Summary collapse
Class Method Details
.extended(base) ⇒ Object
Make sure we have the default values set when we get ‘extended’
17 18 19 |
# File 'lib/user_notifier/configuration.rb', line 17 def self.extended(base) base.reset end |
Instance Method Details
#configure {|_self| ... } ⇒ Object
21 22 23 |
# File 'lib/user_notifier/configuration.rb', line 21 def configure yield self if block_given? end |
#options ⇒ Object
25 26 27 |
# File 'lib/user_notifier/configuration.rb', line 25 def Hash[ * VALID_CONFIG_KEYS.map { |key| [key, send(key)] }.flatten ] end |
#reset ⇒ Object
29 30 31 32 33 34 35 36 |
# File 'lib/user_notifier/configuration.rb', line 29 def reset self.system_email = DEFAULT_SYSTEM_EMAIL self.email_layout = DEFAULT_EMAIL_LAYOUT self.user_class_name = DEFAULT_USER_CLASS_NAME self.from_email = DEFAULT_FROM_EMAIL self.from_name = DEFAULT_FROM_NAME self.use_xsmtp_api = DEFAULT_USE_XSMTP_API end |