Class: YARP::ArgumentsNode
- Inherits:
-
YARPNode
- Object
- YARPNode
- YARP::ArgumentsNode
- Defined in:
- lib/yarp/node.rb,
ext/yarp/api_node.c
Overview
Represents a set of arguments to a method or a keyword.
return foo, bar, baz
^^^^^^^^^^^^^
Instance Attribute Summary collapse
-
#arguments ⇒ Object
readonly
attr_reader arguments: Array.
Instance Method Summary collapse
-
#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].
-
#copy(**params) ⇒ Object
def copy: (**params) -> ArgumentsNode.
- #deconstruct_keys(keys) ⇒ Object
-
#initialize(arguments, location) ⇒ ArgumentsNode
constructor
def initialize: (arguments: Array, location: Location) -> void.
- #inspect(inspector = NodeInspector.new) ⇒ Object
Constructor Details
#initialize(arguments, location) ⇒ ArgumentsNode
def initialize: (arguments: Array, location: Location) -> void
231 232 233 234 |
# File 'lib/yarp/node.rb', line 231 def initialize(arguments, location) @arguments = arguments @location = location end |
Instance Attribute Details
#arguments ⇒ Object (readonly)
attr_reader arguments: Array
228 229 230 |
# File 'lib/yarp/node.rb', line 228 def arguments @arguments end |
Instance Method Details
#accept(visitor) ⇒ Object
def accept: (visitor: Visitor) -> void
237 238 239 |
# File 'lib/yarp/node.rb', line 237 def accept(visitor) visitor.visit_arguments_node(self) end |
#child_nodes ⇒ Object Also known as: deconstruct
def child_nodes: () -> Array[nil | Node]
242 243 244 |
# File 'lib/yarp/node.rb', line 242 def child_nodes [*arguments] end |
#comment_targets ⇒ Object
def comment_targets: () -> Array[Node | Location]
247 248 249 |
# File 'lib/yarp/node.rb', line 247 def comment_targets [*arguments] end |
#copy(**params) ⇒ Object
def copy: (**params) -> ArgumentsNode
252 253 254 255 256 257 |
# File 'lib/yarp/node.rb', line 252 def copy(**params) ArgumentsNode.new( params.fetch(:arguments) { arguments }, params.fetch(:location) { location }, ) end |
#deconstruct_keys(keys) ⇒ Object
263 264 265 |
# File 'lib/yarp/node.rb', line 263 def deconstruct_keys(keys) { arguments: arguments, location: location } end |
#inspect(inspector = NodeInspector.new) ⇒ Object
267 268 269 270 271 |
# File 'lib/yarp/node.rb', line 267 def inspect(inspector = NodeInspector.new) inspector << inspector.header(self) inspector << "└── arguments: #{inspector.list("#{inspector.prefix} ", arguments)}" inspector.to_str end |