Sha256: 68bf0034adfd54affb5ca2f1c2fd90a64176e21df3b47a3e2321f484b985df2b

Contents?: true

Size: 570 Bytes

Versions: 15

Compression:

Stored size: 570 Bytes

Contents

module Csv2hash
  module StructureValidator
    module Deprecation

      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' }

      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

    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
csv2hash-0.7.7 lib/csv2hash/structure_validator/deprecation.rb
csv2hash-0.7.6 lib/csv2hash/structure_validator/deprecation.rb
csv2hash-0.7.5 lib/csv2hash/structure_validator/deprecation.rb
csv2hash-0.7.3 lib/csv2hash/structure_validator/deprecation.rb
csv2hash-0.7.2 lib/csv2hash/structure_validator/deprecation.rb
csv2hash-0.7.1 lib/csv2hash/structure_validator/deprecation.rb
csv2hash-0.7.0 lib/csv2hash/structure_validator/deprecation.rb
csv2hash-0.6.8 lib/csv2hash/structure_validator/deprecation.rb
csv2hash-0.6.7 lib/csv2hash/structure_validator/deprecation.rb
csv2hash-0.6.6 lib/csv2hash/structure_validator/deprecation.rb
csv2hash-0.6.5 lib/csv2hash/structure_validator/deprecation.rb
csv2hash-0.6.4 lib/csv2hash/structure_validator/deprecation.rb
csv2hash-0.6.3 lib/csv2hash/structure_validator/deprecation.rb
csv2hash-0.6.2 lib/csv2hash/structure_validator/deprecation.rb
csv2hash-0.6.1 lib/csv2hash/structure_validator/deprecation.rb