Home > Code > Personnummer

Personnummer

Personnummer is a Ruby gem that handles Swedish personal identity numbers.

Getting started

Install the gem:

sudo gem install personnummer

Example usage

>> p = Personnummer.new('830428-5912')
=> #<Personnummer:0x301128 @number="830428-5912", @age=27, @valid=true, @region="Skaraborgs l\303\244n", @female=false, @born=#<Date: 4890905/2,0,2299161>>
>> p.valid?
=> true

Bugs/Feature Requests

The full and most up to date source is at GitHub:

http://github.com/c7/personnummer/

You can clone or fork from there to fix or break the code.

I’m happy to take feature requests/bug reports. Just email me (peter@c7.se) or message me on GitHub.

License

This code is free to use under the terms of the MIT license.