class SyntaxTree::ExcessedComma
used to indicate that a trailing comma was used.
position typically represents a rest-type parameter, but in this case is
position of the Params node that is used to declare that block. The third
In the above example, an ExcessedComma node would appear in the third
end
[[1, 2, 3], [2, 3, 4]].each do |first, second,|
changes the block parameters such that they will destructure.
ExcessedComma represents a trailing comma in a list of block parameters. It
def ===(other)
def ===(other) other.is_a?(ExcessedComma) && value === other.value end
def accept(visitor)
def accept(visitor) visitor.visit_excessed_comma(self) end
def child_nodes
def child_nodes [] end
def copy(value: nil, location: nil)
def copy(value: nil, location: nil) node = ExcessedComma.new( value: value || self.value, location: location || self.location ) node.comments.concat(comments.map(&:copy)) node end
def deconstruct_keys(_keys)
def deconstruct_keys(_keys) { value: value, location: location, comments: comments } end
def format(q)
def format(q) q.text(value) end
def initialize(value:, location:)
def initialize(value:, location:) @value = value @location = location @comments = [] end