Class: Codeowners::ListContributors::Result

Inherits:
Result
  • Object
show all
Defined in:
lib/codeowners/list_contributors.rb

Instance Attribute Summary

Attributes inherited from Result

#owners

Instance Method Summary collapse

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

Returns:

  • (Boolean)


13
14
15
# File 'lib/codeowners/list_contributors.rb', line 13

def successful?
  !@file.nil?
end

#to_aObject



21
22
23
# File 'lib/codeowners/list_contributors.rb', line 21

def to_a
  @contributors.dup
end

#to_csvObject



25
26
27
# File 'lib/codeowners/list_contributors.rb', line 25

def to_csv
  @contributors.map(&:to_csv).join("\n")
end

#to_sObject



17
18
19
# File 'lib/codeowners/list_contributors.rb', line 17

def to_s
  [@file, "", *@contributors.map(&:to_s)].join("\n")
end