Class: Prism::ClassVariableReadNode
- Inherits:
-
PrismNode
- Object
- PrismNode
- Prism::ClassVariableReadNode
- Defined in:
- lib/prism/node.rb,
sig/generated/prism/node.rbs,
ext/prism/api_node.c
Overview
Class Method Summary collapse
-
.type ⇒ :class_variable_read_node
See
Node.type.
Instance Method Summary collapse
-
#===(other) ⇒ boolish
: (untyped other) -> boolish.
-
#accept(visitor) ⇒ Object
See Node.accept.
-
#child_nodes ⇒ Array[node?]
(also: #deconstruct)
See Node.child_nodes.
-
#compact_child_nodes ⇒ Array[node]
See Node.compact_child_nodes.
-
#copy(node_id: self.node_id, location: self.location, flags: self.flags, name: self.name) ⇒ ClassVariableReadNode
:call-seq: copy(**fields) -> ClassVariableReadNode.
-
#deconstruct_keys(keys) ⇒ Hash[Symbol, untyped]
: (Array? keys) -> Hash[Symbol, untyped].
-
#each_child_node {|arg0| ... } ⇒ Object
See Node.each_child_node.
-
#initialize(source, node_id, location, flags, name) ⇒ ClassVariableReadNode
constructor
Initialize a new ClassVariableReadNode node.
-
#inspect ⇒ String
: () -> String.
-
#name ⇒ Symbol
:call-seq: name -> Symbol.
-
#type ⇒ :class_variable_read_node
See
Node#type.
Constructor Details
#initialize(source, node_id, location, flags, name) ⇒ ClassVariableReadNode
Initialize a new ClassVariableReadNode node.
: (Source source, Integer node_id, Location location, Integer flags, Symbol name) -> void
7882 7883 7884 7885 7886 7887 7888 |
# File 'lib/prism/node.rb', line 7882 def initialize(source, node_id, location, flags, name) @source = source @node_id = node_id @location = location @flags = flags @name = name end |
Class Method Details
.type ⇒ :class_variable_read_node
See Node.type.
: () -> :class_variable_read_node
7966 7967 7968 |
# File 'lib/prism/node.rb', line 7966 def self.type :class_variable_read_node end |
Instance Method Details
#===(other) ⇒ boolish
: (untyped other) -> boolish
8000 8001 8002 8003 |
# File 'lib/prism/node.rb', line 8000 def ===(other) # :nodoc: other.is_a?(ClassVariableReadNode) && (name === other.name) end |
#accept(visitor) ⇒ Object
See Node.accept.
: (_Visitor visitor) -> untyped
7904 7905 7906 |
# File 'lib/prism/node.rb', line 7904 def accept(visitor) visitor.visit_class_variable_read_node(self) end |
#child_nodes ⇒ Array[node?] Also known as: deconstruct
See Node.child_nodes.
: () -> Array
7911 7912 7913 |
# File 'lib/prism/node.rb', line 7911 def child_nodes [] end |
#compact_child_nodes ⇒ Array[node]
See Node.compact_child_nodes.
: () -> Array
7927 7928 7929 |
# File 'lib/prism/node.rb', line 7927 def compact_child_nodes [] end |
#copy(node_id: self.node_id, location: self.location, flags: self.flags, name: self.name) ⇒ ClassVariableReadNode
:call-seq:
copy(**fields) -> ClassVariableReadNode
Creates a copy of self with the given fields, using self as the template.
: (?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol) -> ClassVariableReadNode
7937 7938 7939 |
# File 'lib/prism/node.rb', line 7937 def copy(node_id: self.node_id, location: self.location, flags: self.flags, name: self.name) ClassVariableReadNode.new(source, node_id, location, flags, name) end |
#deconstruct_keys(keys) ⇒ Hash[Symbol, untyped]
: (Array? keys) -> Hash[Symbol, untyped]
7944 7945 7946 7947 7948 7949 7950 7951 7952 7953 7954 |
# File 'lib/prism/node.rb', line 7944 def deconstruct_keys(keys) # :nodoc: (keys || %i[node_id location name]).each_with_object( {} #: Hash[Symbol, untyped] ) do |key, deconstructed| case key when :node_id then deconstructed[:node_id] = self.node_id when :location then deconstructed[:location] = self.location when :name then deconstructed[:name] = self.name end end end |
#each_child_node ⇒ Enumerator[node, void] #each_child_node ⇒ void
See Node.each_child_node.
: () -> Enumerator[node, void] : () { (node) -> void } -> void
7919 7920 7921 7922 |
# File 'lib/prism/node.rb', line 7919 def each_child_node(&blk) return to_enum(:each_child_node) unless block_given? end |
#inspect ⇒ String
: () -> String
7971 7972 7973 |
# File 'lib/prism/node.rb', line 7971 def inspect # :nodoc: InspectVisitor.compose(self) end |
#name ⇒ Symbol
:call-seq:
name -> Symbol
The name of the class variable, which is a @@ followed by an identifier.
@@abc # name `:@@abc`
@@_test # name `:@@_test`
: () -> Symbol
7991 7992 7993 |
# File 'lib/prism/node.rb', line 7991 def name @name end |
#type ⇒ :class_variable_read_node
See Node#type.
: () -> :class_variable_read_node
7959 7960 7961 |
# File 'lib/prism/node.rb', line 7959 def type :class_variable_read_node end |