Skip to content

macuk/nip-plugin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Nip
===

This plugin provides the Nip class to check the NIP number.

NIP (Numer Identyfikacji Podatkowej) is the Polish Tax Identification Number. 

More information (in Polish language):
http://pl.wikipedia.org/wiki/NIP

Installation
============

script/plugin install git://github.com/macuk/nip.git

Example
=======

Standalone class:

  nip = Nip.new('845-167-08-82')
  nip.valid?  # true
  nip.to_s    # '8451670882'

ActiveRecord:

  class Company < ActiveRecord::Base
    validate :check_nip

    private
      def check_nip
        n = Nip.new(nip)
        message = 'Invalid NIP number'
        errors.add(:nip, message) unless n.valid?
      end
  end


Copyright (c) 2010 Piotr Macuk, released under the MIT license

About

This plugin provides the Nip class to check the NIP number.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages