Sha256: 3d238066a52ded3cd2c747ba9d7cb2d90b4ab60bc0470522ec4d61d7ca423e07
Contents?: true
Size: 952 Bytes
Versions: 7
Compression:
Stored size: 952 Bytes
Contents
class Logasm module Preprocessors module Strategies class Mask MASK_SYMBOL = '*'.freeze MASKED_VALUE = MASK_SYMBOL * 5 def initialize(trie) @trie = trie end def process(data, pointer = '') return MASKED_VALUE unless @trie.include?(pointer) case data when Hash process_hash(data, pointer) when Array process_array(data, pointer) else data end end private def process_hash(data, parent_pointer) data.each_with_object({}) do |(key, value), result| result[key] = process(value, "#{parent_pointer}/#{key}") end end def process_array(data, parent_pointer) data.each_with_index.map do |value, index| process(value, "#{parent_pointer}/#{index}") end end end end end end
Version data entries
7 entries across 7 versions & 2 rubygems