class SyntaxTree::ARef
Experimental RBS support (using type sampling data from the type_fusion
project).
# sig/syntax_tree/node.rbs class SyntaxTree::ARef < SyntaxTree::Node def child_nodes: () -> untyped def initialize: (collection: SyntaxTree::CallNode, index: SyntaxTree::Args, location: SyntaxTree::Location) -> void end
collection[]
wouldn’t have a second child node:
can call procs with a pretty esoteric syntax. In the following example, you
some cases, you don’t necessarily have the second child node, because you
The nodes usually contains two children, the collection and the index. In
collection[index]
#[].
specific index. Put another way, it’s any time you’re calling the method
ARef represents when you’re pulling a value out of a collection at a
def ===(other)
def ===(other) other.is_a?(ARef) && collection === other.collection && index === other.index end
def accept(visitor)
def accept(visitor) visitor.visit_aref(self) end
def child_nodes
Experimental RBS support (using type sampling data from the type_fusion
project).
def child_nodes: () -> untyped
This signature was generated using 1 sample from 1 application.
def child_nodes [collection, index] end
def copy(collection: nil, index: nil, location: nil)
def copy(collection: nil, index: nil, location: nil) node = ARef.new( collection: collection || self.collection, index: index || self.index, location: location || self.location ) node.comments.concat(comments.map(&:copy)) node end
def deconstruct_keys(_keys)
def deconstruct_keys(_keys) { collection: collection, index: index, location: location, comments: comments } end
def format(q)
def format(q) q.group do q.format(collection) q.text("[") if index q.indent do q.breakable_empty q.format(index) end q.breakable_empty end q.text("]") end end
def initialize(collection:, index:, location:)
Experimental RBS support (using type sampling data from the type_fusion
project).
def initialize: (collection: SyntaxTree::CallNode, index: SyntaxTree::Args, location: SyntaxTree::Location) -> void
This signature was generated using 1 sample from 1 application.
def initialize(collection:, index:, location:) @collection = collection @index = index @location = location @comments = [] end