Class: Keisan::AST::LogicalOperator
- Defined in:
- lib/keisan/ast/logical_operator.rb
Direct Known Subclasses
LogicalAnd, LogicalEqual, LogicalGreaterThan, LogicalGreaterThanOrEqualTo, LogicalLessThan, LogicalLessThanOrEqualTo, LogicalNotEqual, LogicalOr
Constant Summary
Constants inherited from Operator
Operator::ARITIES, Operator::ARITY_PRIORITY_ASSOCIATIVITY, Operator::ASSOCIATIVITIES, Operator::ASSOCIATIVITY_OF_PRIORITY, Operator::PRIORITIES
Instance Attribute Summary
Attributes inherited from Parent
Instance Method Summary collapse
Methods inherited from Operator
#arity, arity, #associativity, associativity, associativity_of_priority, #blank_value, #evaluate_assignments, #initialize, priority, #priority, symbol, #symbol, #to_s
Methods inherited from Parent
#==, #deep_dup, #freeze, #initialize, #replace, #traverse, #unbound_functions, #unbound_variables
Methods inherited from Node
#!, #%, #&, #*, #**, #+, #+@, #-, #-@, #/, #<, #<<, #<=, #>, #>=, #>>, #^, #and, #coerce, #contains_a?, #deep_dup, #differentiate, #differentiated, #equal, #evaluate_assignments, #evaluated, #false?, #not_equal, #or, #replace, #replaced, #simplified, #to_cell, #to_node, #traverse, #true?, #unbound_functions, #unbound_variables, #well_defined?, #|, #~
Constructor Details
This class inherits a constructor from Keisan::AST::Operator
Instance Method Details
#evaluate(context = nil) ⇒ Object
4 5 6 7 |
# File 'lib/keisan/ast/logical_operator.rb', line 4 def evaluate(context = nil) context ||= Context.new children[0].evaluate(context).send(operator, children[1].evaluate(context)) end |