class Prism::SingletonClassNode
Represents a singleton class declaration involving theclass keyword.
class << self end^^^^^^^^^^^^^^^^^
Attributes
attr_reader body:StatementsNode |BeginNode | nil
attr_reader expression: Prism::node
Public Class Methods
Source
# File lib/prism/node.rb, line 16529definitialize(source,node_id,location,flags,locals,class_keyword_loc,operator_loc,expression,body,end_keyword_loc)@source =source@node_id =node_id@location =location@flags =flags@locals =locals@class_keyword_loc =class_keyword_loc@operator_loc =operator_loc@expression =expression@body =body@end_keyword_loc =end_keyword_locend
Initialize a newSingletonClassNode node.
Source
# File lib/prism/node.rb, line 16652defself.type:singleton_class_nodeend
Return a symbol representation of this node type. SeeNode::type.
Public Instance Methods
Source
# File lib/prism/node.rb, line 16658def===(other)other.is_a?(SingletonClassNode)&& (locals.length==other.locals.length)&&locals.zip(other.locals).all? {|left,right|left===right }&& (class_keyword_loc.nil?==other.class_keyword_loc.nil?)&& (operator_loc.nil?==other.operator_loc.nil?)&& (expression===other.expression)&& (body===other.body)&& (end_keyword_loc.nil?==other.end_keyword_loc.nil?)end
Implements case-equality for the node. This is effectively == but without comparing the value of locations. Locations are checked only for presence.
Source
# File lib/prism/node.rb, line 16543defaccept(visitor)visitor.visit_singleton_class_node(self)end
def accept: (Visitor visitor) -> void
Source
# File lib/prism/node.rb, line 16548defchild_nodes [expression,body]end
defchild_nodes: () ->Array
Source
# File lib/prism/node.rb, line 16627defclass_keywordclass_keyword_loc.sliceend
defclass_keyword: () ->String
Source
# File lib/prism/node.rb, line 16582defclass_keyword_loclocation =@class_keyword_locreturnlocationiflocation.is_a?(Location)@class_keyword_loc =Location.new(source,location>>32,location&0xFFFFFFFF)end
attr_readerclass_keyword_loc:Location
Source
# File lib/prism/node.rb, line 16561defcomment_targets [class_keyword_loc,operator_loc,expression,*body,end_keyword_loc]#: Array[Prism::node | Location]end
defcomment_targets: () -> Array[Node | Location]
Source
# File lib/prism/node.rb, line 16553defcompact_child_nodescompact = []#: Array[Prism::node]compact<<expressioncompact<<bodyifbodycompactend
defcompact_child_nodes: () ->Array
Source
# File lib/prism/node.rb, line 16566defcopy(node_id:self.node_id,location:self.location,flags:self.flags,locals:self.locals,class_keyword_loc:self.class_keyword_loc,operator_loc:self.operator_loc,expression:self.expression,body:self.body,end_keyword_loc:self.end_keyword_loc)SingletonClassNode.new(source,node_id,location,flags,locals,class_keyword_loc,operator_loc,expression,body,end_keyword_loc)end
def copy: (?node_id:Integer, ?location:Location, ?flags:Integer, ?locals:Array, ?class_keyword_loc:Location, ?operator_loc:Location, ?expression: Prism::node, ?body:StatementsNode |BeginNode | nil, ?end_keyword_loc:Location) ->SingletonClassNode
Source
# File lib/prism/node.rb, line 16574defdeconstruct_keys(keys) {node_id:node_id,location:location,locals:locals,class_keyword_loc:class_keyword_loc,operator_loc:operator_loc,expression:expression,body:body,end_keyword_loc:end_keyword_loc }end
defdeconstruct_keys: (Array keys) -> { node_id:Integer, location:Location, locals:Array,class_keyword_loc:Location,operator_loc:Location, expression: Prism::node, body:StatementsNode |BeginNode | nil,end_keyword_loc:Location }
Source
# File lib/prism/node.rb, line 16637defend_keywordend_keyword_loc.sliceend
defend_keyword: () ->String
Source
# File lib/prism/node.rb, line 16614defend_keyword_loclocation =@end_keyword_locreturnlocationiflocation.is_a?(Location)@end_keyword_loc =Location.new(source,location>>32,location&0xFFFFFFFF)end
attr_readerend_keyword_loc:Location
Source
# File lib/prism/node.rb, line 16642definspectInspectVisitor.compose(self)end
def inspect ->String
Source
# File lib/prism/node.rb, line 16632defoperatoroperator_loc.sliceend
def operator: () ->String
Source
# File lib/prism/node.rb, line 16595defoperator_loclocation =@operator_locreturnlocationiflocation.is_a?(Location)@operator_loc =Location.new(source,location>>32,location&0xFFFFFFFF)end
attr_readeroperator_loc:Location
Source
# File lib/prism/node.rb, line 16590defsave_class_keyword_loc(repository)repository.enter(node_id,:class_keyword_loc)end
Save theclass_keyword_loc location using the given saved source so that it can be retrieved later.
Source
# File lib/prism/node.rb, line 16622defsave_end_keyword_loc(repository)repository.enter(node_id,:end_keyword_loc)end
Save theend_keyword_loc location using the given saved source so that it can be retrieved later.
Source
# File lib/prism/node.rb, line 16603defsave_operator_loc(repository)repository.enter(node_id,:operator_loc)end
Save theoperator_loc location using the given saved source so that it can be retrieved later.