Sha256: 387e273c63b7fc71f1904eb8318398aafc401970efd4bb54f6233a024a1b94d6
Contents?: true
Size: 586 Bytes
Versions: 15
Compression:
Stored size: 586 Bytes
Contents
# frozen_string_literal: true require 'uri' module Maglev class PreviewConstraint attr_reader :preview_host def initialize(preview_host: nil) @preview_host = preview_host == true ? default_preview_host : preview_host end def matches?(request) %i[html xml].include?(request.format.symbol) && (!preview_host || preview_host == request.host) end protected def default_preview_host return nil if Maglev.config.preview_host.blank? URI.parse(Maglev.config.preview_host).host # make sure we get only the host here end end end
Version data entries
15 entries across 15 versions & 1 rubygems