Class: VoucherDecorator

Inherits:
Draper::Decorator
  • Object
show all
Defined in:
app/decorators/voucher_decorator.rb

Overview

typed: ignore frozen_string_literal: true

Instance Method Summary collapse

Instance Method Details

#qrcode_data_urlObject



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'app/decorators/voucher_decorator.rb', line 7

def qrcode_data_url
  qrcode = RQRCode::QRCode.new(object.id.to_s)
  png = qrcode.as_png(
    bit_depth: 1,
    border_modules: 4,
    color_mode: ChunkyPNG::COLOR_GRAYSCALE,
    color: 'black',
    file: nil,
    fill: 'white',
    module_px_size: 6,
    resize_exactly_to: false,
    resize_gte_to: false,
    size: 120
  )
  png.to_data_url
end