Project

jan

0.01
No commit activity in last 3 years
No release in over 3 years
Validate and generate JAN code
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 2.0
~> 12.3
~> 3.8

Runtime

 Project Readme

Jan

Gem Version Build Status

jan is a small utility gem for JAN code.

Supported versions

  • Ruby
    • 2.7.x
    • 2.6.x
    • 2.5.x

Installation

Add this line to your application's Gemfile:

gem 'jan'

And then execute:

$ bundle

Or install it yourself as:

$ gem install jan

Usage

Basic

code = Jan::Code.new('4901277241126')

code.valid? # => true

code.body # => '490127724112'
code.check_digit # => '6'

code.source_marking? # => true
code.instore_marking? # => false

Calculate check digit

body = Jan::CodeBody.new('490127724112')

body.calculate_check_digit # => '6'
body.generate_code # => '4901277241126'

Generate random code

random = Jan::Random.new

random.code # => '5689450935688'
random.instore_code # => '2799375754394'

Contributing

Bug reports and pull requests are welcome.

  • Install dependencies
    • bundle install
  • Run tests
    • rake spec