Exception: Rools::RuleError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/rools/errors.rb

Direct Known Subclasses

RuleCheckError, RuleConsequenceError

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(rule, inner_error = nil) ⇒ RuleError

Pass the Rools::Rule that caused the error, and an optional inner_error



7
8
9
10
# File 'lib/rools/errors.rb', line 7

def initialize(rule, inner_error = nil)    
  @rule = rule
  @inner_error = inner_error      
end

Instance Attribute Details

#inner_errorObject (readonly)

Returns the value of attribute inner_error.



4
5
6
# File 'lib/rools/errors.rb', line 4

def inner_error
  @inner_error
end

#ruleObject (readonly)

Returns the value of attribute rule.



4
5
6
# File 'lib/rools/errors.rb', line 4

def rule
  @rule
end

Instance Method Details

#to_sObject

returns the name of the associated Rools::Rule, and the message of the inner_error



13
14
15
# File 'lib/rools/errors.rb', line 13

def to_s
  "#{@rule.name}\n#{@inner_error.to_s}"
end