jan is a small utility gem for JAN code.
- Ruby
- 2.7.x
- 2.6.x
- 2.5.x
Add this line to your application's Gemfile:
gem 'jan'
And then execute:
$ bundle
Or install it yourself as:
$ gem install jan
code = Jan::Code.new('4901277241126')
code.valid? # => true
code.body # => '490127724112'
code.check_digit # => '6'
code.source_marking? # => true
code.instore_marking? # => false
body = Jan::CodeBody.new('490127724112')
body.calculate_check_digit # => '6'
body.generate_code # => '4901277241126'
random = Jan::Random.new
random.code # => '5689450935688'
random.instore_code # => '2799375754394'
Bug reports and pull requests are welcome.
- Install dependencies
bundle install
- Run tests
rake spec