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