Class: Factbase::Rules::Later
- Inherits:
-
Object
- Object
- Factbase::Rules::Later
- Defined in:
- lib/factbase/rules.rb
Overview
Check one fact (never complaining).
This is an internal class, it is not supposed to be instantiated directly.
Instance Method Summary collapse
- #include?(fact) ⇒ Boolean
-
#initialize(uid) ⇒ Later
constructor
A new instance of Later.
- #it(fact, _fb) ⇒ Object
Constructor Details
#initialize(uid) ⇒ Later
Returns a new instance of Later.
130 131 132 133 |
# File 'lib/factbase/rules.rb', line 130 def initialize(uid) @uid = uid @facts = Set.new end |
Instance Method Details
#include?(fact) ⇒ Boolean
143 144 145 146 147 148 149 |
# File 'lib/factbase/rules.rb', line 143 def include?(fact) return true if @uid.nil? a = fact[@uid] return true if a.nil? raise "More than one #{@uid.inspect} in the fact: #{a}" if a.size > 1 @facts.include?(a.first) end |
#it(fact, _fb) ⇒ Object
135 136 137 138 139 140 141 |
# File 'lib/factbase/rules.rb', line 135 def it(fact, _fb) return if @uid.nil? a = fact[@uid] return if a.nil? raise "More than one #{@uid.inspect} in the fact: #{a}" if a.size > 1 @facts << a.first end |