Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Small library for recognising and validating UPC numbers
Ruby
tree: e7d995d3ea

tweak README

latest commit e7d995d3ea
@yob authored
Failed to load latest commit information.
lib Fix a bug in the check digit calculation
spec Fix a bug in the check digit calculation
CHANGELOG initial commit
MIT-LICENSE initial commit
README.rdoc tweak README
Rakefile update rake file

README.rdoc

A small class for generating and validating Universal Product Codes (UPCs), the 12 digit codes found on many older US products.

Installation

gem install upc

Usage

UPC.new("632737715836").valid?
=> true

UPC.valid?("632737715836")
=> true

UPC.valid?("632737715837")
=> false

UPC.complete("63273771583")
=> "632737715836"

UPC.new("632737715836").to_ean
=> "0632737715836"

Further Reader

Contributing

Source code is publicly available @ github.com/yob/upc/tree/master. Patches welcome, preferably via a git repo I can pull from.

Something went wrong with that request. Please try again.