Class: YARP::ModuleNode
- Inherits:
-
YARPNode
- Object
- YARPNode
- YARP::ModuleNode
- Defined in:
- lib/yarp/node.rb,
ext/yarp/api_node.c
Overview
Represents a module declaration involving the ‘module` keyword.
module Foo end
^^^^^^^^^^^^^^
Instance Attribute Summary collapse
-
#constant_path ⇒ Object
readonly
attr_reader constant_path: Node.
-
#end_keyword_loc ⇒ Object
readonly
attr_reader end_keyword_loc: Location.
-
#locals ⇒ Object
readonly
attr_reader locals: Array.
-
#module_keyword_loc ⇒ Object
readonly
attr_reader module_keyword_loc: Location.
-
#statements ⇒ Object
readonly
attr_reader statements: Node?.
Instance Method Summary collapse
-
#accept(visitor) ⇒ Object
def accept: (visitor: Visitor) -> void.
-
#child_nodes ⇒ Object
(also: #deconstruct)
def child_nodes: () -> Array[nil | Node].
- #deconstruct_keys(keys) ⇒ Object
-
#end_keyword ⇒ Object
def end_keyword: () -> String.
-
#initialize(locals, module_keyword_loc, constant_path, statements, end_keyword_loc, location) ⇒ ModuleNode
constructor
def initialize: (locals: Array, module_keyword_loc: Location, constant_path: Node, statements: Node?, end_keyword_loc: Location, location: Location) -> void.
-
#module_keyword ⇒ Object
def module_keyword: () -> String.
Constructor Details
#initialize(locals, module_keyword_loc, constant_path, statements, end_keyword_loc, location) ⇒ ModuleNode
def initialize: (locals: Array, module_keyword_loc: Location, constant_path: Node, statements: Node?, end_keyword_loc: Location, location: Location) -> void
4207 4208 4209 4210 4211 4212 4213 4214 |
# File 'lib/yarp/node.rb', line 4207 def initialize(locals, module_keyword_loc, constant_path, statements, end_keyword_loc, location) @locals = locals @module_keyword_loc = module_keyword_loc @constant_path = constant_path @statements = statements @end_keyword_loc = end_keyword_loc @location = location end |
Instance Attribute Details
#constant_path ⇒ Object (readonly)
attr_reader constant_path: Node
4198 4199 4200 |
# File 'lib/yarp/node.rb', line 4198 def constant_path @constant_path end |
#end_keyword_loc ⇒ Object (readonly)
attr_reader end_keyword_loc: Location
4204 4205 4206 |
# File 'lib/yarp/node.rb', line 4204 def end_keyword_loc @end_keyword_loc end |
#locals ⇒ Object (readonly)
attr_reader locals: Array
4192 4193 4194 |
# File 'lib/yarp/node.rb', line 4192 def locals @locals end |
#module_keyword_loc ⇒ Object (readonly)
attr_reader module_keyword_loc: Location
4195 4196 4197 |
# File 'lib/yarp/node.rb', line 4195 def module_keyword_loc @module_keyword_loc end |
#statements ⇒ Object (readonly)
attr_reader statements: Node?
4201 4202 4203 |
# File 'lib/yarp/node.rb', line 4201 def statements @statements end |
Instance Method Details
#accept(visitor) ⇒ Object
def accept: (visitor: Visitor) -> void
4217 4218 4219 |
# File 'lib/yarp/node.rb', line 4217 def accept(visitor) visitor.visit_module_node(self) end |
#child_nodes ⇒ Object Also known as: deconstruct
def child_nodes: () -> Array[nil | Node]
4222 4223 4224 |
# File 'lib/yarp/node.rb', line 4222 def child_nodes [constant_path, statements] end |
#deconstruct_keys(keys) ⇒ Object
4230 4231 4232 |
# File 'lib/yarp/node.rb', line 4230 def deconstruct_keys(keys) { locals: locals, module_keyword_loc: module_keyword_loc, constant_path: constant_path, statements: statements, end_keyword_loc: end_keyword_loc, location: location } end |
#end_keyword ⇒ Object
def end_keyword: () -> String
4240 4241 4242 |
# File 'lib/yarp/node.rb', line 4240 def end_keyword end_keyword_loc.slice end |
#module_keyword ⇒ Object
def module_keyword: () -> String
4235 4236 4237 |
# File 'lib/yarp/node.rb', line 4235 def module_keyword module_keyword_loc.slice end |