Barcodes for Ruby
When using Barby you probably want to do two things; create a barcode object and render it to an image or some other graphical representation.
First, you need to require "barby". If you haven't already, you also need to require "rubygems" first if you're using the gem. This will require all the different types of barcodes but no outputters will be required by default, so you'll need to require the ourputter you want to use.
Let's say you want to create a Code128 barcode and render a PNG image from it:
require 'rubygems'
require 'barby'
require 'barby/outputter/png_outputter'
barcode = Barby::Code128B.new('huwawa')
print barcode.to_png
The above will print the PNG to stdout, so you could for example invoke it like this:
ruby make_barcode.rb > barcode.png