Exception: Rhales::ParseError

Inherits:
Error
  • Object
show all
Defined in:
lib/rhales/errors.rb

Overview

Parse-time errors - syntax and structure issues

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message, line: nil, column: nil, offset: nil, source_type: nil) ⇒ ParseError

Returns a new instance of ParseError.



10
11
12
13
14
15
16
17
18
19
# File 'lib/rhales/errors.rb', line 10

def initialize(message, line: nil, column: nil, offset: nil, source_type: nil)
  @line        = line
  @column      = column
  @offset      = offset
  @source_type = source_type  # :rue, :handlebars, or :template

  location = line && column ? " at line #{line}, column #{column}" : ''
  source   = source_type ? " in #{source_type}" : ''
  super("#{message}#{location}#{source}")
end

Instance Attribute Details

#columnObject (readonly)

Returns the value of attribute column.



8
9
10
# File 'lib/rhales/errors.rb', line 8

def column
  @column
end

#lineObject (readonly)

Returns the value of attribute line.



8
9
10
# File 'lib/rhales/errors.rb', line 8

def line
  @line
end

#offsetObject (readonly)

Returns the value of attribute offset.



8
9
10
# File 'lib/rhales/errors.rb', line 8

def offset
  @offset
end

#source_typeObject (readonly)

Returns the value of attribute source_type.



8
9
10
# File 'lib/rhales/errors.rb', line 8

def source_type
  @source_type
end