Class: Dry::Logic::Rule::Predicate
Instance Attribute Summary
#args, #arity, #options, #predicate
Class Method Summary
collapse
Instance Method Summary
collapse
#bind, build, #curry, #eval_args, #id, #initialize, interfaces, #parameters, #with
Methods included from Operators
#and, #or, #then, #xor
Class Method Details
.specialize(arity, curried, base = Predicate) ⇒ Object
6
7
8
|
# File 'lib/dry/logic/rule/predicate.rb', line 6
def self.specialize(arity, curried, base = Predicate)
super
end
|
Instance Method Details
#ast(input = Undefined) ⇒ Object
Also known as:
to_ast
26
27
28
|
# File 'lib/dry/logic/rule/predicate.rb', line 26
def ast(input = Undefined)
[type, [name, args_with_names(input)]]
end
|
#name ⇒ Object
14
15
16
|
# File 'lib/dry/logic/rule/predicate.rb', line 14
def name
predicate.name
end
|
#to_s ⇒ Object
18
19
20
21
22
23
24
|
# File 'lib/dry/logic/rule/predicate.rb', line 18
def to_s
if args.size > 0
"#{name}(#{args.map(&:inspect).join(', ')})"
else
"#{name}"
end
end
|
#type ⇒ Object
10
11
12
|
# File 'lib/dry/logic/rule/predicate.rb', line 10
def type
:predicate
end
|