Exception: Slimi::Errors::SlimSyntaxError

Inherits:
BaseError
  • Object
show all
Defined in:
lib/slimi/errors.rb

Instance Method Summary collapse

Constructor Details

#initialize(column:, file_path:, line:, line_number:) ⇒ SlimSyntaxError

Returns a new instance of SlimSyntaxError.

Parameters:

  • column (Integer)
  • file_path (String)
  • line (String)
  • line_number (Integer)


13
14
15
16
17
18
19
# File 'lib/slimi/errors.rb', line 13

def initialize(column:, file_path:, line:, line_number:)
  super()
  @column = column
  @file_path = file_path
  @line = line
  @line_number = line_number
end

Instance Method Details

#to_sString

Note:

Override.

Returns:

  • (String)


23
24
25
26
27
28
29
# File 'lib/slimi/errors.rb', line 23

def to_s
  <<~TEXT
    #{error_type} at #{@file_path}:#{@line_number}:#{@column}
    #{@line.rstrip}
    #{' ' * (@column - 1)}^
  TEXT
end