Sha256: dad9948f8c06a67e97f72ad8a152cce129375c70f689b37bc3617e8864828482
Contents?: true
Size: 820 Bytes
Versions: 1
Compression:
Stored size: 820 Bytes
Contents
module VueCK class Plugin RESPONSE_TYPES = { "vue.js" => "application/javascript", "vue.css" => "text/css" } def initialize(app={}) @app = app end def call(env) return unless env["REQUEST_METHOD"] == "GET" file = env["PATH_INFO"][1..-1] return @app.call(env) unless file == FILES[:javascript] || file == FILES[:style] vueck = VueCK.new(file) content = vueck.serve_file response(content, file) end def response(content, file) ["200", { "Content-Type" => RESPONSE_TYPES[file], "Content-Length" => content.size.to_s }, [content]] end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
vueck-1.0.1 | lib/plugin.rb |