Module: Rubylog::Goal
Instance Method Summary collapse
-
#prove ⇒ Object
Clients should implement this method.
- #solve(&block) ⇒ Object
- #true? ⇒ Boolean
Instance Method Details
#prove ⇒ Object
Clients should implement this method. Yields for each possible solution of the predicate
4 5 6 |
# File 'lib/rubylog/goal.rb', line 4 def prove raise "#{self.class} should implement #prove" end |
#solve(&block) ⇒ Object
13 14 15 16 17 18 |
# File 'lib/rubylog/goal.rb', line 13 def solve &block goal = rubylog_match_variables catch :rubylog_cut do goal.prove { block.call_with_rubylog_variables(goal.rubylog_variables) if block } end end |
#true? ⇒ Boolean
8 9 10 11 |
# File 'lib/rubylog/goal.rb', line 8 def true? solve { return true } false end |