Class: Factbase::Rules::Check
- Inherits:
-
Object
- Object
- Factbase::Rules::Check
- Defined in:
- lib/factbase/rules.rb
Overview
Check one fact.
This is an internal class, it is not supposed to be instantiated directly.
Instance Method Summary collapse
-
#initialize(expr) ⇒ Check
constructor
A new instance of Check.
- #it(fact, fb) ⇒ Object
Constructor Details
#initialize(expr) ⇒ Check
Returns a new instance of Check.
115 116 117 |
# File 'lib/factbase/rules.rb', line 115 def initialize(expr) @expr = expr end |
Instance Method Details
#it(fact, fb) ⇒ Object
119 120 121 122 123 |
# File 'lib/factbase/rules.rb', line 119 def it(fact, fb) return if Factbase::Syntax.new(@expr).to_term.evaluate(fact, [], fb) e = "#{@expr[0..32]}..." if @expr.length > 32 raise "The fact doesn't match the #{e.inspect} rule: #{fact}" end |