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
4178 4179 4180 4181 4182 4183 4184 4185 |
# File 'lib/yarp/node.rb', line 4178 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
4169 4170 4171 |
# File 'lib/yarp/node.rb', line 4169 def constant_path @constant_path end |
#end_keyword_loc ⇒ Object (readonly)
attr_reader end_keyword_loc: Location
4175 4176 4177 |
# File 'lib/yarp/node.rb', line 4175 def end_keyword_loc @end_keyword_loc end |
#locals ⇒ Object (readonly)
attr_reader locals: Array
4163 4164 4165 |
# File 'lib/yarp/node.rb', line 4163 def locals @locals end |
#module_keyword_loc ⇒ Object (readonly)
attr_reader module_keyword_loc: Location
4166 4167 4168 |
# File 'lib/yarp/node.rb', line 4166 def module_keyword_loc @module_keyword_loc end |
#statements ⇒ Object (readonly)
attr_reader statements: Node?
4172 4173 4174 |
# File 'lib/yarp/node.rb', line 4172 def statements @statements end |
Instance Method Details
#accept(visitor) ⇒ Object
def accept: (visitor: Visitor) -> void
4188 4189 4190 |
# File 'lib/yarp/node.rb', line 4188 def accept(visitor) visitor.visit_module_node(self) end |
#child_nodes ⇒ Object Also known as: deconstruct
def child_nodes: () -> Array[nil | Node]
4194 4195 4196 |
# File 'lib/yarp/node.rb', line 4194 def child_nodes [constant_path, statements] end |
#deconstruct_keys(keys) ⇒ Object
4202 4203 4204 |
# File 'lib/yarp/node.rb', line 4202 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
4212 4213 4214 |
# File 'lib/yarp/node.rb', line 4212 def end_keyword end_keyword_loc.slice end |
#module_keyword ⇒ Object
def module_keyword: () -> String
4207 4208 4209 |
# File 'lib/yarp/node.rb', line 4207 def module_keyword module_keyword_loc.slice end |