Skip to content
Ruby library for calculating reference number (viitenumere, referensnummer).
Ruby
Find file
Latest commit 76e2763 Sep 27, 2012 @akonan t push
Merge branch 'master' of https://github.com/akonan/reference_number

* 'master' of https://github.com/akonan/reference_number:
  Adds configuration for Travis
Failed to load latest commit information.
lib Release 0.0.1 Sep 27, 2012
spec Release 0.0.1 Sep 27, 2012
.travis.yml Adds configuration for Travis Sep 27, 2012
CHANGELOG.md Release 0.0.1 Sep 27, 2012
Gemfile Release 0.0.1 Sep 27, 2012
Gemfile.lock Release 0.0.1 Sep 27, 2012
LICENSE Release 0.0.1 Sep 27, 2012
README.md Adds travis badge to readme [ci skip] Sep 27, 2012
Rakefile Release 0.0.1 Sep 27, 2012
reference_number.gemspec Release 0.0.1 Sep 27, 2012

README.md

ReferenceNumber

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

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

Build Status

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".

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.

Something went wrong with that request. Please try again.