Class: Masking::Config::TargetColumns::Column

Inherits:
Object
  • Object
show all
Defined in:
lib/masking/config/target_columns/column.rb

Defined Under Namespace

Classes: ColumnNameIsNil

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, table_name:, method_value:) ⇒ Column

Returns a new instance of Column.

Raises:



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

def initialize(name, table_name:, method_value:)
  raise ColumnNameIsNil if name.nil?

  @name         = name.to_sym
  @table_name   = table_name.to_sym
  @method_value = method_value
  @method       = Method.new(method_value)
end

Instance Attribute Details

#indexObject

Returns the value of attribute index.



10
11
12
# File 'lib/masking/config/target_columns/column.rb', line 10

def index
  @index
end

#method_valueObject (readonly)

Returns the value of attribute method_value.



9
10
11
# File 'lib/masking/config/target_columns/column.rb', line 9

def method_value
  @method_value
end

#nameObject (readonly)

Returns the value of attribute name.



9
10
11
# File 'lib/masking/config/target_columns/column.rb', line 9

def name
  @name
end

#table_nameObject (readonly)

Returns the value of attribute table_name.



9
10
11
# File 'lib/masking/config/target_columns/column.rb', line 9

def table_name
  @table_name
end

Instance Method Details

#==(other) ⇒ Object



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

def ==(other)
  name == other.name && table_name == other.table_name && method_value == other.method_value
end

#masked_valueObject



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

def masked_value
  method.call
end