class Locomotive::Steam::Middlewares::Path
Sanitize the path from the previous middleware in order to make it work for the renderer.
Public Instance Methods
call(env)
click to toggle source
# File lib/locomotive/steam/middlewares/path.rb, line 11 def call(env) set_path!(env) app.call(env) end
Protected Instance Methods
set_path!(env)
click to toggle source
# File lib/locomotive/steam/middlewares/path.rb, line 18 def set_path!(env) path = env['steam.path'].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