Class: Panda::Boolean
- Inherits:
-
Expression
- Object
- Node
- Expression
- Panda::Boolean
- Defined in:
- lib/panda/expressions.rb
Overview
The binary boolean expression node class.
The possible operators are:
-
:& (and)
-
:| (or)
- NOTE:
-
The binary operators are used here because you cannot yet overload ruby’s && and || operators (at least in 1.8).
Instance Attribute Summary
Attributes inherited from Expression
Instance Method Summary collapse
-
#initialize(left, operator, right) ⇒ Boolean
constructor
Same precondition as Panda::Expression plus a Panda::SyntaxError is raised if left or right is not an instance of Panda::Expression.
Methods inherited from Expression
#has_operator?, has_operator?, #inspect, inspector=, #operator_alias, operator_alias_for, operators
Methods inherited from Node
Constructor Details
#initialize(left, operator, right) ⇒ Boolean
Same precondition as Panda::Expression plus a Panda::SyntaxError is raised if left or right is not an instance of Panda::Expression.
128 129 130 131 132 133 |
# File 'lib/panda/expressions.rb', line 128 def initialize(left, operator, right) unless left.kind_of?(Expression) && right.kind_of?(Expression) raise SyntaxError, "Bad operand for #{self.class}: (#{left.inspect}) #{operator} (#{right.inspect})" end super end |