Sha256: 96f7616bc4590ce64971caece9d1816e694368e6da50bd9ae41b67af3af5b683
Contents?: true
Size: 845 Bytes
Versions: 9
Compression:
Stored size: 845 Bytes
Contents
module Locomotive::Steam module Middlewares # Retrieve a page from the path and the locale previously # fetched from the request. # class Page < ThreadSafe include Helpers def _call return env['steam.page'] if env['steam.page'] if page = fetch_page if !page.not_found? log "Found page \"#{page.title}\" [#{page.fullpath}]" else log "Page not found, rendering the 404 page.".magenta end end env['steam.page'] = page end protected def fetch_page services.page_finder.match(path).tap do |pages| if pages.size > 1 self.log "Found multiple pages: #{pages.map(&:title).join(', ')}" end end.first || services.page_finder.find('404') end end end end
Version data entries
9 entries across 9 versions & 1 rubygems