Class: MagicLogic::FORM
- Inherits:
-
Struct
- Object
- Struct
- MagicLogic::FORM
- Includes:
- Base
- Defined in:
- lib/magic_logic.rb
Constant Summary
Constants included from Utils
Instance Attribute Summary collapse
-
#ope ⇒ Object
Returns the value of attribute ope.
-
#vars ⇒ Object
Returns the value of attribute vars.
Instance Method Summary collapse
- #include?(p) ⇒ Boolean
-
#initialize(vars, ope) ⇒ FORM
constructor
A new instance of FORM.
- #to_s ⇒ Object
Methods included from Utils
#dpll, #evl, #is_and?, #is_form?, #is_neg?, #is_or?, #neg?
Methods included from Operator
Constructor Details
#initialize(vars, ope) ⇒ FORM
Returns a new instance of FORM.
47 48 49 50 |
# File 'lib/magic_logic.rb', line 47 def initialize(vars, ope) self.vars = vars.map { |var| var.is_form?(ope) ? var.vars : var }.flatten self.ope = ope end |
Instance Attribute Details
#ope ⇒ Object
Returns the value of attribute ope
45 46 47 |
# File 'lib/magic_logic.rb', line 45 def ope @ope end |
#vars ⇒ Object
Returns the value of attribute vars
45 46 47 |
# File 'lib/magic_logic.rb', line 45 def vars @vars end |
Instance Method Details
#include?(p) ⇒ Boolean
53 |
# File 'lib/magic_logic.rb', line 53 def include?(p); vars.include?(p) end |
#to_s ⇒ Object
52 |
# File 'lib/magic_logic.rb', line 52 def to_s; "(#{vars.map(&:to_s).join(_ ope, '|', '&')})" end |