Class: Ticket::QRCode

Inherits:
Object
  • Object
show all
Defined in:
app/models/ticket/qr_code.rb

Instance Method Summary collapse

Constructor Details

#initialize(ticket, order = nil) ⇒ QRCode

Returns a new instance of QRCode.



2
3
4
5
# File 'app/models/ticket/qr_code.rb', line 2

def initialize(ticket, order = nil)
  @ticket = ticket
  @order = order
end

Instance Method Details

#render(file) ⇒ Object



11
12
13
14
# File 'app/models/ticket/qr_code.rb', line 11

def render(file)
  png = RQRCode::QRCode.new(text.to_s, :size => 4, :level => :l).to_img
  png.resize(150, 150).save(file)
end

#textObject



7
8
9
# File 'app/models/ticket/qr_code.rb', line 7

def text
  ticket.uuid
end