summaryrefslogtreecommitdiff
path: root/lib/gitlab/global_id.rb
blob: cc82b6c5897af7974652709e3d13d1b99e483ff1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
# frozen_string_literal: true

module Gitlab
  module GlobalId
    def self.build(object = nil, model_name: nil, id: nil, params: nil)
      if object
        model_name ||= object.class.name
        id ||= object.id
      end

      ::URI::GID.build(app: GlobalID.app, model_name: model_name, model_id: id, params: params)
    end
  end
end