Class: Rgviz::LogicalExpression
- Inherits:
-
Object
- Object
- Rgviz::LogicalExpression
- Defined in:
- lib/rgviz/nodes.rb
Constant Summary collapse
Instance Attribute Summary collapse
-
#operands ⇒ Object
Returns the value of attribute operands.
-
#operator ⇒ Object
Returns the value of attribute operator.
Instance Method Summary collapse
- #accept(visitor) ⇒ Object
-
#initialize(operator, operands) ⇒ LogicalExpression
constructor
A new instance of LogicalExpression.
- #to_s ⇒ Object
Constructor Details
#initialize(operator, operands) ⇒ LogicalExpression
Returns a new instance of LogicalExpression.
218 219 220 221 |
# File 'lib/rgviz/nodes.rb', line 218 def initialize(operator, operands) @operator = operator @operands = operands end |
Instance Attribute Details
#operands ⇒ Object
Returns the value of attribute operands.
216 217 218 |
# File 'lib/rgviz/nodes.rb', line 216 def operands @operands end |
#operator ⇒ Object
Returns the value of attribute operator.
215 216 217 |
# File 'lib/rgviz/nodes.rb', line 215 def operator @operator end |
Instance Method Details
#accept(visitor) ⇒ Object
223 224 225 226 227 228 |
# File 'lib/rgviz/nodes.rb', line 223 def accept(visitor) if visitor.visit_logical_expression(self) operands.each{|x| x.accept visitor} end visitor.end_visit_logical_expression self end |
#to_s ⇒ Object
230 231 232 |
# File 'lib/rgviz/nodes.rb', line 230 def to_s operands.map(&:to_s).join(" #{operator} ") end |