Class: PreCommit::ErrorList

Inherits:
Struct
  • Object
show all
Defined in:
lib/pre-commit/error_list.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(errors = []) ⇒ ErrorList

Returns a new instance of ErrorList.



6
7
8
9
10
11
12
# File 'lib/pre-commit/error_list.rb', line 6

def initialize(errors = [])
  case errors
  when "",nil then errors = []
  when String then errors = [PreCommit::Line.new(errors)]
  end
  super errors
end

Instance Attribute Details

#errorsObject

Returns the value of attribute errors

Returns:

  • (Object)

    the current value of errors



4
5
6
# File 'lib/pre-commit/error_list.rb', line 4

def errors
  @errors
end

Instance Method Details

#to_aObject



14
15
16
# File 'lib/pre-commit/error_list.rb', line 14

def to_a
  errors.map(&:to_s)
end

#to_sObject



18
19
20
# File 'lib/pre-commit/error_list.rb', line 18

def to_s
  to_a.join("\n")
end