Sha256: e90e518790275a845a7a234f0a61d399e034bcfa0c74e4363463c6c5e5739184
Contents?: true
Size: 585 Bytes
Versions: 7
Compression:
Stored size: 585 Bytes
Contents
module Locomotive::Steam module Middlewares # Sanitize the path from the previous middleware in order # to make it work for the renderer. # class Path < Struct.new(:app) def call(env) set_path!(env) app.call(env) end protected def set_path!(env) path = env['steam.path'] || request.path_info path.gsub!(/\.[a-zA-Z][a-zA-Z0-9]{2,}$/, '') path.gsub!(/^\//, '') path.gsub!(/^[A-Z]:\//, '') path = 'index' if path.blank? env['steam.path'] = path end end end end
Version data entries
7 entries across 7 versions & 1 rubygems