Skip to content

scalone/mruby-qrcode

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mruby-qrcode

A simple mrbgem to generate QR Codes.

Example

Initialize the object with contents you want in the QR code qr = QR.new("Hello world!"), later you'll be able to change these contents by changing the value of qr.msg. To generate the bytecodes of the QR code, simply call qr.generate()("bmp" as default format and 3 as default magnify), it will return a string buffer which you can use to write the QR code file.

qr  = QR.new("Hello world!")
buf = qr.generate("bmp", 3)
File.open("qrcode_hello_world.bmp", 'w') { |file| file.write(buf) }

The example above will generate the following QR code:

NOTE: By default, the filetype is BMP, you can change this by sending the file format to the generate method, the available formats are: PNG, BMP, TIFF, PBM, SVG, JSON, DIGIT and ASCII.

TEST

Run the tests with:

./run_test.rb test

LICENSE

Check the LICENSE file.

About

A simple mrbgem to generate QR Codes.

Resources

License

Stars

0 stars

Watchers

2 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Ruby 67.1%
  • C 32.9%