[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-8079":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":16,"subscribersCount":16,"size":16,"stars1d":16,"stars7d":16,"stars30d":17,"stars90d":16,"forks30d":16,"starsTrendScore":16,"compositeScore":18,"rankGlobal":10,"rankLanguage":10,"license":19,"archived":20,"fork":20,"defaultBranch":21,"hasWiki":20,"hasPages":20,"topics":22,"createdAt":10,"pushedAt":10,"updatedAt":26,"readmeContent":27,"aiSummary":28,"trendingCount":16,"starSnapshotCount":16,"syncStatus":29,"lastSyncTime":30,"discoverSource":31},8079,"rqrcode","whomwah\u002Frqrcode","whomwah","A Ruby library that encodes QR Codes","",null,"Ruby",1997,239,27,1,0,13,20.14,"MIT License",false,"main",[23,24,25],"qrcode","qrcode-generator","ruby","2026-06-12 02:01:48","# RQRCode\n\n![](https:\u002F\u002Fgithub.com\u002Fwhomwah\u002Frqrcode\u002Factions\u002Fworkflows\u002Fruby.yml\u002Fbadge.svg)\n[![Ruby Style Guide](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Fcode_style-standard-brightgreen.svg)](https:\u002F\u002Fgithub.com\u002Ftestdouble\u002Fstandard)\n\n[RQRCode](https:\u002F\u002Fgithub.com\u002Fwhomwah\u002Frqrcode) is a library for creating and rendering QR codes into various formats. It has a simple interface with all the standard QR code options. It was adapted from the Javascript library by Kazuhiko Arase.\n\n- QR code is trademarked by Denso Wave inc\n- Minimum Ruby version is `>= 3.2.0`\n\n## Installing\n\nAdd this line to your application's `Gemfile`:\n\n```ruby\ngem \"rqrcode\", \"~> 3.0\"\n```\n\nor install manually:\n\n```ruby\ngem install rqrcode\n```\n\n## Basic usage example\n\n```ruby\nrequire \"rqrcode\"\n\nqr = RQRCode::QRCode.new(\"https:\u002F\u002Fkyan.com\")\n\nputs qr.to_s\n# to_s( dark: \"x\", light: \" \" ) # defaults\n\nxxxxxxx xxxxxxx  xxx  xxxxxxx\nx     x  x  xxx   xx  x     x\nx xxx x xx x x     xx x xxx x\nx xxx x      xx xx xx x xxx x\nx xxx x x x       xxx x xxx x\nx     x  xxx x xx x x x     x\n...\n```\n\nEasy, but unlikely to be readable. For this you will need to use one of the many [rendering options](#render-types) below.\n\n### Advanced Options\n\nThese are the various QR code generation options provided by the underlying [rqrcode_core](https:\u002F\u002Fgithub.com\u002Fwhomwah\u002Frqrcode_core). You may actually only need this library if you don't need the various rendering options `rqrcode` provides, but just need the data structure.\n\n```\nExpects a string or array (for multi-segment encoding) to be parsed in, other args are optional\n\n  data - the string, QRSegment or array of Hashes (with data:, mode: keys) you wish to encode\n\n  size - the size (Integer) of the QR Code (defaults to smallest size needed to encode the data)\n\n  max_size - the max_size (Integer) of the QR Code (default RQRCodeCore::QRUtil.max_size)\n\n  level - the error correction level, can be:\n    * Level :l 7%  of code can be restored\n    * Level :m 15% of code can be restored\n    * Level :q 25% of code can be restored\n    * Level :h 30% of code can be restored (default :h)\n\n  mode - the mode of the QR Code (defaults to :alphanumeric or :byte_8bit, depending on the input data,\n         only used when data is a string):\n    * :number\n    * :alphanumeric\n    * :byte_8bit\n```\n\nExample\n\n```ruby\nsimple_qrcode = RQRCodeCore::QRCode.new(\"https:\u002F\u002Fkyan.com\", size: 2, level: :m, mode: :byte_8bit)\n\nsegment_qrcode = RQRCodeCore::QRCode.new([{ data: \"foo\", mode: :byte_8bit }])\n\nmulti_qrcode = RQRCodeCore::QRCode.new([\n  { data: 'foo', mode: :byte_8bit },\n  { data: 'BAR1', mode: :alphanumeric }\n])\n```\n\n## Render types\n\nYou probably want to output your QR code in a specific format. We make this easy by providing a bunch of formats to choose from below, each with their own set of options:\n\n### `as_svg`\n\nThe SVG renderer will produce a stand-alone SVG as a `String`\n\n```\nOptions:\n\noffset          - Padding around the QR Code in pixels\n                  (default 0)\noffset_x        - X Padding around the QR Code in pixels\n                  (default offset)\noffset_y        - Y Padding around the QR Code in pixels\n                  (default offset)\nfill            - Background color e.g \"ffffff\" or :white or :currentColor\n                  (default none)\ncolor           - Foreground color e.g \"000\" or :black or :currentColor\n                  (default \"000\")\nmodule_size     - The Pixel size of each module\n                  (defaults 11)\nshape_rendering - SVG Attribute: auto | optimizeSpeed | crispEdges | geometricPrecision\n                  (defaults crispEdges)\nstandalone      - Whether to make this a full SVG file, or only an svg to embed in other svg\n                  (default true)\nuse_path        - Use \u003Cpath> to render SVG rather than \u003Crect> to significantly reduce size.\n                  This will become the default in future versions.\n                  (default false)\nviewbox         - Replace the `svg.width` and `svg.height` attribute with `svg.viewBox` to\n                  allow CSS scaling\n                  (default false)\nsvg_attributes  - A optional hash of custom \u003Csvg> attributes. Existing attributes will remain.\n                  (default {})\n```\n\nExample\n\n```ruby\nrequire \"rqrcode\"\n\nqrcode = RQRCode::QRCode.new(\"http:\u002F\u002Fgithub.com\u002F\")\n\n# NOTE: showing with default options specified explicitly\nsvg = qrcode.as_svg(\n  color: \"000\",\n  shape_rendering: \"crispEdges\",\n  module_size: 11,\n  standalone: true,\n  use_path: true\n)\n```\n\n![QR code with github url](.\u002Fimages\u002Fgithub-qrcode.svg)\n\n### `as_png`\n\nThe will produce a PNG using the [ChunkyPNG gem](https:\u002F\u002Fgithub.com\u002Fwvanbergen\u002Fchunky_png). The result will be a `ChunkyPNG::Image` instance.\n\n```\nOptions:\n\nfill  - Background \u003CChunkyPNG::Color>, defaults to 'white'. Use [] for multi args\ncolor - Foreground \u003CChunkyPNG::Color>, defaults to 'black'. Use [] for multi args\n\nWhen option :file is supplied you can use the following ChunkyPNG constraints:\n\ncolor_mode  - The color mode to use. Use one of the ChunkyPNG::COLOR_* constants.\n              (defaults to 'ChunkyPNG::COLOR_GRAYSCALE')\nbit_depth   - The bit depth to use. This option is only used for indexed images.\n              (defaults to 1 bit)\ninterlace   - Whether to use interlacing (true or false).\n              (defaults to ChunkyPNG default)\ncompression - The compression level for Zlib. This can be a value between 0 and 9, or a\n              Zlib constant like Zlib::BEST_COMPRESSION\n              (defaults to ChunkyPNG default)\n\nThere are two sizing algorithms.\n\n* Original that can result in blurry and hard to scan images\n* Google's Chart API inspired sizing that resizes the module size to fit within the given image size.\n\nThe Google one will be used when no options are given or when the new size option is used.\n\n*Google Sizing*\n\nsize            - Total size of PNG in pixels. The module size is calculated so it fits.\n                  (defaults to 120)\nborder_modules  - Width of white border around the modules.\n                  (defaults to 4).\n\n-- DONT USE border_modules OPTION UNLESS YOU KNOW ABOUT THE QUIET ZONE NEEDS OF QR CODES --\n\n*Original Sizing*\n\nmodule_px_size  - Image size, in pixels.\nborder          - Border thickness, in pixels\n\nIt first creates an image where 1px = 1 module, then resizes.\nDefaults to 120x120 pixels, customizable by option.\n```\n\nExample\n\n```ruby\nrequire \"rqrcode\"\n\nqrcode = RQRCode::QRCode.new(\"http:\u002F\u002Fgithub.com\u002F\")\n\n# NOTE: showing with default options specified explicitly\npng = qrcode.as_png(\n  bit_depth: 1,\n  border_modules: 4,\n  color_mode: ChunkyPNG::COLOR_GRAYSCALE,\n  color: \"black\",\n  file: nil,\n  fill: \"white\",\n  module_px_size: 6,\n  resize_exactly_to: false,\n  resize_gte_to: false,\n  size: 120\n)\n\nIO.binwrite(\"\u002Ftmp\u002Fgithub-qrcode.png\", png.to_s)\n```\n\n![QR code with github url](.\u002Fimages\u002Fgithub-qrcode.png)\n\n### `as_ansi`\n\nThe ANSI renderer will produce as a string with ANSI color codes.\n\n```\nOptions:\n\nlight           - Foreground ANSI code\n                  (default \"\\033[47m\")\ndark            - Background ANSI code\n                  (default \"\\033[40m\")\nfill_character  - The written character\n                  (default '  ')\nquiet_zone_size - Padding around the edge\n                  (default 4)\n```\n\nExample\n\n```ruby\nrequire \"rqrcode\"\n\nqrcode = RQRCode::QRCode.new(\"http:\u002F\u002Fgithub.com\u002F\")\n\n# NOTE: showing with default options specified explicitly\nsvg = qrcode.as_ansi(\n  light: \"\\033[47m\", dark: \"\\033[40m\",\n  fill_character: \"  \",\n  quiet_zone_size: 4\n)\n```\n\n![QR code with github url](.\u002Fimages\u002Fansi-screen-shot.png)\n\n## API Documentation\n\n[http:\u002F\u002Fwww.rubydoc.info\u002Fgems\u002Frqrcode](http:\u002F\u002Fwww.rubydoc.info\u002Fgems\u002Frqrcode)\n\n## Tests\n\nYou can run the test suite using:\n\n```\n$ bundle install\n$ rake      # runs specs and standard:fix\n$ rake spec # just runs the specs\n```\n\nor try the lib from the console with:\n\n```\n$ .\u002Fbin\u002Fconsole\n```\n\n## Linting\n\nThe project uses [standardrb](https:\u002F\u002Fgithub.com\u002Ftestdouble\u002Fstandard) and can be used with:\n\n```\n$ bundle install\n$ rake standard # checks\n$ rake standard:fix # fixes\n```\n\n## Benchmarks\n\nRQRCode includes comprehensive performance benchmarks for tracking export format performance over time. See the [benchmark README](benchmark\u002FREADME.md) for details on running benchmarks, interpreting results, and current performance baselines.\n\n## Contributing\n\nI am not currently accepting any new renderers as the current `as_png`, `as_svg` and `as_ansi` work for most cases. If you need something different from what's available, the [`rqrcode_core`](https:\u002F\u002Fgithub.com\u002Fwhomwah\u002Frqrcode_core) gem gives you access to all the QR Code information you will need so makes it simple to generate your own.\n\nThe motivation for the above is because the rendering side of this gem takes up the most time. It seems that many people want a slightly different version of a QR Code so supporting all the variations would be hard. The easiest way is to empower people to create their own versions which they can manage and share. This is what `rqrcode_core` does.\n\nAny contribution PR's will be greatly accepted. It's important that they are well tested and backwards compatible.\n\n- Fork the project\n- Send a pull request\n- Don't touch the .gemspec, I'll do that when I release a new version\n\nThanks D.\n\n## Authors\n\nOriginal RQRCode author: Duncan Robertson\n\nA massive thanks to [all the contributors of the library over the years](https:\u002F\u002Fgithub.com\u002Fwhomwah\u002Frqrcode\u002Fgraphs\u002Fcontributors). It wouldn't exist if it wasn't for you all.\n\nOh, and thanks to my bosses at https:\u002F\u002Fkyan.com for giving me time to maintain this project.\n\n## Resources\n\n- wikipedia:: http:\u002F\u002Fen.wikipedia.org\u002Fwiki\u002FQR_Code\n- Denso-Wave website:: http:\u002F\u002Fwww.denso-wave.com\u002Fqrcode\u002Findex-e.html\n- kaywa:: http:\u002F\u002Fqrcode.kaywa.com\n\n## Copyright\n\nMIT License (http:\u002F\u002Fwww.opensource.org\u002Flicenses\u002Fmit-license.html)\n","RQRCode 是一个用于生成和渲染二维码的 Ruby 库。它提供了一个简单的接口，支持所有标准的二维码选项，并且可以将二维码输出为多种格式，如 SVG、ANSI 等。该库基于 Kazuhiko Arase 的 JavaScript 版本改编而来，最低兼容 Ruby 3.2.0 版本。RQRCode 支持高级选项配置，比如二维码大小、纠错级别以及数据模式等，使得开发者可以根据具体需求定制二维码。此外，通过与 rqrcode_core 库结合使用，用户还能进一步控制二维码的数据结构。适用于需要在 Ruby 项目中快速集成二维码生成功能的场景，例如网站、移动应用或任何需要以编程方式生成二维码的服务。",2,"2026-06-11 03:15:58","top_language"]