class SyntaxTree::For
end
for value in list do
For represents using a for loop.
def accept(visitor)
def accept(visitor) visitor.visit_for(self) end
def child_nodes
def child_nodes [index, collection, statements] end
def deconstruct_keys(_keys)
def deconstruct_keys(_keys) { index: index, collection: collection, statements: statements, location: location, comments: comments } end
def format(q)
def format(q) q.group do q.text("for ") q.group { q.format(index) } q.text(" in ") q.format(collection) unless statements.empty? q.indent do q.breakable(force: true) q.format(statements) end end q.breakable(force: true) q.text("end") end end
def initialize(index:, collection:, statements:, location:, comments: [])
def initialize(index:, collection:, statements:, location:, comments: []) @index = index @collection = collection @statements = statements @location = location @comments = comments end