Method: LogicalModel::SafeLog::ClassMethods#mask_sensitive_attributes

Defined in:
lib/logical_model/safe_log.rb

#mask_sensitive_attributes(parsed_response) ⇒ Object



87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
# File 'lib/logical_model/safe_log.rb', line 87

def mask_sensitive_attributes(parsed_response)
  if parsed_response.is_a?(Hash)
    parsed_response.each do |k,v|
      if sensitive_attributes.include?(k.to_sym)
        parsed_response[k] = SECRET_PLACEHOLDER
      else
        parsed_response[k] = mask_sensitive_attributes(v)
      end
    end
  elsif parsed_response.is_a?(Array)
    parsed_response.map! do |v|
      mask_sensitive_attributes(v)
    end
  end
  parsed_response
end