Exception: Kwalify::BaseError

Inherits:
KwalifyError show all
Defined in:
lib/tpkg/thirdparty/kwalify-0.7.2/lib/kwalify/errors.rb

Direct Known Subclasses

SchemaError, SyntaxError, ValidationError

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message = "", path = nil, value = nil, rule = nil, error_symbol = nil) ⇒ BaseError

Returns a new instance of BaseError.



23
24
25
26
27
28
29
# File 'lib/tpkg/thirdparty/kwalify-0.7.2/lib/kwalify/errors.rb', line 23

def initialize(message="", path=nil, value=nil, rule=nil, error_symbol=nil)
  super(message)
  @path  = path.is_a?(Array) ? '/'+path.join('/') : path
  @rule  = rule
  @value = value
  @error_symbol = error_symbol
end

Instance Attribute Details

#columnObject

Returns the value of attribute column.



31
32
33
# File 'lib/tpkg/thirdparty/kwalify-0.7.2/lib/kwalify/errors.rb', line 31

def column
  @column
end

#error_symbolObject

Returns the value of attribute error_symbol.



30
31
32
# File 'lib/tpkg/thirdparty/kwalify-0.7.2/lib/kwalify/errors.rb', line 30

def error_symbol
  @error_symbol
end

#filenameObject

Returns the value of attribute filename.



31
32
33
# File 'lib/tpkg/thirdparty/kwalify-0.7.2/lib/kwalify/errors.rb', line 31

def filename
  @filename
end

#linenumObject

Returns the value of attribute linenum.



31
32
33
# File 'lib/tpkg/thirdparty/kwalify-0.7.2/lib/kwalify/errors.rb', line 31

def linenum
  @linenum
end

#pathObject

Returns the value of attribute path.



30
31
32
# File 'lib/tpkg/thirdparty/kwalify-0.7.2/lib/kwalify/errors.rb', line 30

def path
  @path
end

#ruleObject

Returns the value of attribute rule.



30
31
32
# File 'lib/tpkg/thirdparty/kwalify-0.7.2/lib/kwalify/errors.rb', line 30

def rule
  @rule
end

#valueObject

Returns the value of attribute value.



30
31
32
# File 'lib/tpkg/thirdparty/kwalify-0.7.2/lib/kwalify/errors.rb', line 30

def value
  @value
end

Instance Method Details

#<=>(ex) ⇒ Object



49
50
51
52
53
54
55
56
# File 'lib/tpkg/thirdparty/kwalify-0.7.2/lib/kwalify/errors.rb', line 49

def <=>(ex)
  #return @linenum <=> ex.linenum
  v = 0
  v = @linenum <=> ex.linenum if @linenum && ex.linenum
  v = @column  <=> ex.column  if v == 0 && @column && ex.column
  v = @path    <=> ex.path    if v == 0
  return v
end

#_to_sObject



37
# File 'lib/tpkg/thirdparty/kwalify-0.7.2/lib/kwalify/errors.rb', line 37

alias _to_s to_s

#messageObject



38
# File 'lib/tpkg/thirdparty/kwalify-0.7.2/lib/kwalify/errors.rb', line 38

alias message to_s

#to_sObject



40
41
42
43
44
45
46
47
# File 'lib/tpkg/thirdparty/kwalify-0.7.2/lib/kwalify/errors.rb', line 40

def to_s
  s = ''
  s << @filename << ":" if @filename
  s << "#{@linenum}:#{@column} " if @linenum
  s << "[#{path()}] " if @path
  s << _to_s()
  return s
end