Sha256: 3ba094743e6504ce006a4d61a103b5a15da1947a15c5e7b54bb00a9663a2827f

Contents?: true

Size: 517 Bytes

Versions: 5

Compression:

Stored size: 517 Bytes

Contents

# frozen_string_literal: true
module SensitiveDataFilter
  module Mask
    module_function def mask(value)
      return mask_array(value) if value.is_a? Array
      return mask_hash(value) if value.is_a? Hash
      SensitiveDataFilter.enabled_types.inject(value) { |acc, elem| elem.mask acc }
    end

    module_function def mask_array(array)
      array.map { |element| mask(element) }
    end

    module_function def mask_hash(hash)
      hash.map { |key, value| [mask(key), mask(value)] }.to_h
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
sensitive_data_filter-0.2.4 lib/sensitive_data_filter/mask.rb
sensitive_data_filter-0.2.3 lib/sensitive_data_filter/mask.rb
sensitive_data_filter-0.2.2 lib/sensitive_data_filter/mask.rb
sensitive_data_filter-0.2.1 lib/sensitive_data_filter/mask.rb
sensitive_data_filter-0.2.0 lib/sensitive_data_filter/mask.rb