Exception: Kwalify::BaseError
- Inherits:
-
KwalifyError
- Object
- StandardError
- KwalifyError
- Kwalify::BaseError
- Defined in:
- lib/kwalify/errors.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#column ⇒ Object
Returns the value of attribute column.
-
#error_symbol ⇒ Object
Returns the value of attribute error_symbol.
-
#filename ⇒ Object
Returns the value of attribute filename.
-
#linenum ⇒ Object
Returns the value of attribute linenum.
-
#path ⇒ Object
Returns the value of attribute path.
-
#rule ⇒ Object
Returns the value of attribute rule.
-
#value ⇒ Object
Returns the value of attribute value.
Instance Method Summary collapse
- #<=>(ex) ⇒ Object
- #_to_s ⇒ Object
-
#initialize(message = "", path = nil, value = nil, rule = nil, error_symbol = nil) ⇒ BaseError
constructor
A new instance of BaseError.
- #message ⇒ Object
- #to_s ⇒ Object
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/kwalify/errors.rb', line 23 def initialize(="", path=nil, value=nil, rule=nil, error_symbol=nil) super() @path = path.is_a?(Array) ? '/'+path.join('/') : path @rule = rule @value = value @error_symbol = error_symbol end |
Instance Attribute Details
#column ⇒ Object
Returns the value of attribute column.
31 32 33 |
# File 'lib/kwalify/errors.rb', line 31 def column @column end |
#error_symbol ⇒ Object
Returns the value of attribute error_symbol.
30 31 32 |
# File 'lib/kwalify/errors.rb', line 30 def error_symbol @error_symbol end |
#filename ⇒ Object
Returns the value of attribute filename.
31 32 33 |
# File 'lib/kwalify/errors.rb', line 31 def filename @filename end |
#linenum ⇒ Object
Returns the value of attribute linenum.
31 32 33 |
# File 'lib/kwalify/errors.rb', line 31 def linenum @linenum end |
#path ⇒ Object
Returns the value of attribute path.
30 31 32 |
# File 'lib/kwalify/errors.rb', line 30 def path @path end |
#rule ⇒ Object
Returns the value of attribute rule.
30 31 32 |
# File 'lib/kwalify/errors.rb', line 30 def rule @rule end |
#value ⇒ Object
Returns the value of attribute value.
30 31 32 |
# File '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/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_s ⇒ Object
37 |
# File 'lib/kwalify/errors.rb', line 37 alias _to_s to_s |
#message ⇒ Object
38 |
# File 'lib/kwalify/errors.rb', line 38 alias to_s |
#to_s ⇒ Object
40 41 42 43 44 45 46 47 |
# File '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 |