Sha256: 5abe1d2fa94bf350e4e9a09294ac63ddc786a26cfae3808a7c0211ba381e1c4f
Contents?: true
Size: 622 Bytes
Versions: 2
Compression:
Stored size: 622 Bytes
Contents
require 'snapa/version' require 'rack/file' module Snapa class File < Rack::File def cmd 'phantomjs' end def script F.expand_path('../snapa.js', __FILE__) end def url(request) [@root, request.query_string].join('?') end def build(request) system [cmd, script, "'#{url(request)}'", "'#{@path}'"].join(' ') end def path(request) @path ||= F.join('/tmp/snapa', request.query_string + '.png') end def _call(env) request = ::Rack::Request.new(env) build(request) unless F.file?(path(request)) serving(env) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
snapa-0.0.4 | lib/snapa.rb |
snapa-0.0.3 | lib/snapa.rb |