Class: Propose::TruthTable
- Inherits:
-
Object
- Object
- Propose::TruthTable
- Defined in:
- lib/propose/truth_table.rb
Overview
Generates a truth table for a given propositional logic formula.
Instance Attribute Summary collapse
-
#evaluations ⇒ Object
readonly
Returns the value of attribute evaluations.
-
#formula ⇒ Object
readonly
Returns the value of attribute formula.
Instance Method Summary collapse
- #formula_atoms ⇒ Object
-
#initialize(formula) ⇒ TruthTable
constructor
A new instance of TruthTable.
Constructor Details
#initialize(formula) ⇒ TruthTable
Returns a new instance of TruthTable.
6 7 8 9 |
# File 'lib/propose/truth_table.rb', line 6 def initialize(formula) @formula = formula @evaluations = generate(formula) end |
Instance Attribute Details
#evaluations ⇒ Object (readonly)
Returns the value of attribute evaluations.
4 5 6 |
# File 'lib/propose/truth_table.rb', line 4 def evaluations @evaluations end |
#formula ⇒ Object (readonly)
Returns the value of attribute formula.
4 5 6 |
# File 'lib/propose/truth_table.rb', line 4 def formula @formula end |
Instance Method Details
#formula_atoms ⇒ Object
11 12 13 |
# File 'lib/propose/truth_table.rb', line 11 def formula_atoms @formula_atoms ||= AtomFinder.new(formula).atoms end |