Sha256: 1e6af268fe2b17235fb507f5b5cdae7b00fdc6edd2a3e593d34567fbe0d89b20
Contents?: true
Size: 578 Bytes
Versions: 2
Compression:
Stored size: 578 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 < Base def _call(env) super 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['steam.path'] = path end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
locomotivecms_steam-0.1.2.pre.beta | lib/locomotive/steam/middlewares/path.rb |
locomotivecms_steam-0.1.1 | lib/locomotive/steam/middlewares/path.rb |