Skip to content

Instantly share code, notes, and snippets.

@roolo
Last active December 14, 2015 01:19
Show Gist options
  • Save roolo/5005600 to your computer and use it in GitHub Desktop.
Save roolo/5005600 to your computer and use it in GitHub Desktop.
Barby usage example
$ rake encode['Madonna na nohy do o']

Generated QR Code

require 'barby'
require 'barby/barcode/qr_code'
require 'barby/outputter/png_outputter'
desc 'Encodes text into QR Code'
task :encode, [:text] do |t, args|
barcode = Barby::QrCode.new(args[:text])
outputter = Barby::PngOutputter.new(barcode)
File.open('barcode.png', 'w'){|f| f.write outputter.to_png }
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment