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, :cc].freeze
- DEFAULT_SYSTEM_EMAIL =
nil- DEFAULT_CC =
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’
19 20 21 |
# File 'lib/user_notifier/configuration.rb', line 19 def self.extended(base) base.reset end |
Instance Method Details
#configure {|_self| ... } ⇒ Object
23 24 25 |
# File 'lib/user_notifier/configuration.rb', line 23 def configure yield self if block_given? end |
#options ⇒ Object
27 28 29 |
# File 'lib/user_notifier/configuration.rb', line 27 def Hash[ * VALID_CONFIG_KEYS.map { |key| [key, send(key)] }.flatten ] end |
#reset ⇒ Object
31 32 33 34 35 36 37 38 39 40 |
# File 'lib/user_notifier/configuration.rb', line 31 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.cc = DEFAULT_CC self.from_name = DEFAULT_FROM_NAME self.use_xsmtp_api = DEFAULT_USE_XSMTP_API self.auto_deliver = DEFAULT_AUTO_DELIVER end |