Class: Tensai::Logic::Predicate
- Inherits:
-
Object
- Object
- Tensai::Logic::Predicate
- Defined in:
- lib/tensai/logic/predicate.rb
Overview
Predicate
Instance Method Summary collapse
Instance Method Details
#accepts?(values) ⇒ Boolean
25 26 27 28 |
# File 'lib/tensai/logic/predicate.rb', line 25 def accepts?(values) Set.new(values.keys) == variable_names && variables.all? { |v| v.accepts? values[v.name] } end |
#after_initialize ⇒ Object
21 22 23 |
# File 'lib/tensai/logic/predicate.rb', line 21 def after_initialize raise ArgumentError, 'All variable names must be unique' if variable_names.size < variables.size end |
#inspect ⇒ Object
30 31 32 |
# File 'lib/tensai/logic/predicate.rb', line 30 def inspect "(#{name} #{variables.map(&:inspect).join(' ')})" end |