Exception: SDL4R::SdlParseError
- Inherits:
-
StandardError
- Object
- StandardError
- SDL4R::SdlParseError
- Defined in:
- lib/sdl4r/sdl_parse_error.rb
Overview
An exception describing a problem with an SDL document’s structure
Instance Attribute Summary collapse
-
#line ⇒ Object
readonly
Returns the value of attribute line.
-
#position ⇒ Object
readonly
Returns the value of attribute position.
Instance Method Summary collapse
-
#initialize(description, line_no, position, line = nil) ⇒ SdlParseError
constructor
Note: Line and positioning numbering start with 1 rather than 0 to be consistent with most editors.
Constructor Details
#initialize(description, line_no, position, line = nil) ⇒ SdlParseError
Note: Line and positioning numbering start with 1 rather than 0 to be consistent with most editors.
description
A description of the problem. lineNo
The line on which the error occured or -1 for unknown position
The position (within the line) where the error occured or -1 for unknown
36 37 38 39 40 41 42 43 44 |
# File 'lib/sdl4r/sdl_parse_error.rb', line 36 def initialize(description, line_no, position, line = nil) super( "#{description} Line " + ((line_no.nil? or line_no < 0)? "unknown" : line_no.to_s) + ", Position " + ((position.nil? or position < 0)? "unknown" : position.to_s) + "\n" + ((line and position >= 0)? line + (position ? " " * (position - 1) : "") + "^" : "")) @line = line_no @position = position end |
Instance Attribute Details
#line ⇒ Object (readonly)
Returns the value of attribute line.
46 47 48 |
# File 'lib/sdl4r/sdl_parse_error.rb', line 46 def line @line end |
#position ⇒ Object (readonly)
Returns the value of attribute position.
47 48 49 |
# File 'lib/sdl4r/sdl_parse_error.rb', line 47 def position @position end |