Class: Melbourne::AST::ConstSet

Inherits:
Node
  • Object
show all
Defined in:
lib/melbourne/ast/constants.rb

Overview

Assignment of a value to a constant as in:

X = 42

Instance Attribute Summary collapse

Attributes inherited from Node

#line

Instance Method Summary collapse

Methods inherited from Node

#ascii_graph

Constructor Details

#initialize(line, name, value) ⇒ ConstSet

Returns a new instance of ConstSet.



94
95
96
97
98
99
100
101
102
103
104
105
# File 'lib/melbourne/ast/constants.rb', line 94

def initialize(line, name, value)
  @line = line
  @value = value
  @parent = nil

  if name.kind_of? Symbol
    @name = ConstName.new line, name
  else
    @parent = name.parent
    @name = ConstName.new line, name.name
  end
end

Instance Attribute Details

#nameObject

The value that is set



88
89
90
# File 'lib/melbourne/ast/constants.rb', line 88

def name
  @name
end

#parentObject

The parent node



84
85
86
# File 'lib/melbourne/ast/constants.rb', line 84

def parent
  @parent
end