A small utility for JAN code.
Add this line to your application's Gemfile:
gem 'jan'
And then execute:
$ bundle
Or install it yourself as:
$ gem install jan
jan = Jan.new("4901277241126")
jan.valid? # => true
Jan::Validator.validate("4901277241126") # => true
# Correct code: "4901277241126"
Jan::CheckDigitCalculator.calculate("490127724112") # => 6
jan = Jan.new("4901277241126")
jan.check_digit # => 6
jan.body # => "490127724112"
Jan::Parser.check_digit("4901277241126") # => 6
Jan::Parser.body("4901277241126") # => "490127724112"
jan = Jan.new("4901277241126")
jan.instore_code? # => false
Jan::Paser.instore_code?("2163179230340") # => true
Jan::Random.code # => "5689450935688"
Jan::Random.code(8) # => "11774853"
Jan::Random.instore_code # => "2799375754394"
Jan::Random.instore_code(8) # => "27393086"
- Fork it ( https://github.com/[my-github-username]/jan/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request