Class: DrgDSL::Ast::NotExpression

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

Overview

A NotExpression is a logic text of the form

"not (expression)"

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) ⇒ NotExpression

Returns a new instance of NotExpression.



153
154
155
# File 'lib/drgdsl/ast.rb', line 153

def initialize(expression)
  @expression = expression
end

Instance Attribute Details

#expressionObject (readonly)

Returns the value of attribute expression.



151
152
153
# File 'lib/drgdsl/ast.rb', line 151

def expression
  @expression
end

Instance Method Details

#hashObject



161
162
163
# File 'lib/drgdsl/ast.rb', line 161

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

#to_hashObject



157
158
159
# File 'lib/drgdsl/ast.rb', line 157

def to_hash
  { not: expression.to_hash }
end