Sha256: 261906a683d7b113821f5f796e335ad5ea46a77fea97ea8f457da06ff4da5dc3
Contents?: true
Size: 595 Bytes
Versions: 15
Compression:
Stored size: 595 Bytes
Contents
# frozen_string_literal: true module Maglev # Retrieve a page from a path and a locale # (previously extracted by the ExtractLocale service) class FetchPage include Injectable argument :path argument :locale argument :default_locale argument :fallback_to_default_locale, default: false def call page = fetch_page(path, locale) page = fetch_page(path, default_locale) if !page && fallback_to_default_locale page end protected def fetch_page(path, locale) Maglev::Page.by_path(path || 'index', locale).first end end end
Version data entries
15 entries across 15 versions & 1 rubygems