Class: Logica::Predicates::PartialApplication
- Defined in:
- lib/logica/predicates/partial_application.rb
Constant Summary
Constants inherited from Base
Instance Attribute Summary collapse
-
#first_arguments ⇒ Object
readonly
Returns the value of attribute first_arguments.
-
#predicate ⇒ Object
readonly
Returns the value of attribute predicate.
Instance Method Summary collapse
- #arity ⇒ Object
-
#initialize(predicate, first_arguments) ⇒ PartialApplication
constructor
A new instance of PartialApplication.
- #name_and_attributes ⇒ Object
- #satisfied_by?(*arguments) ⇒ Boolean
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
Methods included from ComparableByState
Constructor Details
#initialize(predicate, first_arguments) ⇒ PartialApplication
Returns a new instance of PartialApplication.
6 7 8 9 |
# File 'lib/logica/predicates/partial_application.rb', line 6 def initialize(predicate, first_arguments) @predicate = predicate @first_arguments = first_arguments end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Logica::Predicates::Base
Instance Attribute Details
#first_arguments ⇒ Object (readonly)
Returns the value of attribute first_arguments.
4 5 6 |
# File 'lib/logica/predicates/partial_application.rb', line 4 def first_arguments @first_arguments end |
#predicate ⇒ Object (readonly)
Returns the value of attribute predicate.
4 5 6 |
# File 'lib/logica/predicates/partial_application.rb', line 4 def predicate @predicate end |
Instance Method Details
#arity ⇒ Object
15 16 17 |
# File 'lib/logica/predicates/partial_application.rb', line 15 def arity predicate.arity - first_arguments.size end |
#name_and_attributes ⇒ Object
19 20 21 |
# File 'lib/logica/predicates/partial_application.rb', line 19 def name_and_attributes "#{predicate.name_and_attributes}(#{first_arguments.join(', ')})" end |
#satisfied_by?(*arguments) ⇒ Boolean
11 12 13 |
# File 'lib/logica/predicates/partial_application.rb', line 11 def satisfied_by?(*arguments) predicate.satisfied_by?(*(first_arguments + arguments)) end |