RangeNode
represents using the .. or the … operator between two expressions. Usually this is to create a range object.
1..2
Sometimes this operator is used to create a flip-flop.
if value == 5 .. value == 10 end
One of the sides of the expression may be nil, but not both.
AttributesNode
the left side of the expression
Op
the operator used for this range
Node
the right side of the expression
def initialize(left:, operator:, right:, location:) @left = left @operator = operator @right = right @location = location @comments = [] endPublic Instance Methods Source
def ===(other) other.is_a?(RangeNode) && left === other.left && operator === other.operator && right === other.right endSource
def accept(visitor) visitor.visit_range(self) endSource
def child_nodes [left, right] endSource
def copy(left: nil, operator: nil, right: nil, location: nil) node = RangeNode.new( left: left || self.left, operator: operator || self.operator, right: right || self.right, location: location || self.location ) node.comments.concat(comments.map(&:copy)) node endSource
def deconstruct_keys(_keys) { left: left, operator: operator, right: right, location: location, comments: comments } endSource
def format(q) q.format(left) if left case q.parent when IfNode, UnlessNode q.text(" #{operator.value} ") else q.text(operator.value) end q.format(right) if right 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