Class: Cased::Sensitive::Handler

Inherits:
Object
  • Object
show all
Defined in:
lib/cased/sensitive/handler.rb

Class Attribute Summary collapse

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(label, handler) ⇒ Handler

Returns a new instance of Handler.



20
21
22
23
# File 'lib/cased/sensitive/handler.rb', line 20

def initialize(label, handler)
  @label = label.to_sym
  @handler = prepare_handler(handler)
end

Class Attribute Details

.handlersObject



6
7
8
# File 'lib/cased/sensitive/handler.rb', line 6

def self.handlers
  @handlers ||= []
end

Instance Attribute Details

#labelObject (readonly)

Returns the value of attribute label.



18
19
20
# File 'lib/cased/sensitive/handler.rb', line 18

def label
  @label
end

Class Method Details

.register(label, handler) ⇒ Object



14
15
16
# File 'lib/cased/sensitive/handler.rb', line 14

def self.register(label, handler)
  handlers << Handler.new(label, handler)
end

Instance Method Details

#call(audit_event, key, value) ⇒ Object



25
26
27
# File 'lib/cased/sensitive/handler.rb', line 25

def call(audit_event, key, value)
  @handler.call(audit_event, key.to_sym, value)
end