summaryrefslogtreecommitdiff
path: root/app/models/pages/virtual_domain.rb
blob: 3a876dc06a229fd48327a253514c0b02c6073a8b (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
# frozen_string_literal: true

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

    def certificate
      domain&.certificate
    end

    def key
      domain&.key
    end

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

    private

    attr_reader :projects, :domain
  end
end