Class: MultiGit::Handle
- Inherits:
-
Struct
- Object
- Struct
- MultiGit::Handle
- Defined in:
- lib/multi_git/handle.rb
Overview
Encapsulates name + email. Mostly used for commits.
Constant Summary collapse
- DEFAULT =
parse("MultiGit <[email protected]>")
Instance Attribute Summary collapse
-
#email ⇒ Object
Returns the value of attribute email.
-
#name ⇒ Object
Returns the value of attribute name.
Class Method Summary collapse
-
.parse(string) ⇒ Handle
Parses a handle from a string.
Instance Attribute Details
#email ⇒ Object
Returns the value of attribute email
3 4 5 |
# File 'lib/multi_git/handle.rb', line 3 def email @email end |
#name ⇒ Object
Returns the value of attribute name
3 4 5 |
# File 'lib/multi_git/handle.rb', line 3 def name @name end |
Class Method Details
.parse(string) ⇒ Handle
Parses a handle from a string
Currently two formats are recognized. Either just a mail address (e.g. ‘[email protected]’) or user + mail address in brackets ( e.g. ‘User <[email protected]>’ ).
22 23 24 25 26 27 28 |
# File 'lib/multi_git/handle.rb', line 22 def self.parse(string) case(string) when EMAIL then return new(string, string) when NAME_WITH_EMAIL then return new($1,$2) else raise ArgumentError, "Unknown handle format: #{string}. Please use either '[email protected]' or 'User <[email protected]>'" end end |