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, :auto_deliver].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
- DEFAULT_AUTO_DELIVER =
true
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’
18 19 20 |
# File 'lib/user_notifier/configuration.rb', line 18 def self.extended(base) base.reset end |
Instance Method Details
#configure {|_self| ... } ⇒ Object
22 23 24 |
# File 'lib/user_notifier/configuration.rb', line 22 def configure yield self if block_given? end |
#options ⇒ Object
26 27 28 |
# File 'lib/user_notifier/configuration.rb', line 26 def Hash[ * VALID_CONFIG_KEYS.map { |key| [key, send(key)] }.flatten ] end |
#reset ⇒ Object
30 31 32 33 34 35 36 37 38 |
# File 'lib/user_notifier/configuration.rb', line 30 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 self.auto_deliver = DEFAULT_AUTO_DELIVER end |