Class: Prism::RequiredParameterNode
- Inherits:
-
PrismNode
- Object
- PrismNode
- Prism::RequiredParameterNode
- Defined in:
- lib/prism/node.rb,
ext/prism/api_node.c
Overview
Represents a required parameter to a method, block, or lambda definition.
def a(b)
^
end
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
attr_reader name: Symbol.
Class Method Summary collapse
-
.type ⇒ Object
Return a symbol representation of this node type.
Instance Method Summary collapse
-
#===(other) ⇒ Object
Implements case-equality for the node.
-
#accept(visitor) ⇒ Object
def accept: (Visitor visitor) -> void.
-
#child_nodes ⇒ Object
(also: #deconstruct)
def child_nodes: () -> Array[nil | Node].
-
#comment_targets ⇒ Object
def comment_targets: () -> Array[Node | Location].
-
#compact_child_nodes ⇒ Object
def compact_child_nodes: () -> Array.
-
#copy(node_id: self.node_id, location: self.location, flags: self.flags, name: self.name) ⇒ Object
def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol) -> RequiredParameterNode.
-
#deconstruct_keys(keys) ⇒ Object
def deconstruct_keys: (Array keys) -> { node_id: Integer, location: Location, name: Symbol }.
-
#initialize(source, node_id, location, flags, name) ⇒ RequiredParameterNode
constructor
Initialize a new RequiredParameterNode node.
-
#inspect ⇒ Object
def inspect -> String.
-
#repeated_parameter? ⇒ Boolean
def repeated_parameter?: () -> bool.
-
#type ⇒ Object
Return a symbol representation of this node type.
Constructor Details
#initialize(source, node_id, location, flags, name) ⇒ RequiredParameterNode
Initialize a new RequiredParameterNode node.
14049 14050 14051 14052 14053 14054 14055 |
# File 'lib/prism/node.rb', line 14049 def initialize(source, node_id, location, flags, name) @source = source @node_id = node_id @location = location @flags = flags @name = name end |
Instance Attribute Details
#name ⇒ Object (readonly)
attr_reader name: Symbol
14096 14097 14098 |
# File 'lib/prism/node.rb', line 14096 def name @name end |
Class Method Details
.type ⇒ Object
Return a symbol representation of this node type. See ‘Node::type`.
14109 14110 14111 |
# File 'lib/prism/node.rb', line 14109 def self.type :required_parameter_node end |
Instance Method Details
#===(other) ⇒ Object
Implements case-equality for the node. This is effectively == but without comparing the value of locations. Locations are checked only for presence.
14115 14116 14117 14118 14119 |
# File 'lib/prism/node.rb', line 14115 def ===(other) other.is_a?(RequiredParameterNode) && (flags === other.flags) && (name === other.name) end |
#accept(visitor) ⇒ Object
def accept: (Visitor visitor) -> void
14058 14059 14060 |
# File 'lib/prism/node.rb', line 14058 def accept(visitor) visitor.visit_required_parameter_node(self) end |
#child_nodes ⇒ Object Also known as: deconstruct
def child_nodes: () -> Array[nil | Node]
14063 14064 14065 |
# File 'lib/prism/node.rb', line 14063 def child_nodes [] end |
#comment_targets ⇒ Object
def comment_targets: () -> Array[Node | Location]
14073 14074 14075 |
# File 'lib/prism/node.rb', line 14073 def comment_targets [] #: Array[Prism::node | Location] end |
#compact_child_nodes ⇒ Object
def compact_child_nodes: () -> Array
14068 14069 14070 |
# File 'lib/prism/node.rb', line 14068 def compact_child_nodes [] end |
#copy(node_id: self.node_id, location: self.location, flags: self.flags, name: self.name) ⇒ Object
def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?name: Symbol) -> RequiredParameterNode
14078 14079 14080 |
# File 'lib/prism/node.rb', line 14078 def copy(node_id: self.node_id, location: self.location, flags: self.flags, name: self.name) RequiredParameterNode.new(source, node_id, location, flags, name) end |
#deconstruct_keys(keys) ⇒ Object
def deconstruct_keys: (Array keys) -> { node_id: Integer, location: Location, name: Symbol }
14086 14087 14088 |
# File 'lib/prism/node.rb', line 14086 def deconstruct_keys(keys) { node_id: node_id, location: location, name: name } end |
#inspect ⇒ Object
def inspect -> String
14099 14100 14101 |
# File 'lib/prism/node.rb', line 14099 def inspect InspectVisitor.compose(self) end |
#repeated_parameter? ⇒ Boolean
def repeated_parameter?: () -> bool
14091 14092 14093 |
# File 'lib/prism/node.rb', line 14091 def repeated_parameter? flags.anybits?(ParameterFlags::REPEATED_PARAMETER) end |
#type ⇒ Object
Return a symbol representation of this node type. See ‘Node#type`.
14104 14105 14106 |
# File 'lib/prism/node.rb', line 14104 def type :required_parameter_node end |