Class: CAS::Equal
- Defined in:
- lib/functions/fnc-conditions.rb
Overview
This class is a Condition for two equal function
Instance Attribute Summary
Attributes inherited from Condition
Instance Method Summary collapse
-
#==(op) ⇒ Object
Return true if two functions are equal, false if different.
-
#call(fd) ⇒ Object
Function call will evaluate left and right functions to solve the relation.
-
#representative ⇒ Object
Saves some required elements.
Methods inherited from Condition
#args, #depend?, #diff, #initialize, #inspect, #simplify, #subs, #to_code, #to_s
Constructor Details
This class inherits a constructor from CAS::Condition
Instance Method Details
#==(op) ⇒ Object
Return true if two functions are equal, false if different
* **argument**: `CAS::Op` operator to check against for equality
* **returns**: `TrueClass` or `FalseClass`
199 200 201 202 203 |
# File 'lib/functions/fnc-conditions.rb', line 199 def ==(op) CAS::Help.assert(op, CAS::Op) cond_f = ((@x == op.x) and (@y == op.y)) or ((@x == op.y) and (@y == op.x)) return (cond_f and (self.class == op.class)) end |
#call(fd) ⇒ Object
Function call will evaluate left and right functions to solve the relation
* **argument**: `Hash` with feed dictionary
* **returns**: `Trueclass` or `Falseclass`
189 190 191 192 193 |
# File 'lib/functions/fnc-conditions.rb', line 189 def call(fd) CAS::Help.assert fd, Hash return (@x.call(fd) == @y.call(fd)) end |
#representative ⇒ Object
Saves some required elements
179 180 181 182 |
# File 'lib/functions/fnc-conditions.rb', line 179 def representative @cond_type, @cond_repr = "==", "≡" self end |