Class: DrgDSL::Ast::AndExpression

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

Overview

Represents a list of expressions joined with an “AND”, e.g., “exp1 and exp2 and exp3 …”

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(expressions) ⇒ AndExpression

Returns a new instance of AndExpression.



114
115
116
# File 'lib/drgdsl/ast.rb', line 114

def initialize(expressions)
  @expressions = expressions
end

Instance Attribute Details

#expressionsObject (readonly)

Returns the value of attribute expressions.



112
113
114
# File 'lib/drgdsl/ast.rb', line 112

def expressions
  @expressions
end

Instance Method Details

#hashObject



122
123
124
# File 'lib/drgdsl/ast.rb', line 122

def hash
  @hash ||= [type, *expressions].hash
end

#to_hashObject



118
119
120
# File 'lib/drgdsl/ast.rb', line 118

def to_hash
  { and: [expressions.map(&:to_hash)] }
end