Class: Croatia::QRCode

Inherits:
Object
  • Object
show all
Defined in:
lib/croatia/qr_code.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data, **options) ⇒ QRCode

Returns a new instance of QRCode.



16
17
18
19
# File 'lib/croatia/qr_code.rb', line 16

def initialize(data, **options)
  @data = data
  @options = options
end

Instance Attribute Details

#dataObject (readonly)

Returns the value of attribute data.



14
15
16
# File 'lib/croatia/qr_code.rb', line 14

def data
  @data
end

#optionsObject (readonly)

Returns the value of attribute options.



14
15
16
# File 'lib/croatia/qr_code.rb', line 14

def options
  @options
end

Class Method Details

.ensure_supported!Object

Raises:

  • (LoadError)


4
5
6
7
8
# File 'lib/croatia/qr_code.rb', line 4

def self.ensure_supported!
  return if supported?

  raise LoadError, "RQRCode library is not loaded. Please ensure you have the rqrcode gem installed and required."
end

.supported?Boolean

Returns:

  • (Boolean)


10
11
12
# File 'lib/croatia/qr_code.rb', line 10

def self.supported?
  defined?(RQRCode)
end

Instance Method Details

#to_png(**options) ⇒ Object



25
26
27
# File 'lib/croatia/qr_code.rb', line 25

def to_png(**options)
  qr_code.as_png(**options)
end

#to_svg(**options) ⇒ Object



21
22
23
# File 'lib/croatia/qr_code.rb', line 21

def to_svg(**options)
  qr_code.as_svg(**options)
end