Sha256: 4d42eed43508191137e0daf59b0221aabde22ca080689eae3c7f9d3045ff829b
Contents?: true
Size: 599 Bytes
Versions: 8
Compression:
Stored size: 599 Bytes
Contents
module Locomotive::Builder class Server # Sanitize the path from the previous middleware in order # to make it work for the renderer. # class Path < Middleware def call(env) self.set_accessors(env) self.set_path!(env) app.call(env) end protected def set_path!(env) path = env['PATH_INFO'].clone path.gsub!(/\.[a-zA-Z][a-zA-Z0-9]{2,}$/, '') path.gsub!(/^\//, '') path.gsub!(/^[A-Z]:\//, '') path = 'index' if path.blank? env['builder.path'] = path end end end end
Version data entries
8 entries across 8 versions & 1 rubygems