Class: Probe::ColumnMatchesRegEx
- Inherits:
-
ColumnMeetsCondition
- Object
- RowMeetsCondition
- ColumnMeetsCondition
- Probe::ColumnMatchesRegEx
- Defined in:
- lib/csv/probe/checks.rb
Overview
Check if a column value is a date with a given format
Instance Attribute Summary
Attributes inherited from ColumnMeetsCondition
#fail_msg, #ok_condition_fn, #varname
Attributes inherited from RowMeetsCondition
#fail_msg, #ok_condition_fn, #pre_checks, #severity
Instance Method Summary collapse
-
#initialize(varname, expected_regex_pattern, _placeholder = nil) ⇒ ColumnMatchesRegEx
constructor
A new instance of ColumnMatchesRegEx.
Methods inherited from ColumnMeetsCondition
#evaluate, #render_pretty_fail_msg
Methods inherited from RowMeetsCondition
#error_msg, #evaluate, #evaluate_pre_checks, #render_fail_msg, #render_pretty_fail_msg, #report_columns_hash, #source_row, #source_row_location
Constructor Details
#initialize(varname, expected_regex_pattern, _placeholder = nil) ⇒ ColumnMatchesRegEx
Returns a new instance of ColumnMatchesRegEx.
184 185 186 187 188 |
# File 'lib/csv/probe/checks.rb', line 184 def initialize(varname, expected_regex_pattern, _placeholder = nil) super(varname, nil, nil) @ok_condition_fn = ->(val, _cfg) { val.to_s =~ expected_regex_pattern } @fail_msg = "expected to match regex pattern #{expected_regex_pattern.inspect}" end |