class Epilog::Filter::HashKey

Public Instance Methods

call(log) click to toggle source
# File lib/epilog/filter/hash_key.rb, line 6
def call(log)
  fix(log)
end

Private Instance Methods

filter(value) click to toggle source
# File lib/epilog/filter/hash_key.rb, line 36
def filter(value)
  "[filtered #{value.class.name}]"
end
fix(value) click to toggle source
# File lib/epilog/filter/hash_key.rb, line 12
def fix(value)
  if value.is_a?(Hash)
    fix_hash(value)
  elsif value.is_a?(Array)
    value.map { |i| fix(i) }
  else
    value
  end
end
fix_hash(hash) click to toggle source
# File lib/epilog/filter/hash_key.rb, line 22
def fix_hash(hash)
  hash.each_with_object({}) do |(key, value), obj|
    obj[key] = if key?(key)
      filter(value)
    else
      fix(value)
    end
  end
end
key?(_key) click to toggle source
# File lib/epilog/filter/hash_key.rb, line 32
def key?(_key)
  true
end