Sha256: 905ef3c5b3e8f0463da27080669e84d39687c7daa462ee218b91d0149e635e98
Contents?: true
Size: 459 Bytes
Versions: 35
Compression:
Stored size: 459 Bytes
Contents
module Rack class Backstage File = ::File def initialize(app, path) @app = app @file = File.expand_path(path) end def call(env) if File.exists?(@file) content = File.read(@file) length = "".respond_to?(:bytesize) ? content.bytesize.to_s : content.size.to_s [503, {'Content-Type' => 'text/html', 'Content-Length' => length}, [content]] else @app.call(env) end end end end
Version data entries
35 entries across 35 versions & 8 rubygems