Class: Gas::User
- Inherits:
-
Object
- Object
- Gas::User
- Defined in:
- lib/gas/user.rb
Overview
Class that contains data for a git user
Instance Attribute Summary collapse
-
#email ⇒ Object
readonly
Returns the value of attribute email.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#nickname ⇒ Object
readonly
Returns the value of attribute nickname.
Instance Method Summary collapse
-
#git_user ⇒ String
Returns the git format of user.
-
#initialize(name, email, nickname = '') ⇒ User
constructor
A new instance of User.
-
#to_s(use_nickname = true) ⇒ String
Overides to_s to output in the correct format.
Constructor Details
#initialize(name, email, nickname = '') ⇒ User
Returns a new instance of User.
11 12 13 14 15 16 |
# File 'lib/gas/user.rb', line 11 def initialize(name, email, nickname = '') @name = name @email = email @nickname = nickname end |
Instance Attribute Details
#email ⇒ Object (readonly)
Returns the value of attribute email.
5 6 7 |
# File 'lib/gas/user.rb', line 5 def email @email end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
5 6 7 |
# File 'lib/gas/user.rb', line 5 def name @name end |
#nickname ⇒ Object (readonly)
Returns the value of attribute nickname.
5 6 7 |
# File 'lib/gas/user.rb', line 5 def nickname @nickname end |
Instance Method Details
#git_user ⇒ String
Returns the git format of user
20 21 22 |
# File 'lib/gas/user.rb', line 20 def git_user to_s false end |
#to_s(use_nickname = true) ⇒ String
Overides to_s to output in the correct format
27 28 29 |
# File 'lib/gas/user.rb', line 27 def to_s(use_nickname = true) " [#{use_nickname ? @nickname : 'user'}]\n name = #{@name}\n email = #{@email}" end |