Sha256: d0f9f69a25df30c5ba6e727c7e17fae840cbc79fbd5100b18a0dd8d44ce78bc9
Contents?: true
Size: 765 Bytes
Versions: 1
Compression:
Stored size: 765 Bytes
Contents
require "rack/utils" class Propshaft::Server def initialize(assembly) @assembly = assembly end def call(env) if asset = @assembly.load_path.find(requested_path(env)) compiled_content = @assembly.compilers.compile(asset) [ 200, { "Content-Length" => compiled_content.length.to_s, "Content-Type" => asset.content_type, "ETag" => asset.digest, "Cache-Control" => "public, must-revalidate" }, [ compiled_content ] ] else [ 404, { "Content-Type" => "text/plain", "Content-Length" => "9" }, [ "Not found" ] ] end end private def requested_path(env) Rack::Utils.unescape(env["PATH_INFO"].to_s.sub(/^\//, "")) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
propshaft-0.1.0 | lib/propshaft/server.rb |