Module: Porolog
- Defined in:
- lib/porolog.rb,
lib/porolog/rule.rb,
lib/porolog/error.rb,
lib/porolog/scope.rb,
lib/porolog/arguments.rb,
lib/porolog/predicate.rb
Overview
lib/porolog/predicate.rb - Plain Old Ruby Objects Prolog Engine – Predicate
Luis Esteban 2 May 2018
created
Defined Under Namespace
Classes: Arguments, PorologError, Predicate, Rule, Scope
Constant Summary collapse
- VERSION =
The most recent version of the Porolog gem.
'0.0.5'
- VERSION_DATE =
The most recent date of when the VERSION changed.
'2019-04-22'
Instance Method Summary collapse
-
#predicate(*names) ⇒ Porolog::Predicate+
A convenience method to create a Predicate, along with a method that returns an Arguments based on the arguments provided to the method.
Instance Method Details
#predicate(*names) ⇒ Porolog::Predicate+
A convenience method to create a Predicate, along with a method that returns an Arguments based on the arguments provided to the method.
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/porolog.rb', line 21 def predicate(*names) names = [names].flatten predicates = names.map{|name| method = name.to_sym predicate = Predicate.new(name) Object.class_eval{ define_method(method){|*args| predicate.(*args) } } predicate } predicates.size > 1 && predicates || predicates.first end |