Paren
represents using balanced parentheses in a couple places in a Ruby program. In
general parentheses can be used anywhere a Ruby expression can be used.
(1 + 2)Attributes
Node
the expression inside the parentheses
LParen
the left parenthesis that opened this statement
def initialize(lparen:, contents:, location:) @lparen = lparen @contents = contents @location = location @comments = [] endPublic Instance Methods Source
def ===(other) other.is_a?(Paren) && lparen === other.lparen && contents === other.contents endSource
def accept(visitor) visitor.visit_paren(self) endSource
def child_nodes [lparen, contents] endSource
def copy(lparen: nil, contents: nil, location: nil) node = Paren.new( lparen: lparen || self.lparen, contents: contents || self.contents, location: location || self.location ) node.comments.concat(comments.map(&:copy)) node endSource
def deconstruct_keys(_keys) { lparen: lparen, contents: contents, location: location, comments: comments } endSource
def format(q) contents = self.contents q.group do q.format(lparen) if contents && (!contents.is_a?(Params) || !contents.empty?) q.indent do q.breakable_empty q.format(contents) end end q.breakable_empty q.text(")") 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