Not
represents the unary not
method being called on an expression.
not valueAttributes
whether or not parentheses were used
whether or not parentheses were used
Node
the statement on which to operate
def initialize(statement:, parentheses:, location:) @statement = statement @parentheses = parentheses @location = location @comments = [] endPublic Instance Methods Source
def ===(other) other.is_a?(Not) && statement === other.statement && parentheses === other.parentheses endSource
def accept(visitor) visitor.visit_not(self) endSource
def child_nodes [statement] endSource
def copy(statement: nil, parentheses: nil, location: nil) node = Not.new( statement: statement || self.statement, parentheses: parentheses || self.parentheses, location: location || self.location ) node.comments.concat(comments.map(&:copy)) node endSource
def deconstruct_keys(_keys) { statement: statement, parentheses: parentheses, location: location, comments: comments } endSource
def format(q) q.text("not") if parentheses q.text("(") q.format(statement) if statement q.text(")") else grandparent = q.grandparent ternary = (grandparent.is_a?(IfNode) || grandparent.is_a?(UnlessNode)) && Ternaryable.call(q, grandparent) if ternary q.if_break { q.text(" ") }.if_flat { q.text("(") } q.format(statement) if statement q.if_flat { q.text(")") } if ternary else q.text(" ") q.format(statement) if statement 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