Class: YARP::SingletonClassNode
- Inherits:
-
YARPNode
- Object
- YARPNode
- YARP::SingletonClassNode
- Defined in:
- lib/yarp/node.rb,
ext/yarp/api_node.c
Overview
Represents a singleton class declaration involving the ‘class` keyword.
class << self end
^^^^^^^^^^^^^^^^^
Instance Attribute Summary collapse
-
#class_keyword_loc ⇒ Object
readonly
attr_reader class_keyword_loc: Location.
-
#end_keyword_loc ⇒ Object
readonly
attr_reader end_keyword_loc: Location.
-
#expression ⇒ Object
readonly
attr_reader expression: Node.
-
#locals ⇒ Object
readonly
attr_reader locals: Array.
-
#operator_loc ⇒ Object
readonly
attr_reader operator_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].
-
#class_keyword ⇒ Object
def class_keyword: () -> String.
- #deconstruct_keys(keys) ⇒ Object
-
#end_keyword ⇒ Object
def end_keyword: () -> String.
-
#initialize(locals, class_keyword_loc, operator_loc, expression, statements, end_keyword_loc, location) ⇒ SingletonClassNode
constructor
def initialize: (locals: Array, class_keyword_loc: Location, operator_loc: Location, expression: Node, statements: Node?, end_keyword_loc: Location, location: Location) -> void.
-
#operator ⇒ Object
def operator: () -> String.
Constructor Details
#initialize(locals, class_keyword_loc, operator_loc, expression, statements, end_keyword_loc, location) ⇒ SingletonClassNode
def initialize: (locals: Array, class_keyword_loc: Location, operator_loc: Location, expression: Node, statements: Node?, end_keyword_loc: Location, location: Location) -> void
5531 5532 5533 5534 5535 5536 5537 5538 5539 |
# File 'lib/yarp/node.rb', line 5531 def initialize(locals, class_keyword_loc, operator_loc, expression, statements, end_keyword_loc, location) @locals = locals @class_keyword_loc = class_keyword_loc @operator_loc = operator_loc @expression = expression @statements = statements @end_keyword_loc = end_keyword_loc @location = location end |
Instance Attribute Details
#class_keyword_loc ⇒ Object (readonly)
attr_reader class_keyword_loc: Location
5516 5517 5518 |
# File 'lib/yarp/node.rb', line 5516 def class_keyword_loc @class_keyword_loc end |
#end_keyword_loc ⇒ Object (readonly)
attr_reader end_keyword_loc: Location
5528 5529 5530 |
# File 'lib/yarp/node.rb', line 5528 def end_keyword_loc @end_keyword_loc end |
#expression ⇒ Object (readonly)
attr_reader expression: Node
5522 5523 5524 |
# File 'lib/yarp/node.rb', line 5522 def expression @expression end |
#locals ⇒ Object (readonly)
attr_reader locals: Array
5513 5514 5515 |
# File 'lib/yarp/node.rb', line 5513 def locals @locals end |
#operator_loc ⇒ Object (readonly)
attr_reader operator_loc: Location
5519 5520 5521 |
# File 'lib/yarp/node.rb', line 5519 def operator_loc @operator_loc end |
#statements ⇒ Object (readonly)
attr_reader statements: Node?
5525 5526 5527 |
# File 'lib/yarp/node.rb', line 5525 def statements @statements end |
Instance Method Details
#accept(visitor) ⇒ Object
def accept: (visitor: Visitor) -> void
5542 5543 5544 |
# File 'lib/yarp/node.rb', line 5542 def accept(visitor) visitor.visit_singleton_class_node(self) end |
#child_nodes ⇒ Object Also known as: deconstruct
def child_nodes: () -> Array[nil | Node]
5547 5548 5549 |
# File 'lib/yarp/node.rb', line 5547 def child_nodes [expression, statements] end |
#class_keyword ⇒ Object
def class_keyword: () -> String
5560 5561 5562 |
# File 'lib/yarp/node.rb', line 5560 def class_keyword class_keyword_loc.slice end |
#deconstruct_keys(keys) ⇒ Object
5555 5556 5557 |
# File 'lib/yarp/node.rb', line 5555 def deconstruct_keys(keys) { locals: locals, class_keyword_loc: class_keyword_loc, operator_loc: operator_loc, expression: expression, statements: statements, end_keyword_loc: end_keyword_loc, location: location } end |
#end_keyword ⇒ Object
def end_keyword: () -> String
5570 5571 5572 |
# File 'lib/yarp/node.rb', line 5570 def end_keyword end_keyword_loc.slice end |
#operator ⇒ Object
def operator: () -> String
5565 5566 5567 |
# File 'lib/yarp/node.rb', line 5565 def operator operator_loc.slice end |