A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://ruby-syntax-tree.github.io/syntax_tree/SyntaxTree/ARefField.html below:

class SyntaxTree::ARefField - RDoc Documentation

  1. SyntaxTree::
  2. ARefField
class SyntaxTree::ARefField

ARefField represents assigning values into collections at specific indices. Put another way, it’s any time you’re calling the method []=. The ARefField node itself is just the left side of the assignment, and they’re always wrapped in assign nodes.

collection[index] = value
Attributes
Node

the value being indexed

nil | Args

the value being passed within the brackets

Public Class Methods

Source

def initialize(collection:, index:, location:)
  @collection = collection
  @index = index
  @location = location
  @comments = []
end
Public Instance Methods

Source

def ===(other)
  other.is_a?(ARefField) && collection === other.collection &&
    index === other.index
end

Source

def accept(visitor)
  visitor.visit_aref_field(self)
end

Source

def child_nodes
  [collection, index]
end

Source

def copy(collection: nil, index: nil, location: nil)
  node =
    ARefField.new(
      collection: collection || self.collection,
      index: index || self.index,
      location: location || self.location
    )

  node.comments.concat(comments.map(&:copy))
  node
end

Source

def deconstruct_keys(_keys)
  {
    collection: collection,
    index: index,
    location: location,
    comments: comments
  }
end

Source

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

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4