Sha256: a41c6bb433fbbc54cd8f90c12741548f259216552f16003bb88820ed28f88894

Contents?: true

Size: 310 Bytes

Versions: 1

Compression:

Stored size: 310 Bytes

Contents

require "jan/parser"
require "jan/check_digit_calculator"

class Jan
  module Validator
    module_function

    def validate(code)
      code = code.to_s
      return false unless [8,13].include?(code.size)
      Parser.check_digit(code) == CheckDigitCalculator.calculate(Parser.body(code))
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
jan-0.0.1 lib/jan/validator.rb