class SyntaxTree::Binary

Experimental RBS support (using type sampling data from the type_fusion project).

# sig/syntax_tree/node.rbs

class SyntaxTree::Binary < SyntaxTree::Node
  def accept: (Visitor visitor) -> untyped
  def child_nodes: () -> untyped
  
  type SyntaxTree__Binary_initialize_right = SyntaxTree::Paren | SyntaxTree::StringLiteral | SyntaxTree::Int | SyntaxTree::VarRef
  
  def initialize: (left: (SyntaxTree::Paren | SyntaxTree::VarRef), operator: Symbol, right: SyntaxTree__Binary_initialize_right, location: SyntaxTree::Location) -> void
end


array << value
but can also be something like pushing a value onto an array:
1 + 1
operation:
operator in between. This can be something that looks like a mathematical
Binary represents any expression that involves two sub-expressions with an

def ===(other)

def ===(other)
  other.is_a?(Binary) && left === other.left &&
    operator === other.operator && right === other.right
end

def accept(visitor)

Experimental RBS support (using type sampling data from the type_fusion project).

def accept: (Visitor visitor) -> untyped

This signature was generated using 5 samples from 1 application.

def accept(visitor)
  visitor.visit_binary(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 2 samples from 1 application.

def child_nodes
  [left, right]
end

def copy(left: nil, operator: nil, right: nil, location: nil)

def copy(left: nil, operator: nil, right: nil, location: nil)
  node =
    Binary.new(
      left: left || self.left,
      operator: operator || self.operator,
      right: right || self.right,
      location: location || self.location
    )
  node.comments.concat(comments.map(&:copy))
  node
end

def deconstruct_keys(_keys)

def deconstruct_keys(_keys)
  {
    left: left,
    operator: operator,
    right: right,
    location: location,
    comments: comments
  }
end

def format(q)

def format(q)
  left = self.left
  power = operator == :**
  q.group do
    q.group { q.format(left) }
    q.text(" ") unless power
    if operator != :<<
      q.group do
        q.text(operator.name)
        q.indent do
          power ? q.breakable_empty : q.breakable_space
          q.format(right)
        end
      end
    elsif left.is_a?(Binary) && left.operator == :<<
      q.group do
        q.text(operator.name)
        q.indent do
          power ? q.breakable_empty : q.breakable_space
          q.format(right)
        end
      end
    else
      q.text("<< ")
      q.format(right)
    end
  end
end

def initialize(left:, operator:, right:, location:)

Experimental RBS support (using type sampling data from the type_fusion project).

type SyntaxTree__Binary_initialize_right = SyntaxTree::Paren | SyntaxTree::StringLiteral | SyntaxTree::Int | SyntaxTree::VarRef

def initialize: (left: (SyntaxTree::Paren | SyntaxTree::VarRef), operator: Symbol, right: SyntaxTree__Binary_initialize_right, location: SyntaxTree::Location) -> void

This signature was generated using 4 samples from 1 application.

def initialize(left:, operator:, right:, location:)
  @left = left
  @operator = operator
  @right = right
  @location = location
  @comments = []
end

def name

def name
  to_s.freeze
end