Class: Prism::BlockLocalVariableNode
- Inherits:
-
PrismNode
- Object
- PrismNode
- Prism::BlockLocalVariableNode
- Defined in:
- lib/prism/node.rb,
sig/generated/prism/node.rbs,
ext/prism/api_node.c
Overview
Class Method Summary collapse
-
.type ⇒ :block_local_variable_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) ⇒ BlockLocalVariableNode
:call-seq: copy(**fields) -> BlockLocalVariableNode.
-
#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) ⇒ BlockLocalVariableNode
constructor
Initialize a new BlockLocalVariableNode node.
-
#inspect ⇒ String
: () -> String.
-
#name ⇒ Symbol
:call-seq: name -> Symbol.
-
#repeated_parameter? ⇒ Boolean
:category: Flags a parameter name that has been repeated in the method signature.
-
#type ⇒ :block_local_variable_node
See
Node#type.
Constructor Details
#initialize(source, node_id, location, flags, name) ⇒ BlockLocalVariableNode
Initialize a new BlockLocalVariableNode node.
: (Source source, Integer node_id, Location location, Integer flags, Symbol name) -> void
3048 3049 3050 3051 3052 3053 3054 |
# File 'lib/prism/node.rb', line 3048 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 ⇒ :block_local_variable_node
See Node.type.
: () -> :block_local_variable_node
3132 3133 3134 |
# File 'lib/prism/node.rb', line 3132 def self.type :block_local_variable_node end |
Instance Method Details
#===(other) ⇒ boolish
: (untyped other) -> boolish
3173 3174 3175 3176 3177 |
# File 'lib/prism/node.rb', line 3173 def ===(other) # :nodoc: other.is_a?(BlockLocalVariableNode) && (flags === other.flags) && (name === other.name) end |
#accept(visitor) ⇒ Object
See Node.accept.
: (_Visitor visitor) -> untyped
3070 3071 3072 |
# File 'lib/prism/node.rb', line 3070 def accept(visitor) visitor.visit_block_local_variable_node(self) end |
#child_nodes ⇒ Array[node?] Also known as: deconstruct
See Node.child_nodes.
: () -> Array
3077 3078 3079 |
# File 'lib/prism/node.rb', line 3077 def child_nodes [] end |
#compact_child_nodes ⇒ Array[node]
See Node.compact_child_nodes.
: () -> Array
3093 3094 3095 |
# File 'lib/prism/node.rb', line 3093 def compact_child_nodes [] end |
#copy(node_id: self.node_id, location: self.location, flags: self.flags, name: self.name) ⇒ BlockLocalVariableNode
:call-seq:
copy(**fields) -> BlockLocalVariableNode
Creates a copy of self with the given fields, using self as the template.
: (?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol) -> BlockLocalVariableNode
3103 3104 3105 |
# File 'lib/prism/node.rb', line 3103 def copy(node_id: self.node_id, location: self.location, flags: self.flags, name: self.name) BlockLocalVariableNode.new(source, node_id, location, flags, name) end |
#deconstruct_keys(keys) ⇒ Hash[Symbol, untyped]
: (Array? keys) -> Hash[Symbol, untyped]
3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 |
# File 'lib/prism/node.rb', line 3110 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
3085 3086 3087 3088 |
# File 'lib/prism/node.rb', line 3085 def each_child_node(&blk) return to_enum(:each_child_node) unless block_given? end |
#inspect ⇒ String
: () -> String
3137 3138 3139 |
# File 'lib/prism/node.rb', line 3137 def inspect # :nodoc: InspectVisitor.compose(self) end |
#name ⇒ Symbol
:call-seq:
name -> Symbol
The name of the block local variable.
a { |; b| } # name `:b`
^
: () -> Symbol
3164 3165 3166 |
# File 'lib/prism/node.rb', line 3164 def name @name end |
#repeated_parameter? ⇒ Boolean
:category: Flags a parameter name that has been repeated in the method signature
: () -> bool
3147 3148 3149 |
# File 'lib/prism/node.rb', line 3147 def repeated_parameter? flags.anybits?(ParameterFlags::REPEATED_PARAMETER) end |
#type ⇒ :block_local_variable_node
See Node#type.
: () -> :block_local_variable_node
3125 3126 3127 |
# File 'lib/prism/node.rb', line 3125 def type :block_local_variable_node end |