Class: Rubylog::Primitive

Inherits:
Predicate show all
Defined in:
lib/rubylog/primitive.rb

Instance Attribute Summary

Attributes inherited from Predicate

#arity, #functor

Instance Method Summary collapse

Methods inherited from Predicate

#add_functor_to

Constructor Details

#initialize(functor, callable) ⇒ Primitive

Returns a new instance of Primitive.



4
5
6
7
# File 'lib/rubylog/primitive.rb', line 4

def initialize functor, callable
  super functor, callable.arity
  @callable = callable
end

Instance Method Details

#call(*args) ⇒ Object

calls the callable with the argumens



10
11
12
# File 'lib/rubylog/primitive.rb', line 10

def call *args
  @callable.call(*args) { yield }
end