0.01
Low commit activity in last 3 years
No release in over a year
No need to copy paste your old reference number codes anymore, just use this gem
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 0
~> 2.11.0
 Project Readme

ReferenceNumber

Ruby library for calculating reference number (viitenumero, referensnummer).

Original idea and code was gotten from Christian: http://snippets.aktagon.com/snippets/51-How-to-Calculate-a-reference-number-with-Ruby

Usage

Add this to your gem file:

gem "reference_number"

Example usage:

ReferenceNumber.new("1111").to_s
ReferenceNumber.new(1111).to_s

The above example prints out “11112”.

ReferenceNumber.new(1111, :zero_padding => true).to_s

The above example prints out zero padded reference number "00000000000000011112".

ReferenceNumber.new("111122223333", :grouping => true).to_s

The above example prints out a reference number in groups of five digits for better legibility "111 12222 33336".

This example shows how to generate a series of reference number:

(1000..1023).to_a.each do |number|
  puts ReferenceNumber.new(number).to_s
end

License

ReferenceNumber is licensed under the MIT License, for more details see the LICENSE file.

Releasing

# bump the version with one of these
gem install gem-release
gem bump --version minor # bumps to the next minor version
gem bump --version major # bumps to the next major version
gem bump --version 1.1.1 # bumps to the specified version

# release it to Rubygems.org
bundle exec rake release