class Rusen::Settings
Attributes
Public Class Methods
Create a new Settings
object using the given
attributes.
@param [Hash<String, Object>] attrs a hash with the
options used to create a setting object.
# File lib/rusen/settings.rb, line 24 def initialize(attrs = {}) (attrs || {}).each do |attr_name, value| method_name = "#{attr_name}=".to_sym self.send(method_name, value) if self.respond_to?(method_name) end end
Public Instance Methods
Returns the notification email prefix.
Default: ‘[Exception] ’
@return [String]
# File lib/rusen/settings.rb, line 46 def email_prefix @email_prefix || '[Exception] ' end
Returns the email for email notifications.
Default: :smtp
@return [Symbol]
# File lib/rusen/settings.rb, line 55 def email_via @email_via || :smtp end
Returns the notification email recipients.
Default: []
@return [Array<String>]
# File lib/rusen/settings.rb, line 73 def exception_recipients @exception_recipients || [] end
Returns whether to send or not the notification for a exception.
Default: lambda { |exception| false }
@return [Block]
# File lib/rusen/settings.rb, line 104 def exclude_if @exclude_if || lambda { |exception| false } end
Returns the parameters we need to filter from being sent on
the notification, this will be used to not send sensitive data to the developers credit card numbers for instance.
@note
If this is used with a rails app we use the config filter parameters from there if the filter parameters are not defined.
@return [Array]
# File lib/rusen/settings.rb, line 118 def filter_parameters if @filter_parameters @filter_parameters || [] else defined?(Rails) && Rails.configuration.filter_parameters end end
Returns the configured outputs.
Default: [:mail]
@return [Array<Symbol>]
# File lib/rusen/settings.rb, line 37 def outputs @outputs || [:mail] end
Returns the configured sections.
Default: [:backtrace, :request, :session, :environment]
@return [Array<Symbol>]
# File lib/rusen/settings.rb, line 82 def sections @sections || [:backtrace, :request, :session, :environment] end
Returns the notification email sender.
Default: ”
@return [String]
# File lib/rusen/settings.rb, line 64 def sender_address @sender_address || '' end
Returns the email smtp settings, if Rusen
is included on a Rails
application the smtp settings for the application is returned, otherwise an empty has is returned.
@return [Hash<Symbol, Object>]
# File lib/rusen/settings.rb, line 91 def smtp_settings if @smtp_settings @smtp_settings else (defined?(Rails) && Rails.configuration.action_mailer.smtp_settings) || {} end end