Sha256: 46618fb8ff9cb87f0bc966c61ee9cc9a3a66b33fd98f2f60be677267c5c7597f

Contents?: true

Size: 555 Bytes

Versions: 77

Compression:

Stored size: 555 Bytes

Contents

module Scrivito
  module RequestHomepage
    HOMEPAGE_ENV_KEY = "SCRIVITO_HOMEPAGE"

    class << self
      def call(env)
        env[HOMEPAGE_ENV_KEY] ||= fetch_homepage(env)
      end

      private

      def fetch_homepage(env)
        callback_result = Scrivito::Configuration.choose_homepage_callback.call(env)
        if callback_result.is_a?(Obj)
          callback_result
        else
          raise "choose_homepage callback did not return an Obj. "\
            "Instead saw #{callback_result.class}."
        end
      end
    end
  end
end

Version data entries

77 entries across 77 versions & 1 rubygems

Version Path
scrivito_sdk-1.0.0.rc2 lib/scrivito/request_homepage.rb
scrivito_sdk-1.0.0.rc1 lib/scrivito/request_homepage.rb
scrivito_sdk-0.90.0 lib/scrivito/request_homepage.rb
scrivito_sdk-0.90.0.rc3 lib/scrivito/request_homepage.rb
scrivito_sdk-0.90.0.rc2 lib/scrivito/request_homepage.rb
scrivito_sdk-0.90.0.rc1 lib/scrivito/request_homepage.rb
scrivito_sdk-0.70.2 lib/scrivito/request_homepage.rb
scrivito_sdk-0.71.2 lib/scrivito/request_homepage.rb
scrivito_sdk-0.71.1 lib/scrivito/request_homepage.rb
scrivito_sdk-0.70.1 lib/scrivito/request_homepage.rb
scrivito_sdk-0.71.0 lib/scrivito/request_homepage.rb
scrivito_sdk-0.71.0.rc2 lib/scrivito/request_homepage.rb
scrivito_sdk-0.71.0.rc1 lib/scrivito/request_homepage.rb
scrivito_sdk-0.70.0 lib/scrivito/request_homepage.rb
scrivito_sdk-0.70.0.rc3 lib/scrivito/request_homepage.rb
scrivito_sdk-0.70.0.rc2 lib/scrivito/request_homepage.rb
scrivito_sdk-0.70.0.rc1 lib/scrivito/request_homepage.rb