Class: Rgviz::UnaryExpression
- Inherits:
-
Object
- Object
- Rgviz::UnaryExpression
- Defined in:
- lib/rgviz/nodes.rb
Constant Summary collapse
Instance Attribute Summary collapse
-
#operand ⇒ Object
Returns the value of attribute operand.
-
#operator ⇒ Object
Returns the value of attribute operator.
Instance Method Summary collapse
- #accept(visitor) ⇒ Object
-
#initialize(operator, operand) ⇒ UnaryExpression
constructor
A new instance of UnaryExpression.
- #to_s ⇒ Object
Constructor Details
#initialize(operator, operand) ⇒ UnaryExpression
Returns a new instance of UnaryExpression.
281 282 283 284 |
# File 'lib/rgviz/nodes.rb', line 281 def initialize(operator, operand) @operator = operator @operand = operand end |
Instance Attribute Details
#operand ⇒ Object
Returns the value of attribute operand.
278 279 280 |
# File 'lib/rgviz/nodes.rb', line 278 def operand @operand end |
#operator ⇒ Object
Returns the value of attribute operator.
279 280 281 |
# File 'lib/rgviz/nodes.rb', line 279 def operator @operator end |
Instance Method Details
#accept(visitor) ⇒ Object
286 287 288 289 290 291 |
# File 'lib/rgviz/nodes.rb', line 286 def accept(visitor) if visitor.visit_unary_expression(self) operand.accept visitor end visitor.end_visit_unary_expression self end |
#to_s ⇒ Object
293 294 295 296 297 298 299 |
# File 'lib/rgviz/nodes.rb', line 293 def to_s if operator == Not "not #{operand}" else "#{operand} #{operator}" end end |