Exception: Psych::SyntaxError

Inherits:
Exception show all
Defined in:
lib/psych/syntax_error.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(file, line, col, offset, problem, context) ⇒ SyntaxError

Returns a new instance of SyntaxError.



8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/psych/syntax_error.rb', line 8

def initialize file, line, col, offset, problem, context
  err      = [problem, context].compact.join ' '
  filename = file || '<unknown>'
  message  = "(%s): %s at line %d column %d" % [filename, err, line, col]

  @file    = file
  @line    = line
  @column  = col
  @offset  = offset
  @problem = problem
  @context = context
  super(message)
end

Instance Attribute Details

#columnObject (readonly)

Returns the value of attribute column.



6
7
8
# File 'lib/psych/syntax_error.rb', line 6

def column
  @column
end

#contextObject (readonly)

Returns the value of attribute context.



6
7
8
# File 'lib/psych/syntax_error.rb', line 6

def context
  @context
end

#fileObject (readonly)

Returns the value of attribute file.



6
7
8
# File 'lib/psych/syntax_error.rb', line 6

def file
  @file
end

#lineObject (readonly)

Returns the value of attribute line.



6
7
8
# File 'lib/psych/syntax_error.rb', line 6

def line
  @line
end

#offsetObject (readonly)

Returns the value of attribute offset.



6
7
8
# File 'lib/psych/syntax_error.rb', line 6

def offset
  @offset
end

#problemObject (readonly)

Returns the value of attribute problem.



6
7
8
# File 'lib/psych/syntax_error.rb', line 6

def problem
  @problem
end