Class: Git::Duo::Pair
- Inherits:
-
Object
- Object
- Git::Duo::Pair
- Defined in:
- lib/git/duo/pair.rb
Instance Attribute Summary collapse
-
#authors ⇒ Object
readonly
Returns the value of attribute authors.
-
#wrapper ⇒ Object
readonly
Returns the value of attribute wrapper.
Instance Method Summary collapse
- #email ⇒ Object
-
#initialize(authors, opts = {}) ⇒ Pair
constructor
A new instance of Pair.
- #name ⇒ Object
- #save ⇒ Object
- #to_s ⇒ Object (also: #inspect)
Constructor Details
#initialize(authors, opts = {}) ⇒ Pair
Returns a new instance of Pair.
9 10 11 12 |
# File 'lib/git/duo/pair.rb', line 9 def initialize , opts = {} = .sort_by {|| .key } @wrapper = opts.fetch(:wrapper) { Git::Duo::Wrapper.new File.join(Dir.pwd, '.git') } end |
Instance Attribute Details
#authors ⇒ Object (readonly)
Returns the value of attribute authors.
7 8 9 |
# File 'lib/git/duo/pair.rb', line 7 def end |
#wrapper ⇒ Object (readonly)
Returns the value of attribute wrapper.
7 8 9 |
# File 'lib/git/duo/pair.rb', line 7 def wrapper @wrapper end |
Instance Method Details
#email ⇒ Object
18 19 20 21 22 23 24 |
# File 'lib/git/duo/pair.rb', line 18 def email if .size > 1 base_email.gsub "%names", .map(&:key).join(?+) else .first.email end end |
#name ⇒ Object
14 15 16 |
# File 'lib/git/duo/pair.rb', line 14 def name .map(&:name).join ' + ' end |
#save ⇒ Object
31 32 33 34 |
# File 'lib/git/duo/pair.rb', line 31 def save save_pair_name save_pair_email end |
#to_s ⇒ Object Also known as: inspect
26 27 28 |
# File 'lib/git/duo/pair.rb', line 26 def to_s "#{name} <#{email}>" end |