QRencode::QRcode
Inherits Reference / Object
The main class for QR symbol generation.
Constructors
Creates a new QRcode instance from string.
version is a QR version code. If 0 (the default) is given, then libqrencode chooses
the minimum possible version.
level is an ECLevel value, corresponding to the level of error-correction to apply.
hint is an EncodeMode value, corresponding to the encoding used by the QR code.
If casesensitive is set to false, then the data is encoded in all caps (as applies).
If micro is set to true, then a Micro QR code is generated instead (experimental).
Raises EncodeError on any of the following failure conditions:
- The given string is invalid given hint (
EINVAL) - Memory allocation fails (
ENOMEM) - The given string is too large to fit into a QR code (
ERANGE)
qr = QRencode::QRcode.new("hello")
# Crystal strings are UTF-8, so this works without `EncodeMode::MODE_KANJI`!
qr2 = QRencode::QRcode.new("こんにちは")
Creates a new QRcode instance from data.
Always uses EncodeMode::MODE_8.
Instance methods
The actual module (dot) data of the QR symbol. Util contains methods for interacting
with these bytes.