class SyntaxTree::ArgsForward

ArgsForward represents forwarding all kinds of arguments onto another method call.

def request(method, path, **headers, &block); end

def get(...)
  request(:GET, ...)
end

def post(...)
  request(:POST, ...)
end

In the example above, both the get and post methods are forwarding all of their arguments (positional, keyword, and block) on to the request method. The ArgsForward node appears in both the caller (the request method calls) and the callee (the get and post definitions).

Attributes

comments[R]
Array[ Comment | EmbDoc ]

the comments attached to this node

Public Class Methods

new(location:) click to toggle source
# File lib/syntax_tree/node.rb, line 1008
def initialize(location:)
  @location = location
  @comments = []
end

Public Instance Methods

===(other) click to toggle source
# File lib/syntax_tree/node.rb, line 1038
def ===(other)
  other.is_a?(ArgsForward)
end
accept(visitor) click to toggle source
# File lib/syntax_tree/node.rb, line 1013
def accept(visitor)
  visitor.visit_args_forward(self)
end
arity() click to toggle source
# File lib/syntax_tree/node.rb, line 1042
def arity
  Float::INFINITY
end
child_nodes() click to toggle source
# File lib/syntax_tree/node.rb, line 1017
def child_nodes
  []
end
Also aliased as: deconstruct
copy(location: nil) click to toggle source
# File lib/syntax_tree/node.rb, line 1021
def copy(location: nil)
  node = ArgsForward.new(location: location || self.location)

  node.comments.concat(comments.map(&:copy))
  node
end
deconstruct()
Alias for: child_nodes
deconstruct_keys(_keys) click to toggle source
# File lib/syntax_tree/node.rb, line 1030
def deconstruct_keys(_keys)
  { location: location, comments: comments }
end
format(q) click to toggle source
# File lib/syntax_tree/node.rb, line 1034
def format(q)
  q.text("...")
end