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/Assign.html below:

class SyntaxTree::Assign - RDoc Documentation

  1. SyntaxTree::
  2. Assign
class SyntaxTree::Assign

Assign represents assigning something to a variable or constant. Generally, the left side of the assignment is going to be any node that ends with the name “Field”.

variable = value
Attributes
Node

the expression to be assigned

Public Class Methods

Source

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

Source

def ===(other)
  other.is_a?(Assign) && target === other.target && value === other.value
end

Source

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

Source

def child_nodes
  [target, value]
end

Source

def copy(target: nil, value: nil, location: nil)
  node =
    Assign.new(
      target: target || self.target,
      value: value || self.value,
      location: location || self.location
    )

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

Source

def deconstruct_keys(_keys)
  { target: target, value: value, location: location, comments: comments }
end

Source

def format(q)
  q.group do
    q.format(target)
    q.text(" =")

    if skip_indent?
      q.text(" ")
      q.format(value)
    else
      q.indent do
        q.breakable_space
        q.format(value)
      end
    end
  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