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
Public Class Methods
Source
# File lib/syntax_tree/node.rb, line 3479 def initialize(message:, arguments:, block:, location:) @message = message @arguments = arguments @block = block @location = location @comments = [] end
Public Instance Methods
Source
# File lib/syntax_tree/node.rb, line 3529 def ===(other) other.is_a?(Command) && message === other.message && arguments === other.arguments && block === other.block end
Source
# File lib/syntax_tree/node.rb, line 3487 def accept(visitor) visitor.visit_command(self) end
Source
# File lib/syntax_tree/node.rb, line 3491 def child_nodes [message, arguments, block] end
Also aliased as: deconstruct
Source
# File lib/syntax_tree/node.rb, line 3495 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
# File lib/syntax_tree/node.rb, line 3510 def deconstruct_keys(_keys) { message: message, arguments: arguments, block: block, location: location, comments: comments } end
Source
# File lib/syntax_tree/node.rb, line 3520 def format(q) q.group do q.format(message) align(q, self) { q.format(arguments) } end q.format(block) if block end