class DrgDSL::Ast::DrgLink

A drg link originates from the grammar rule basic_or_drg_link This rule is of the form “variable (basic_expression | drg_link)” therefore a DrgLink has a variable and a name

Attributes

name[R]
variable[R]

Public Class Methods

new(name:, variable:) click to toggle source

@param name [String] either a drg or adrg name

# File lib/drgdsl/ast.rb, line 194
def initialize(name:, variable:)
  @name = name.to_s.strip.upcase
  @variable = variable
end

Public Instance Methods

hash() click to toggle source
# File lib/drgdsl/ast.rb, line 203
def hash
  @hash ||= [type, name, variable].hash
end
to_hash() click to toggle source
# File lib/drgdsl/ast.rb, line 199
def to_hash
  { drg_link: { var: variable.to_hash, name: name } }
end