Class Kwalify::BaseError
In: kwalify/errors.rb
Parent: KwalifyError

Methods

<=>   new   path   to_s  

External Aliases

to_s -> _to_s
to_s -> message

Attributes

column  [RW] 
error_symbol  [RW] 
filename  [RW] 
linenum  [RW] 
path  [RW] 
rule  [RW] 
value  [RW] 

Public Class methods

[Source]

# File 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

Public Instance methods

[Source]

# File 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

[Source]

# File kwalify/errors.rb, line 33
    def path
      return @path == '' ? "/" : @path
    end

[Source]

# File 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

[Validate]