Class: Codeowners::ListContributors::Result
- Defined in:
- lib/codeowners/list_contributors.rb
Instance Attribute Summary
Attributes inherited from Result
Instance Method Summary collapse
-
#initialize(file = nil, contributors = []) ⇒ Result
constructor
A new instance of Result.
- #successful? ⇒ Boolean
- #to_a ⇒ Object
- #to_csv ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(file = nil, contributors = []) ⇒ Result
Returns a new instance of Result.
8 9 10 11 |
# File 'lib/codeowners/list_contributors.rb', line 8 def initialize(file = nil, contributors = []) @file = file @contributors = contributors end |
Instance Method Details
#successful? ⇒ Boolean
13 14 15 |
# File 'lib/codeowners/list_contributors.rb', line 13 def successful? !@file.nil? end |
#to_a ⇒ Object
21 22 23 |
# File 'lib/codeowners/list_contributors.rb', line 21 def to_a @contributors.dup end |
#to_csv ⇒ Object
25 26 27 |
# File 'lib/codeowners/list_contributors.rb', line 25 def to_csv @contributors.map(&:to_csv).join("\n") end |
#to_s ⇒ Object
17 18 19 |
# File 'lib/codeowners/list_contributors.rb', line 17 def to_s [@file, "", *@contributors.map(&:to_s)].join("\n") end |