Module: Csv2hash::StructureValidator::Deprecation

Included in:
Csv2hash::StructureValidator
Defined in:
lib/csv2hash/structure_validator/deprecation.rb

Constant Summary

OLD_MAX_COLUMN =
'MaxColumns'.freeze
OLD_MIN_COLUMN =
'MinColumns'.freeze
OLD_RULES_NAME =
[ OLD_MIN_COLUMN, OLD_MAX_COLUMN ]
NEW_SYNTAX =
{ OLD_MIN_COLUMN => 'min_columns', OLD_MAX_COLUMN => 'max_columns' }

Instance Method Summary (collapse)

Instance Method Details

- (Object) check_params(rule)



10
11
12
13
14
15
16
17
# File 'lib/csv2hash/structure_validator/deprecation.rb', line 10

def check_params rule
  if OLD_RULES_NAME.include? rule
    warn "[DEPRECATION]: `#{rule}` is deprecated.  Please use `#{NEW_SYNTAX[rule]}` instead."
    NEW_SYNTAX[rule]
  else
    rule.to_s
  end
end