Class: Logica::Predicates::AdHoc

Inherits:
Base
  • Object
show all
Defined in:
lib/logica/predicates/ad_hoc.rb

Constant Summary

Constants inherited from Base

Base::ACCEPTOR_TYPE_ID

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#and, #and_not, #arity, #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

#==, #hash, #state

Constructor Details

#initialize(name, &definition) ⇒ AdHoc

Returns a new instance of AdHoc.



6
7
8
9
# File 'lib/logica/predicates/ad_hoc.rb', line 6

def initialize(name, &definition)
  @name = name
  define_singleton_method :satisfied_by?, &definition
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Logica::Predicates::Base

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



4
5
6
# File 'lib/logica/predicates/ad_hoc.rb', line 4

def name
  @name
end

Instance Method Details

#name_and_attributesObject



11
12
13
# File 'lib/logica/predicates/ad_hoc.rb', line 11

def name_and_attributes
  "#{name}()"
end