Class: Logasm::Preprocessors::Strategies::Prune

Inherits:
Object
  • Object
show all
Defined in:
lib/logasm/preprocessors/strategies/prune.rb

Instance Method Summary collapse

Constructor Details

#initialize(trie) ⇒ Prune

Returns a new instance of Prune.



5
6
7
# File 'lib/logasm/preprocessors/strategies/prune.rb', line 5

def initialize(trie)
  @trie = trie
end

Instance Method Details

#process(data, pointer = '') ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/logasm/preprocessors/strategies/prune.rb', line 9

def process(data, pointer = '')
  return nil unless @trie.include?(pointer)

  case data
  when Hash
    process_hash(data, pointer)

  when Array
    process_array(data, pointer)

  else
    data
  end
end