Class: Keisan::AST::LogicalOr

Inherits:
LogicalOperator show all
Defined in:
lib/keisan/ast/logical_or.rb

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

#children

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Operator

#arity, arity, #associativity, associativity, associativity_of_priority, #evaluate_assignments, #initialize, priority, #priority, #symbol, #to_s

Methods inherited from Parent

#==, #deep_dup, #freeze, #initialize, #replace, #simplify, #unbound_functions, #unbound_variables

Methods inherited from Node

#!, #%, #&, #*, #**, #+, #+@, #-, #-@, #/, #<, #<=, #>, #>=, #^, #and, #coerce, #deep_dup, #differentiate, #equal, #evaluate_assignments, #evaluated, #false?, #not_equal, #or, #replace, #simplified, #simplify, #to_cell, #to_node, #true?, #unbound_functions, #unbound_variables, #well_defined?, #|, #~

Constructor Details

This class inherits a constructor from Keisan::AST::Operator

Class Method Details

.symbolObject



4
5
6
# File 'lib/keisan/ast/logical_or.rb', line 4

def self.symbol
  :"||"
end

Instance Method Details

#blank_valueObject



8
9
10
# File 'lib/keisan/ast/logical_or.rb', line 8

def blank_value
  false
end

#evaluate(context = nil) ⇒ Object



12
13
14
# File 'lib/keisan/ast/logical_or.rb', line 12

def evaluate(context = nil)
  children[0].evaluate(context).or(children[1].evaluate(context))
end

#value(context = nil) ⇒ Object



16
17
18
19
# File 'lib/keisan/ast/logical_or.rb', line 16

def value(context = nil)
  context ||= Context.new
  children[0].value(context) || children[1].value(context)
end