class Masking::DataMaskProcessor
Attributes
cache_store[R]
insert_statement[R]
raw_line[R]
target_columns[R]
Public Class Methods
new( insert_statement_line, target_columns: ::Masking.config.target_columns, insert_statement: InsertStatement.new(insert_statement_line), cache_store: Cache )
click to toggle source
# File lib/masking/data_mask_processor.rb, line 9 def initialize( insert_statement_line, target_columns: ::Masking.config.target_columns, insert_statement: InsertStatement.new(insert_statement_line), cache_store: Cache ) @raw_line = insert_statement_line @target_columns = target_columns @insert_statement = insert_statement @cache_store = cache_store end
Public Instance Methods
process()
click to toggle source
# File lib/masking/data_mask_processor.rb, line 21 def process return raw_line unless target_table? column_indexes_mask_methods.each do |column_index, mask_method| next if column_index.nil? insert_statement.mask_value( column_index: column_index, mask_method: mask_method ) end insert_statement.sql end
Private Instance Methods
column_indexes_mask_methods()
click to toggle source
# File lib/masking/data_mask_processor.rb, line 44 def column_indexes_mask_methods cache_store.fetch_or_store_if_no_cache( table: table_name, proc: proc { target_columns.columns(table_name: table_name).map do |column| [insert_statement.column_index(column.name), column.method] end } ) end
table_name()
click to toggle source
# File lib/masking/data_mask_processor.rb, line 55 def table_name @table_name = insert_statement.table end
target_table?()
click to toggle source
# File lib/masking/data_mask_processor.rb, line 40 def target_table? target_columns.contains?(table_name: table_name) end