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

class SyntaxTree::ArgParen - RDoc Documentation

  1. SyntaxTree::
  2. ArgParen
class SyntaxTree::ArgParen

ArgParen represents wrapping arguments to a method inside a set of parentheses.

method(argument)

In the example above, there would be an ArgParen node around the Args node that represents the set of arguments being sent to the method method. The argument child node can be nil if no arguments were passed, as in:

method()
Attributes Public Class Methods

Source

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

Source

def ===(other)
  other.is_a?(ArgParen) && arguments === other.arguments
end

Source

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

Source

def arity
  arguments&.arity || 0
end

Source

def child_nodes
  [arguments]
end

Source

def copy(arguments: nil, location: nil)
  node =
    ArgParen.new(
      arguments: arguments || self.arguments,
      location: location || self.location
    )

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

Source

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

Source

def format(q)
  unless arguments
    q.text("()")
    return
  end

  q.text("(")
  q.group do
    q.indent do
      q.breakable_empty
      q.format(arguments)
      q.if_break { q.text(",") } if q.trailing_comma? && trailing_comma?
    end
    q.breakable_empty
  end
  q.text(")")
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