Module: Rubylog::Goal

Included in:
Proc, Structure, Variable, Symbol
Defined in:
lib/rubylog/goal.rb

Instance Method Summary collapse

Instance Method Details

#proveObject

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

Returns:

  • (Boolean)


8
9
10
11
# File 'lib/rubylog/goal.rb', line 8

def true?
  solve { return true }
  false
end