class SyntaxTree::Field
object.variable = value
“field” on an object.
Field is always the child of an assignment. It represents assigning to a
def ===(other)
def ===(other) other.is_a?(Field) && parent === other.parent && operator === other.operator && name === other.name end
def accept(visitor)
def accept(visitor) visitor.visit_field(self) end
def child_nodes
def child_nodes operator = self.operator [parent, (operator if operator != :"::"), name] end
def copy(parent: nil, operator: nil, name: nil, location: nil)
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
def deconstruct_keys(_keys)
def deconstruct_keys(_keys) { parent: parent, operator: operator, name: name, location: location, comments: comments } end
def format(q)
def format(q) q.group do q.format(parent) q.format(CallOperatorFormatter.new(operator), stackable: false) q.format(name) end end
def initialize(parent:, operator:, name:, location:)
def initialize(parent:, operator:, name:, location:) @parent = parent @operator = operator @name = name @location = location @comments = [] end