class Rusen::Settings

Attributes

email_prefix[W]
email_via[W]
exception_recipients[W]
exclude_if[W]
filter_parameters[W]
log4r_config_file[RW]
logger_name[RW]
outputs[W]
sections[W]
sender_address[W]
smtp_settings[W]

Public Class Methods

new(attrs = {}) click to toggle source

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

email_prefix() click to toggle source

Returns the notification email prefix.

Default: ‘[Exception] ’

@return [String]

# File lib/rusen/settings.rb, line 46
def email_prefix
  @email_prefix || '[Exception] '
end
email_via() click to toggle source

Returns the email for email notifications.

Default: :smtp

@return [Symbol]

# File lib/rusen/settings.rb, line 55
def email_via
  @email_via || :smtp
end
exception_recipients() click to toggle source

Returns the notification email recipients.

Default: []

@return [Array<String>]

# File lib/rusen/settings.rb, line 73
def exception_recipients
  @exception_recipients || []
end
exclude_if() click to toggle source

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
filter_parameters() click to toggle source

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
outputs() click to toggle source

Returns the configured outputs.

Default: [:mail]

@return [Array<Symbol>]

# File lib/rusen/settings.rb, line 37
def outputs
  @outputs || [:mail]
end
sections() click to toggle source

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
sender_address() click to toggle source

Returns the notification email sender.

Default: ”

@return [String]

# File lib/rusen/settings.rb, line 64
def sender_address
  @sender_address || ''
end
smtp_settings() click to toggle source

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