Class: MxmlcOutputReader
- Inherits:
-
Object
- Object
- MxmlcOutputReader
- Defined in:
- lib/mxmlc_output/mxmlc_output_reader.rb
Overview
Formats the mxmlc to errors
Constant Summary collapse
- ERROR_LINE =
/^((\/([\w\.]+))+)(\((-?\d+)\))?:\s*(col: (\d+))?:?\s*(Error|Warning+): (.+)$/
Instance Attribute Summary collapse
-
#errors ⇒ Object
readonly
Returns the value of attribute errors.
Instance Method Summary collapse
-
#initialize(output) ⇒ MxmlcOutputReader
constructor
A new instance of MxmlcOutputReader.
-
#parse! ⇒ Object
example: /Users/japetheape/Projects/tunedustry/editor/src/com/tunedustry/editor/view/Controls.as(43): col: 32 Warning: return value for function ‘setPositions’ has no type declaration.
- #warnings ⇒ Object
Constructor Details
#initialize(output) ⇒ MxmlcOutputReader
Returns a new instance of MxmlcOutputReader.
9 10 11 12 13 |
# File 'lib/mxmlc_output/mxmlc_output_reader.rb', line 9 def initialize(output) @output = output = [] parse! end |
Instance Attribute Details
#errors ⇒ Object (readonly)
Returns the value of attribute errors.
6 7 8 |
# File 'lib/mxmlc_output/mxmlc_output_reader.rb', line 6 def errors @errors end |
Instance Method Details
#parse! ⇒ Object
example: /Users/japetheape/Projects/tunedustry/editor/src/com/tunedustry/editor/view/Controls.as(43): col: 32 Warning: return value for function ‘setPositions’ has no type declaration.
33 34 35 36 37 38 39 40 41 42 |
# File 'lib/mxmlc_output/mxmlc_output_reader.rb', line 33 def parse! @output.each_line do |l| matches = ERROR_LINE.match(l) if !matches.nil? << MxmlcError.new(matches[1], matches[5], matches[7], matches[8], matches[9]) elsif !.empty? .last.content << l end end end |
#warnings ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/mxmlc_output/mxmlc_output_reader.rb', line 16 def warnings out = [] .each do |e| out << e if e.level == "Warning" end out end |