FndPtn
represents matching against a pattern where you find a pattern in an array using the Ruby 3.0+ pattern matching syntax.
case value in [*, 7, *] endAttributes
VarField
the splat on the left-hand side
VarField
the splat on the right-hand side
Node
]
the list of positional expressions in the pattern that
are being matched
Public Class Methods Sourcedef initialize(constant:, left:, values:, right:, location:) @constant = constant @left = left @values = values @right = right @location = location @comments = [] endPublic Instance Methods Source
def ===(other) other.is_a?(FndPtn) && constant === other.constant && left === other.left && ArrayMatch.call(values, other.values) && right === other.right endSource
def accept(visitor) visitor.visit_fndptn(self) endSource
def child_nodes [constant, left, *values, right] endSource
def copy(constant: nil, left: nil, values: nil, right: nil, location: nil) node = FndPtn.new( constant: constant || self.constant, left: left || self.left, values: values || self.values, right: right || self.right, location: location || self.location ) node.comments.concat(comments.map(&:copy)) node endSource
def deconstruct_keys(_keys) { constant: constant, left: left, values: values, right: right, location: location, comments: comments } endSource
def format(q) q.format(constant) if constant q.group do q.text("[") q.indent do q.breakable_empty q.text("*") q.format(left) q.comma_breakable q.seplist(values) { |value| q.format(value) } q.comma_breakable q.text("*") q.format(right) 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