A pure Ruby library for generating QR codes with multiple output formats. Generate QR codes as text art for terminal display or as scalable SVG graphics for web and print applications.
This is a fork of rqrcode_core
, which was originally adapted in 2008 from a Javascript library by Kazuhiko Arase.
- Pure Ruby: No external dependencies, works with any Ruby application.
- Multiple Output Formats: Text (Unicode blocks) and SVG output built-in.
- Automatic Optimization: Intelligently selects the most efficient encoding (numeric, alphanumeric, or binary).
- Error Correction: Full support for all four standardized error correction levels (L, M, Q, H).
- Multi-Segment Encoding: Optimize large data by mixing encoding modes in a single QR code.
- Command Line Tools: Bake tasks for generating QR codes from the terminal.
- Standards Compliant: Follows ISO/IEC 18004 QR Code specification.
Please see the project documentation for more details.
- Getting Started - This guide explains how to get started with
qrcode
to generate QR codes in Ruby.
Please see the project releases for all releases.
- Added transparent SVG background support using
light_color: nil
orlight_color: "transparent"
.
- Breaking: Complete refactor of encoder architecture with cleaner segment-based design.
- Breaking: Renamed
RSBlock
toErrorCorrectionBlock
with cleaner method names (for
,table_entry_for
). - Breaking: Simplified
Code
constructor to take segments array, addedCode.build()
factory method. - Breaking: Removed redundant
Multi
class - multi-segment support now built intoCode
directly. - Breaking: Renamed ASCII output to Text output (
QRCode.text()
instead ofQRCode.ascii()
). - Breaking: Renamed
ERROR_CORRECT_LEVEL
toERROR_CORRECTION_LEVEL
for better grammar. - Added self-contained segment classes:
Segment
,NumericSegment
,AlphanumericSegment
. - Added comprehensive test coverage for output functionality (Text and SVG).
- Added
size
alias formodule_count
for cleaner API. - Added proper documentation explaining error correction level encoding from ISO/IEC 18004.
- Added getting started guide with comprehensive usage examples.
- Improved code organization with
QRCode::Encoder
namespace for all encoding classes. - Removed QR prefix from encoder file and class names for cleaner codebase.
We welcome contributions to this project.
- Fork it.
- Create your feature branch (
git checkout -b my-new-feature
). - Commit your changes (
git commit -am 'Add some feature'
). - Push to the branch (
git push origin my-new-feature
). - Create new Pull Request.
In order to protect users of this project, we require all contributors to comply with the Developer Certificate of Origin. This ensures that all contributions are properly licensed and attributed.
This project is best served by a collaborative and respectful environment. Treat each other professionally, respect differing viewpoints, and engage constructively. Harassment, discrimination, or harmful behavior is not tolerated. Communicate clearly, listen actively, and support one another. If any issues arise, please inform the project maintainers.