Class: Codeowners::Result

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

Direct Known Subclasses

ListContributors::Result

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(pattern = nil, owners = []) ⇒ Result

Returns a new instance of Result.



7
8
9
10
# File 'lib/codeowners/result.rb', line 7

def initialize(pattern = nil, owners = [])
  @pattern = pattern
  @owners = owners
end

Instance Attribute Details

#ownersObject (readonly)

Returns the value of attribute owners.



5
6
7
# File 'lib/codeowners/result.rb', line 5

def owners
  @owners
end

Instance Method Details

#successful?Boolean

Returns:

  • (Boolean)


12
13
14
# File 'lib/codeowners/result.rb', line 12

def successful?
  !@pattern.nil?
end

#to_aObject



20
21
22
# File 'lib/codeowners/result.rb', line 20

def to_a
  @owners.dup.flatten
end

#to_sObject



16
17
18
# File 'lib/codeowners/result.rb', line 16

def to_s
  "#{@pattern}\n\n#{@owners.join('\n')}"
end