Class: QrForge::QrData
- Inherits:
-
Object
- Object
- QrForge::QrData
- Defined in:
- lib/qr_forge/qr_data.rb
Overview
QrData is a wrapper around RQRCodeCore::QRCode that provides a simplified interface for accessing QR code data. We can also add additional data related to the QR code, but not always RQRCodeCore related
Instance Attribute Summary collapse
-
#module_count ⇒ Object
readonly
Returns the value of attribute module_count.
-
#modules ⇒ Object
readonly
Returns the value of attribute modules.
-
#quiet_zone ⇒ Object
readonly
Returns the value of attribute quiet_zone.
-
#version ⇒ Object
readonly
Returns the value of attribute version.
Instance Method Summary collapse
-
#initialize(text:, version: 10, level: :h) ⇒ QrData
constructor
A new instance of QrData.
Constructor Details
#initialize(text:, version: 10, level: :h) ⇒ QrData
Returns a new instance of QrData.
13 14 15 16 17 18 |
# File 'lib/qr_forge/qr_data.rb', line 13 def initialize(text:, version: 10, level: :h) qr = ::RQRCodeCore::QRCode.new(text, size: version, level: level) @version = qr.version @modules = qr.modules.map(&:dup) @module_count = @modules.size end |
Instance Attribute Details
#module_count ⇒ Object (readonly)
Returns the value of attribute module_count.
11 12 13 |
# File 'lib/qr_forge/qr_data.rb', line 11 def module_count @module_count end |
#modules ⇒ Object (readonly)
Returns the value of attribute modules.
11 12 13 |
# File 'lib/qr_forge/qr_data.rb', line 11 def modules @modules end |
#quiet_zone ⇒ Object (readonly)
Returns the value of attribute quiet_zone.
11 12 13 |
# File 'lib/qr_forge/qr_data.rb', line 11 def quiet_zone @quiet_zone end |
#version ⇒ Object (readonly)
Returns the value of attribute version.
11 12 13 |
# File 'lib/qr_forge/qr_data.rb', line 11 def version @version end |