summaryrefslogtreecommitdiff
path: root/lib/gitlab/git/user.rb
blob: ea634d3966877fdbf519ba9d512d67c67e555cb2 (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
module Gitlab
  module Git
    class User
      attr_reader :name, :email, :gl_id

      def self.from_gitlab(gitlab_user)
        new(gitlab_user.name, gitlab_user.email, Gitlab::GlId.gl_id(gitlab_user))
      end

      def self.from_gitaly(gitaly_user)
        new(gitaly_user.name, gitaly_user.email, gitaly_user.gl_id)
      end

      def initialize(name, email, gl_id)
        @name = name
        @email = email
        @gl_id = gl_id
      end

      def ==(other)
        [name, email, gl_id] == [other.name, other.email, other.gl_id]
      end
    end
  end
end