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

class SyntaxTree::Field - RDoc Documentation

  1. SyntaxTree::
  2. Field
class SyntaxTree::Field

Field is always the child of an assignment. It represents assigning to a “field” on an object.

object.variable = value
Attributes
Const | Ident

the name of the field being assigned

:“::” | Op | Period

the operator being used for the assignment

Node

the parent object that owns the field being assigned

Public Class Methods

Source

def initialize(parent:, operator:, name:, location:)
  @parent = parent
  @operator = operator
  @name = name
  @location = location
  @comments = []
end
Public Instance Methods

Source

def ===(other)
  other.is_a?(Field) && parent === other.parent &&
    operator === other.operator && name === other.name
end

Source

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

Source

def child_nodes
  operator = self.operator
  [parent, (operator if operator != :"::"), name]
end

Source

def copy(parent: nil, operator: nil, name: nil, location: nil)
  node =
    Field.new(
      parent: parent || self.parent,
      operator: operator || self.operator,
      name: name || self.name,
      location: location || self.location
    )

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

Source

def deconstruct_keys(_keys)
  {
    parent: parent,
    operator: operator,
    name: name,
    location: location,
    comments: comments
  }
end

Source

def format(q)
  q.group do
    q.format(parent)
    q.format(CallOperatorFormatter.new(operator), stackable: false)
    q.format(name)
  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