module Turnout::MaintenancePage

Public Class Methods

all() click to toggle source
# File lib/turnout/maintenance_page.rb, line 6
def self.all
  @all ||= []
end
best_for(env) click to toggle source
# File lib/turnout/maintenance_page.rb, line 10
def self.best_for(env)
  request = Rack::Accept::Request.new(env)

  all_types = all.map(&:media_types).flatten
  best_type = request.best_media_type(all_types)
  best = all.find { |page| page.media_types.include?(best_type) && File.exist?(page.new.custom_path) }
  best || Turnout.config.default_maintenance_page
end