Sha256: 6be4aa13d77830cc306201b352344ddce6ce3742e594ad29b62b11db0fb8ef36
Contents?: true
Size: 609 Bytes
Versions: 30
Compression:
Stored size: 609 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 attr_accessor_initialize :app def call(env) set_path!(env) app.call(env) end protected def set_path!(env) path = (env['steam.path'] || request.path_info).dup 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
30 entries across 30 versions & 1 rubygems