Sha256: 69bcfe80bf68b8d4d5542283db1f3b3c14cc80c299dbac95fe92ee4febf8f2a5

Contents?: true

Size: 401 Bytes

Versions: 8

Compression:

Stored size: 401 Bytes

Contents

require 'valvat/checksum'

class Valvat
  module Checksum
    class IT < Base
      def validate
        y = figures_str[7..9].to_i
        y >= 1 && (y <= 100 || [120, 121].include?(y)) &&
        figures_str[0..6] != "0000000" &&
        super
      end

      def check_digit
        chk = 10 - sum_of_figures_for_at_es_it_se(true).modulo(10)
        chk == 10 ? 0 : chk
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
valvat-0.6.7 lib/valvat/checksum/it.rb
valvat-0.6.6 lib/valvat/checksum/it.rb
valvat-0.6.5 lib/valvat/checksum/it.rb
valvat-0.6.4 lib/valvat/checksum/it.rb
valvat-0.6.3 lib/valvat/checksum/it.rb
valvat-0.6.2 lib/valvat/checksum/it.rb
valvat-0.6.1 lib/valvat/checksum/it.rb
valvat-0.6.0 lib/valvat/checksum/it.rb