Class: Yadriggy::GlobalVariable
- Defined in:
- lib/yadriggy/ast.rb,
lib/yadriggy/ast_value.rb
Overview
Global variable.
Instance Attribute Summary
Attributes inherited from Name
Attributes inherited from ASTnode
Class Method Summary collapse
Instance Method Summary collapse
-
#accept(evaluator) ⇒ void
A method for Visitor pattern.
-
#initialize(sexp) ⇒ GlobalVariable
constructor
A new instance of GlobalVariable.
-
#value ⇒ Object
The current value of this global variable.
Methods inherited from Name
Methods inherited from ASTnode
#add_child, #add_children, #const_value, #const_value_in_class, #get_context_class, #get_receiver_object, #is_proc?, #pretty_print, #root, #source_location, #source_location_string, #value_in_class
Constructor Details
#initialize(sexp) ⇒ GlobalVariable
Returns a new instance of GlobalVariable.
184 185 186 |
# File 'lib/yadriggy/ast.rb', line 184 def initialize(sexp) super(sexp) end |
Class Method Details
.tag ⇒ Object
182 |
# File 'lib/yadriggy/ast.rb', line 182 def self.tag() :@gvar end |
Instance Method Details
#accept(evaluator) ⇒ void
This method returns an undefined value.
A method for Visitor pattern.
191 192 193 |
# File 'lib/yadriggy/ast.rb', line 191 def accept(evaluator) evaluator.global_variable(self) end |
#value ⇒ Object
The current value of this global variable.
184 185 186 |
# File 'lib/yadriggy/ast_value.rb', line 184 def value() eval(@name) end |