Exception: Hamli::Errors::HamlSyntaxError

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

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of HamlSyntaxError.

Parameters:

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


13
14
15
16
17
18
19
# File 'lib/hamli/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/hamli/errors.rb', line 23

def to_s
  "    \#{error_type} at \#{@file_path}:\#{@line_number}:\#{@column}\n    \#{@line.rstrip}\n    \#{' ' * (@column - 1)}^\n  TEXT\nend\n"