Working @GitHub Support, programming for fun, working remotely, love cooking and food, and want to learn how to play the guitar.
Published on 2009-12-30
In a previous post I mentioned that I started maintaining a set of helper Ruby classes for working with barcodes. I have changed the structure of the project to make it a gem and I have published it on GemCutter.
First you need to install the gem:
sudo gem install pabarcode
then the example in the previous post needs to change so as it uses the gem instead of the plain Ruby file:
require "rubygems"
require "pabarcode"
include PAbarcode
file = File.open("apog.txt")
file.each do |line|
bc = line.slice(0..11)
bc13 = Barcode.new(bc).get_ean_13
puts bc13 + line.slice(12..line.length)
end
file.close