Project

spain_dni

0.0
No release in over 3 years
Low commit activity in last 3 years
This gem verifies the last letter or a DNI/NIE and has methods to generate fake ones for testing.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.16
~> 10.0
~> 3.0
 Project Readme

SpainDni

A tool for validating Spanish DNI/NIE numbers. Checks for validity, can calculate the check letter and return type of id (DNI or NIE).

Installation

Add this line to your application's Gemfile:

gem 'spain_dni'

And then execute:

$ bundle

Or install it yourself as:

$ gem install spain_dni

Usage

Create a new instance of Dni class:

dni = SpainDni::Dni.new('53428132Y')

dni.valid?
=> true

dni.valid_letter
=> 'Y'

Id type can be checked by using:

dni.id_type
=> 'DNI'

Or using the helper methods:

dni.dni?
=>true

dni.nie?
=> false 

## Development

After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.


## License

The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).