Class: DrgDSL::Ast::ParenExpression
- Inherits:
-
Object
- Object
- DrgDSL::Ast::ParenExpression
- Includes:
- Node
- Defined in:
- lib/drgdsl/ast.rb
Overview
One expression surrounded by parentheses, e.g., “(exp)”
Instance Attribute Summary collapse
-
#expression ⇒ Object
readonly
Returns the value of attribute expression.
Instance Method Summary collapse
- #hash ⇒ Object
-
#initialize(expression) ⇒ ParenExpression
constructor
A new instance of ParenExpression.
- #to_hash ⇒ Object
Methods included from Node
#==, #accept, included, #mdc_equality?, node_classes, #pretty_print, #sep_equality?, type, #type
Constructor Details
#initialize(expression) ⇒ ParenExpression
Returns a new instance of ParenExpression.
133 134 135 |
# File 'lib/drgdsl/ast.rb', line 133 def initialize(expression) @expression = expression end |
Instance Attribute Details
#expression ⇒ Object (readonly)
Returns the value of attribute expression.
131 132 133 |
# File 'lib/drgdsl/ast.rb', line 131 def expression @expression end |
Instance Method Details
#hash ⇒ Object
141 142 143 |
# File 'lib/drgdsl/ast.rb', line 141 def hash @hash ||= [type, expression].hash end |
#to_hash ⇒ Object
137 138 139 |
# File 'lib/drgdsl/ast.rb', line 137 def to_hash { paren: expression.to_hash } end |