Class: Ticket::QRCode
- Inherits:
-
Object
- Object
- Ticket::QRCode
- Defined in:
- app/models/ticket/qr_code.rb
Instance Method Summary collapse
-
#initialize(ticket, order = nil) ⇒ QRCode
constructor
A new instance of QRCode.
- #render(file) ⇒ Object
- #text ⇒ Object
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 |
#text ⇒ Object
7 8 9 |
# File 'app/models/ticket/qr_code.rb', line 7 def text ticket.uuid end |