Class: Airbrake::Config::Processor Private

Inherits:
Object
  • Object
show all
Defined in:
lib/airbrake-ruby/config/processor.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Processor is a helper class, which is responsible for setting default config values, default notifier filters and remote configuration changes.

Since:

  • v5.0.0

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ Processor

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Processor.

Parameters:

Since:

  • v5.0.0



16
17
18
19
20
21
22
# 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

Class Method Details

.process(config) ⇒ Airbrake::Config::Processor

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Parameters:

Returns:

Since:

  • v5.0.0



11
12
13
# File 'lib/airbrake-ruby/config/processor.rb', line 11

def self.process(config)
  new(config).process
end

Instance Method Details

#add_filters(notifier) ⇒ void

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

This method returns an undefined value.

Parameters:

Since:

  • v5.0.0



61
62
63
64
65
66
67
68
69
70
71
72
73
74
# 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) ⇒ void

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

This method returns an undefined value.

Parameters:

Since:

  • v5.0.0



35
36
37
38
39
40
# 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) ⇒ void

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

This method returns an undefined value.

Parameters:

Since:

  • v5.0.0



26
27
28
29
30
31
# 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_configurationAirbrake::RemoteSettings

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

Since:

  • v5.0.0



43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# 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