Exception: Voodoo::Parser::MultipleErrors
- Defined in:
- lib/voodoo/parser.rb
Overview
Class wrapping multiple Parser::Errors.
Instance Attribute Summary collapse
-
#errors ⇒ Object
readonly
Returns the value of attribute errors.
Attributes inherited from Error
#input_name, #start_column, #start_line
Instance Method Summary collapse
-
#initialize(errors) ⇒ MultipleErrors
constructor
A new instance of MultipleErrors.
- #message ⇒ Object
- #text ⇒ Object
Constructor Details
#initialize(errors) ⇒ MultipleErrors
Returns a new instance of MultipleErrors.
86 87 88 89 90 |
# File 'lib/voodoo/parser.rb', line 86 def initialize errors @errors = errors super(nil, errors[0].input_name, errors[0].start_line, errors[0].start_column, nil) end |
Instance Attribute Details
#errors ⇒ Object (readonly)
Returns the value of attribute errors.
92 93 94 |
# File 'lib/voodoo/parser.rb', line 92 def errors @errors end |
Instance Method Details
#message ⇒ Object
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 |
# File 'lib/voodoo/parser.rb', line 94 def if @message == nil msg = "Multiple errors:\n\n" @errors.each do |error| msg << error.input_name << ":" if error.input_name msg << "#{error.start_line}: " << error. if error.text != nil msg << "\n\n #{error.text.gsub("\n", "\n ")}" end msg << "\n" end @message = msg end @message end |
#text ⇒ Object
110 111 112 113 114 115 116 |
# File 'lib/voodoo/parser.rb', line 110 def text if @text == nil texts = @errors.map {|error| error.text} @text = texts.join "\n" end @text end |