Exception: Curlybars::Error::Lex
- Defined in:
- lib/curlybars/error/lex.rb
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#initialize(source, file_name, exception) ⇒ Lex
constructor
A new instance of Lex.
Constructor Details
#initialize(source, file_name, exception) ⇒ Lex
Returns a new instance of Lex.
6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/curlybars/error/lex.rb', line 6 def initialize(source, file_name, exception) line_number = exception.line_number line_offset = exception.line_offset error_line = source.split("\n")[line_number - 1] before_error = error_line.first(line_offset).last(10) after_error = error_line[line_offset + 1..].first(10) error = error_line[line_offset] details = [before_error, error, after_error] = ".. %s `%s` %s .. is not permitted symbol in this context" % details position = Curlybars::Position.new(file_name, line_number, line_offset) super('lex', , position) end |