Class: Logica::Predicates::Compounds::Base
- Inherits:
-
Base
- Object
- Base
- Logica::Predicates::Compounds::Base
show all
- Defined in:
- lib/logica/predicates/compounds/base.rb
Constant Summary
Constants inherited
from Base
Base::ACCEPTOR_TYPE_ID
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Base
#and, #and_not, #disjoint_with?, #exhaustive_with?, #generalization_of?, #generalization_of_negation_of?, #generalization_of_other?, #iff, #implies, #method_missing, #negated, #or, #or_not, #partially_applied_with, #portion_satisfied_by, predicate_factory, #remainder_unsatisfied_by, #respond_to_missing?, #specialization_of?, #to_method, #to_proc, #to_s, #unsatisfied_by?, #xor
#==, #hash, #state
Constructor Details
#initialize(predicates) ⇒ Base
Returns a new instance of Base.
15
16
17
18
|
# File 'lib/logica/predicates/compounds/base.rb', line 15
def initialize(predicates)
@predicates = predicates
validate_composability
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
in the class Logica::Predicates::Base
Instance Attribute Details
#predicates ⇒ Object
Returns the value of attribute predicates.
5
6
7
|
# File 'lib/logica/predicates/compounds/base.rb', line 5
def predicates
@predicates
end
|
Class Method Details
.new_from_list(predicates) ⇒ Object
11
12
13
|
# File 'lib/logica/predicates/compounds/base.rb', line 11
def self.new_from_list(predicates)
predicates.reduce(internal_binary_operation) || neutral_element
end
|
.new_from_pair(first_predicate, second_predicate) ⇒ Object
7
8
9
|
# File 'lib/logica/predicates/compounds/base.rb', line 7
def self.new_from_pair(first_predicate, second_predicate)
new([first_predicate]).(second_predicate)
end
|
Instance Method Details
#arity ⇒ Object
33
34
35
|
# File 'lib/logica/predicates/compounds/base.rb', line 33
def arity
predicates.first.arity
end
|
#name_and_attributes ⇒ Object
37
38
39
|
# File 'lib/logica/predicates/compounds/base.rb', line 37
def name_and_attributes
"#{name}(#{attributes_string})"
end
|
27
28
29
30
31
|
# File 'lib/logica/predicates/compounds/base.rb', line 27
def ()
() do |subsumed, |
predicates - subsumed + []
end
end
|
20
21
22
23
24
25
|
# File 'lib/logica/predicates/compounds/base.rb', line 20
def ()
.reduce(self) do |compound, |
return compound if compound == absorbing_element
compound.()
end
end
|
#without(predicate_or_predicates, options = {}) ⇒ Object
41
42
43
|
# File 'lib/logica/predicates/compounds/base.rb', line 41
def without(predicate_or_predicates, options = {})
without_predicates([predicate_or_predicates].flatten(1), options)
end
|