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

class SyntaxTree::Command - RDoc Documentation

  1. SyntaxTree::
  2. Command
class SyntaxTree::Command

Command represents a method call with arguments and no parentheses. Note that Command nodes only happen when there is no explicit receiver for this method.

method argument
Attributes
Args

the arguments being sent with the message

nil | BlockNode

the optional block being passed to the method

Const | Ident

the message being sent to the implicit receiver

Public Class Methods

Source

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

Source

def ===(other)
  other.is_a?(Command) && message === other.message &&
    arguments === other.arguments && block === other.block
end

Source

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

Source

def arity
  arguments.arity
end

Source

def child_nodes
  [message, arguments, block]
end

Source

def copy(message: nil, arguments: nil, block: nil, location: nil)
  node =
    Command.new(
      message: message || self.message,
      arguments: arguments || self.arguments,
      block: block || self.block,
      location: location || self.location
    )

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

Source

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

Source

def format(q)
  q.group do
    q.format(message)
    align(q, self) { q.format(arguments) }
  end

  q.format(block) if block
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