For
represents using a for
loop.
for value in list do endAttributes
Node
the object being enumerated in the loop
MLHS
| VarField
the variable declaration being used to
pull values out of the object being enumerated
Public Class Methods Sourcedef initialize(index:, collection:, statements:, location:) @index = index @collection = collection @statements = statements @location = location @comments = [] endPublic Instance Methods Source
def ===(other) other.is_a?(For) && index === other.index && collection === other.collection && statements === other.statements endSource
def accept(visitor) visitor.visit_for(self) endSource
def child_nodes [index, collection, statements] endSource
def copy(index: nil, collection: nil, statements: nil, location: nil) node = For.new( index: index || self.index, collection: collection || self.collection, statements: statements || self.statements, location: location || self.location ) node.comments.concat(comments.map(&:copy)) node endSource
def deconstruct_keys(_keys) { index: index, collection: collection, statements: statements, location: location, comments: comments } endSource
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 q.format(statements) end end q.breakable_force q.text("end") end 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