Sha256: b0efbe4ec2e3c140ab6175a80d7b3a7050491d22df5c6134d17bc37097044a2b
Contents?: true
Size: 973 Bytes
Versions: 1
Compression:
Stored size: 973 Bytes
Contents
require 'rqrcode' module RhetButler module Web class QrDisplayApp def initialize(files, path) @config = files.aspect_config(:presenter) @templates = files.aspect_templates(:presenter) @path = path end attr_reader :template_handler def call(env) url = [env["rack.url_scheme"], "://"] if env["HTTP_HOST"].nil? or env["HTTP_HOST"].empty? url << env["SERVER_NAME"] url << ":" url << env["SERVER_PORT"] else url << env["HTTP_HOST"] end view_url = url.join("") + "/" url << @path url = url.join("") qr = RQRCode::QRCode.new(url, :size => 5) mime_type = "text/html" generator = HTMLGenerator.new(@config, @templates) [200, {'Content-Type' => mime_type}, [ generator.render("presenter-qr.html", qr, :view_url => view_url, :presenter_url => url) ]] end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rhet-butler-0.5.0 | lib/rhet-butler/web/qr-display-app.rb |