module PiiSafeSchema::Annotations
Constants
- COLUMNS
- SENSITIVE_DATA_NAMES
Public Class Methods
comment(annotation_type)
click to toggle source
# File lib/pii_safe_schema/annotations.rb, line 73 def self.comment(annotation_type) COLUMNS.dig(annotation_type.to_sym, :comment) end
Public Instance Methods
apply_encrypted_recommendation?(column)
click to toggle source
# File lib/pii_safe_schema/annotations.rb, line 87 def apply_encrypted_recommendation?(column) encrypted?(column) && column.comment != COLUMNS[:encrypted_data][:comment].to_json end
apply_recommendation?(column, pii_info)
click to toggle source
# File lib/pii_safe_schema/annotations.rb, line 77 def apply_recommendation?(column, pii_info) !encrypted?(column) && pii_info[:regexp].match?(column.name) && column.comment != pii_info[:comment].to_json end
encrypted?(column)
click to toggle source
# File lib/pii_safe_schema/annotations.rb, line 83 def encrypted?(column) COLUMNS[:encrypted_data][:regexp].match?(column.name) end
recommended_comment(column)
click to toggle source
# File lib/pii_safe_schema/annotations.rb, line 64 def recommended_comment(column) return COLUMNS[:encrypted_data][:comment] if apply_encrypted_recommendation?(column) COLUMNS.each do |_type, info| return info[:comment] if apply_recommendation?(column, info) end nil end