Class: DrgDSL::Ast::ParenExpression

Inherits:
Object
  • Object
show all
Includes:
Node
Defined in:
lib/drgdsl/ast.rb

Overview

One expression surrounded by parentheses, e.g., “(exp)”

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#expressionObject (readonly)

Returns the value of attribute expression.



131
132
133
# File 'lib/drgdsl/ast.rb', line 131

def expression
  @expression
end

Instance Method Details

#hashObject



141
142
143
# File 'lib/drgdsl/ast.rb', line 141

def hash
  @hash ||= [type, expression].hash
end

#to_hashObject



137
138
139
# File 'lib/drgdsl/ast.rb', line 137

def to_hash
  { paren: expression.to_hash }
end