Welcome to mirror list, hosted at ThFree Co, Russian Federation.

virtual_domain.rb « pages « models « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 7e42b8e6ae29d5270daf655685c4a81b3b42e99b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# frozen_string_literal: true

module Pages
  class VirtualDomain
    def initialize(projects, trim_prefix: nil, domain: nil)
      @projects = projects
      @trim_prefix = trim_prefix
      @domain = domain
    end

    def certificate
      domain&.certificate
    end

    def key
      domain&.key
    end

    def lookup_paths
      projects.map do |project|
        project.pages_lookup_path(trim_prefix: trim_prefix, domain: domain)
      end.sort_by(&:prefix).reverse
    end

    private

    attr_reader :projects, :trim_prefix, :domain
  end
end