Exception: Trenni::ParseError
- Inherits:
-
StandardError
- Object
- StandardError
- Trenni::ParseError
- Defined in:
- lib/trenni/parse_error.rb
Instance Attribute Summary collapse
-
#buffer ⇒ Object
readonly
Returns the value of attribute buffer.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Instance Method Summary collapse
-
#initialize(message, buffer, offset) ⇒ ParseError
constructor
A new instance of ParseError.
- #location ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(message, buffer, offset) ⇒ ParseError
Returns a new instance of ParseError.
25 26 27 28 29 30 |
# File 'lib/trenni/parse_error.rb', line 25 def initialize(, buffer, offset) super() @buffer = buffer @offset = offset end |
Instance Attribute Details
#buffer ⇒ Object (readonly)
Returns the value of attribute buffer.
36 37 38 |
# File 'lib/trenni/parse_error.rb', line 36 def buffer @buffer end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
37 38 39 |
# File 'lib/trenni/parse_error.rb', line 37 def path @path end |
Instance Method Details
#location ⇒ Object
32 33 34 |
# File 'lib/trenni/parse_error.rb', line 32 def location @location ||= Location.new(@buffer.read, @offset) end |
#to_s ⇒ Object
39 40 41 |
# File 'lib/trenni/parse_error.rb', line 39 def to_s "#{buffer.path}#{location}: #{super}\n#{location.line_text}" end |