Class: Masking::Config::TargetColumns::Column
- Inherits:
-
Object
- Object
- Masking::Config::TargetColumns::Column
- Defined in:
- lib/masking/config/target_columns/column.rb
Defined Under Namespace
Classes: ColumnNameIsNil
Instance Attribute Summary collapse
-
#method ⇒ Object
readonly
Returns the value of attribute method.
-
#method_value ⇒ Object
readonly
Returns the value of attribute method_value.
-
#table_name ⇒ Object
readonly
Returns the value of attribute table_name.
Instance Method Summary collapse
- #==(other) ⇒ Object
- #ignore_null? ⇒ Boolean
-
#initialize(name, table_name:, method_value:) ⇒ Column
constructor
A new instance of Column.
- #name ⇒ Object
Constructor Details
#initialize(name, table_name:, method_value:) ⇒ Column
Returns a new instance of Column.
11 12 13 14 15 16 17 18 |
# File 'lib/masking/config/target_columns/column.rb', line 11 def initialize(name, table_name:, method_value:) raise ColumnNameIsNil if name.nil? @original_name = name.to_sym @table_name = table_name.to_sym @method_value = method_value @method = Method.new(method_value, ignore_null: ignore_null?) end |
Instance Attribute Details
#method ⇒ Object (readonly)
Returns the value of attribute method.
9 10 11 |
# File 'lib/masking/config/target_columns/column.rb', line 9 def method @method end |
#method_value ⇒ Object (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 |
#table_name ⇒ Object (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
20 21 22 |
# File 'lib/masking/config/target_columns/column.rb', line 20 def ==(other) name == other.name && table_name == other.table_name && method_value == other.method_value end |
#ignore_null? ⇒ Boolean
28 29 30 |
# File 'lib/masking/config/target_columns/column.rb', line 28 def ignore_null? @ignore_null ||= original_name.to_s.end_with?(IGNORE_NULL_SUFFIX) end |
#name ⇒ Object
24 25 26 |
# File 'lib/masking/config/target_columns/column.rb', line 24 def name @name ||= ignore_null? ? original_name.to_s.chomp(IGNORE_NULL_SUFFIX).to_sym : original_name end |