Class: Prism::Scope
Relationships & Source Files | |
Inherits: | Object |
Defined in: | lib/prism/parse_result.rb, prism/extension.c |
Overview
This object is passed to the various Prism.*
methods that accept the scopes
option as an element of the list. It defines both the local variables visible at that scope as well as the forwarding parameters available at that scope.
Class Method Summary
-
.new(locals, forwarding) ⇒ Scope
constructor
Create a new scope object with the given locals and forwarding.
Instance Attribute Summary
-
#forwarding
readonly
The list of local variables that are forwarded to the next scope.
-
#locals
readonly
The list of local variables that are defined in this scope.
Constructor Details
.new(locals, forwarding) ⇒ Scope
Create a new scope object with the given locals and forwarding.
# File 'lib/prism/parse_result.rb', line 898
def initialize(locals, forwarding) @locals = locals @forwarding = forwarding end
Instance Attribute Details
#forwarding (readonly)
The list of local variables that are forwarded to the next scope. This should by defined as an array of symbols containing the specific values of :*, :**, :&, or :“…”.
# File 'lib/prism/parse_result.rb', line 895
attr_reader :forwarding
#locals (readonly)
The list of local variables that are defined in this scope. This should be defined as an array of symbols.
# File 'lib/prism/parse_result.rb', line 890
attr_reader :locals