Class: Masking::Config::TargetColumns

Inherits:
Object
  • Object
show all
Defined in:
lib/masking/config/target_columns.rb,
lib/masking/config/target_columns/table.rb,
lib/masking/config/target_columns/column.rb,
lib/masking/config/target_columns/method.rb,
lib/masking/config/target_columns/method/date.rb,
lib/masking/config/target_columns/method/null.rb,
lib/masking/config/target_columns/method/time.rb,
lib/masking/config/target_columns/method/float.rb,
lib/masking/config/target_columns/method/binary.rb,
lib/masking/config/target_columns/method/string.rb,
lib/masking/config/target_columns/method/boolean.rb,
lib/masking/config/target_columns/method/integer.rb,
lib/masking/config/target_columns/method/string_binary_distinctor.rb

Overview

TODO: find better naming of TargetColumns

Defined Under Namespace

Classes: Column, Method, Table

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(file_path) ⇒ TargetColumns

Returns a new instance of TargetColumns.



14
15
16
17
18
19
# File 'lib/masking/config/target_columns.rb', line 14

def initialize(file_path)
  @file_path = file_path

  raise Masking::Error::ConfigFileDoesNotExist unless file_path.exist?
  raise Masking::Error::ConfigFileIsNotFile unless file_path.file?
end

Instance Attribute Details

#file_pathObject (readonly)

Returns the value of attribute file_path.



12
13
14
# File 'lib/masking/config/target_columns.rb', line 12

def file_path
  @file_path
end

Instance Method Details

#==(other) ⇒ Object



30
31
32
# File 'lib/masking/config/target_columns.rb', line 30

def ==(other)
  file_path == other.file_path
end

#columns(table_name:) ⇒ Object

TODO: refactoring



26
27
28
# File 'lib/masking/config/target_columns.rb', line 26

def columns(table_name:)
  tables[table_name.to_sym]&.columns
end

#contains?(table_name:) ⇒ Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/masking/config/target_columns.rb', line 21

def contains?(table_name:)
  data.key?(table_name)
end