Class: Hanami::Logger::Filter Private

Inherits:
Object
  • Object
show all
Defined in:
lib/hanami/logger/filter.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.

Filtering logic

Since:

  • 1.1.0

Instance Method Summary collapse

Constructor Details

#initialize(filters = []) ⇒ Filter

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 Filter.

Since:

  • 1.1.0



14
15
16
# File 'lib/hanami/logger/filter.rb', line 14

def initialize(filters = [])
  @filters = filters
end

Instance Method Details

#call(hash) ⇒ Object

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.

Since:

  • 1.1.0



20
21
22
23
24
25
26
27
# File 'lib/hanami/logger/filter.rb', line 20

def call(hash)
  _filtered_keys(hash).each do |key|
    *keys, last = _actual_keys(hash, key.split("."))
    keys.inject(hash, :fetch)[last] = "[FILTERED]"
  end

  hash
end