Class: Gitlab::Git::User
- Inherits:
-
Object
- Object
- Gitlab::Git::User
- Defined in:
- lib/gitlab/git/user.rb
Instance Attribute Summary collapse
-
#email ⇒ Object
readonly
Returns the value of attribute email.
-
#gl_id ⇒ Object
readonly
Returns the value of attribute gl_id.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#username ⇒ Object
readonly
Returns the value of attribute username.
Class Method Summary collapse
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#initialize(username, name, email, gl_id) ⇒ User
constructor
A new instance of User.
- #to_gitaly ⇒ Object
Constructor Details
#initialize(username, name, email, gl_id) ⇒ User
Returns a new instance of User.
21 22 23 24 25 26 |
# File 'lib/gitlab/git/user.rb', line 21 def initialize(username, name, email, gl_id) @username = username @name = name @email = email @gl_id = gl_id end |
Instance Attribute Details
#email ⇒ Object (readonly)
Returns the value of attribute email
6 7 8 |
# File 'lib/gitlab/git/user.rb', line 6 def email @email end |
#gl_id ⇒ Object (readonly)
Returns the value of attribute gl_id
6 7 8 |
# File 'lib/gitlab/git/user.rb', line 6 def gl_id @gl_id end |
#name ⇒ Object (readonly)
Returns the value of attribute name
6 7 8 |
# File 'lib/gitlab/git/user.rb', line 6 def name @name end |
#username ⇒ Object (readonly)
Returns the value of attribute username
6 7 8 |
# File 'lib/gitlab/git/user.rb', line 6 def username @username end |
Class Method Details
.from_gitaly(gitaly_user) ⇒ Object
12 13 14 15 16 17 18 19 |
# File 'lib/gitlab/git/user.rb', line 12 def self.from_gitaly(gitaly_user) new( gitaly_user.gl_username, Gitlab::EncodingHelper.encode!(gitaly_user.name), Gitlab::EncodingHelper.encode!(gitaly_user.email), gitaly_user.gl_id ) end |
Instance Method Details
#==(other) ⇒ Object
28 29 30 |
# File 'lib/gitlab/git/user.rb', line 28 def ==(other) [username, name, email, gl_id] == [other.username, other.name, other.email, other.gl_id] end |
#to_gitaly ⇒ Object
32 33 34 |
# File 'lib/gitlab/git/user.rb', line 32 def to_gitaly Gitaly::User.new(gl_username: username, gl_id: gl_id, name: name.b, email: email.b) end |