Exception: LintTrappings::ParseError
- Inherits:
-
LintTrappingsError
- Object
- StandardError
- LintTrappingsError
- LintTrappings::ParseError
- Defined in:
- lib/lint_trappings/errors.rb
Overview
Raised when there was a problem parsing a document.
Instance Attribute Summary collapse
-
#path ⇒ String
readonly
Path to the file that failed to parse.
-
#source_range ⇒ Range<LintTrappings::Location>
readonly
Source range of the parse error.
Instance Method Summary collapse
-
#initialize(options) ⇒ ParseError
constructor
A new instance of ParseError.
- #message ⇒ Object
Methods inherited from LintTrappingsError
Constructor Details
#initialize(options) ⇒ ParseError
Returns a new instance of ParseError.
110 111 112 113 114 115 116 117 118 |
# File 'lib/lint_trappings/errors.rb', line 110 def initialize() = [:message] @path = [:path] if @source_range = [:source_range] @line = @source_range.begin.line @column = @source_range.begin.column end end |
Instance Attribute Details
#path ⇒ String (readonly)
Returns path to the file that failed to parse.
105 106 107 |
# File 'lib/lint_trappings/errors.rb', line 105 def path @path end |
#source_range ⇒ Range<LintTrappings::Location> (readonly)
Returns source range of the parse error.
108 109 110 |
# File 'lib/lint_trappings/errors.rb', line 108 def source_range @source_range end |
Instance Method Details
#message ⇒ Object
120 121 122 123 124 125 |
# File 'lib/lint_trappings/errors.rb', line 120 def msg = msg << " on line #{@line}" if @line msg << ", column #{@column}" if @column msg end |