class Airbrake::Config::Processor
Processor
is a helper class, which is responsible for setting default config values, default notifier filters and remote configuration changes.
@since v5.0.0 @api private
Public Class Methods
new(config)
click to toggle source
@param [Airbrake::Config] config
# File lib/airbrake-ruby/config/processor.rb, line 16 def initialize(config) @config = config @blocklist_keys = @config.blocklist_keys @allowlist_keys = @config.allowlist_keys @project_id = @config.project_id @poll_callback = Airbrake::RemoteSettings::Callback.new(config) end
process(config)
click to toggle source
@param [Airbrake::Config] config @return [Airbrake::Config::Processor]
# File lib/airbrake-ruby/config/processor.rb, line 11 def self.process(config) new(config).process end
Public Instance Methods
add_filters(notifier)
click to toggle source
@param [Airbrake::NoticeNotifier] notifier @return [void]
# File lib/airbrake-ruby/config/processor.rb, line 61 def add_filters(notifier) return unless @config.root_directory [ Airbrake::Filters::RootDirectoryFilter, Airbrake::Filters::GitRevisionFilter, Airbrake::Filters::GitRepositoryFilter, Airbrake::Filters::GitLastCheckoutFilter, ].each do |filter| next if notifier.has_filter?(filter) notifier.add_filter(filter.new(@config.root_directory)) end end
process_allowlist(notifier)
click to toggle source
@param [Airbrake::NoticeNotifier] notifier @return [void]
# File lib/airbrake-ruby/config/processor.rb, line 35 def process_allowlist(notifier) return if @allowlist_keys.none? allowlist = Airbrake::Filters::KeysAllowlist.new(@allowlist_keys) notifier.add_filter(allowlist) end
process_blocklist(notifier)
click to toggle source
@param [Airbrake::NoticeNotifier] notifier @return [void]
# File lib/airbrake-ruby/config/processor.rb, line 26 def process_blocklist(notifier) return if @blocklist_keys.none? blocklist = Airbrake::Filters::KeysBlocklist.new(@blocklist_keys) notifier.add_filter(blocklist) end
process_remote_configuration()
click to toggle source
@return [Airbrake::RemoteSettings]
# File lib/airbrake-ruby/config/processor.rb, line 43 def process_remote_configuration return unless @config.remote_config return unless @project_id # Never poll remote configuration in the test environment. return if @config.environment == 'test' # If the current environment is ignored, don't try to poll remote # configuration. return if @config.ignore_environments.include?(@config.environment) RemoteSettings.poll(@project_id, @config.remote_config_host) do |data| @poll_callback.call(data) end end