Class: Datadog::AppSec::Component

Inherits:
Object
  • Object
show all
Defined in:
lib/datadog/appsec/component.rb

Overview

Core-pluggable component for AppSec

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(processor:) ⇒ Component

Returns a new instance of Component.



29
30
31
# File 'lib/datadog/appsec/component.rb', line 29

def initialize(processor:)
  @processor = processor
end

Instance Attribute Details

#processorObject (readonly)

Returns the value of attribute processor.



27
28
29
# File 'lib/datadog/appsec/component.rb', line 27

def processor
  @processor
end

Class Method Details

.build_appsec_component(settings) ⇒ Object



10
11
12
13
14
15
# File 'lib/datadog/appsec/component.rb', line 10

def build_appsec_component(settings)
  return unless settings.respond_to?(:appsec) && settings.appsec.enabled

  processor = create_processor
  new(processor: processor)
end

Instance Method Details

#shutdown!Object



33
34
35
36
37
38
# File 'lib/datadog/appsec/component.rb', line 33

def shutdown!
  if processor && processor.ready?
    processor.finalize
    @processor = nil
  end
end