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
5482 5483 5484 5485 5486 5487 5488 5489 5490 |
# File 'lib/yarp/node.rb', line 5482 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
5467 5468 5469 |
# File 'lib/yarp/node.rb', line 5467 def class_keyword_loc @class_keyword_loc end |
#end_keyword_loc ⇒ Object (readonly)
attr_reader end_keyword_loc: Location
5479 5480 5481 |
# File 'lib/yarp/node.rb', line 5479 def end_keyword_loc @end_keyword_loc end |
#expression ⇒ Object (readonly)
attr_reader expression: Node
5473 5474 5475 |
# File 'lib/yarp/node.rb', line 5473 def expression @expression end |
#locals ⇒ Object (readonly)
attr_reader locals: Array
5464 5465 5466 |
# File 'lib/yarp/node.rb', line 5464 def locals @locals end |
#operator_loc ⇒ Object (readonly)
attr_reader operator_loc: Location
5470 5471 5472 |
# File 'lib/yarp/node.rb', line 5470 def operator_loc @operator_loc end |
#statements ⇒ Object (readonly)
attr_reader statements: Node?
5476 5477 5478 |
# File 'lib/yarp/node.rb', line 5476 def statements @statements end |
Instance Method Details
#accept(visitor) ⇒ Object
def accept: (visitor: Visitor) -> void
5493 5494 5495 |
# File 'lib/yarp/node.rb', line 5493 def accept(visitor) visitor.visit_singleton_class_node(self) end |
#child_nodes ⇒ Object Also known as: deconstruct
def child_nodes: () -> Array[nil | Node]
5499 5500 5501 |
# File 'lib/yarp/node.rb', line 5499 def child_nodes [expression, statements] end |
#class_keyword ⇒ Object
def class_keyword: () -> String
5512 5513 5514 |
# File 'lib/yarp/node.rb', line 5512 def class_keyword class_keyword_loc.slice end |
#deconstruct_keys(keys) ⇒ Object
5507 5508 5509 |
# File 'lib/yarp/node.rb', line 5507 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
5522 5523 5524 |
# File 'lib/yarp/node.rb', line 5522 def end_keyword end_keyword_loc.slice end |
#operator ⇒ Object
def operator: () -> String
5517 5518 5519 |
# File 'lib/yarp/node.rb', line 5517 def operator operator_loc.slice end |