Exception: RbYAML::MarkedYAMLError

Inherits:
YAMLError show all
Defined in:
lib/rbyaml/error.rb

Instance Method Summary collapse

Constructor Details

#initialize(context = nil, context_mark = nil, problem = nil, problem_mark = nil, note = nil) ⇒ MarkedYAMLError

Returns a new instance of MarkedYAMLError.



51
52
53
54
55
56
57
58
# File 'lib/rbyaml/error.rb', line 51

def initialize(context=nil, context_mark=nil, problem=nil, problem_mark=nil, note=nil)
  super()
  @context = context
  @context_mark = context_mark
  @problem = problem
  @problem_mark = problem_mark
  @note = note
end

Instance Method Details

#to_sObject



60
61
62
63
64
65
66
67
68
69
70
71
72
73
# File 'lib/rbyaml/error.rb', line 60

def to_s
  lines = []
  
  lines << @context if @context
  if @context_mark && (@problem.nil? || @problem_mark.nil? || 
                       @context_mark.name != @problem_mark.name ||
                       @context_mark.column != @problem_mark.column)
    lines << @context_mark.to_s          
  end
  lines << @problem if @problem
  lines << @problem_mark.to_s if @problem_mark
  lines << @note if @note
  lines.join("\n")
end