Spec-Zone.ru › Ruby 3.4
  1. Prism::
  2. MatchWriteNode

class Prism::MatchWriteNode

Родитель:
Prism::Node

Представляет запись локальных переменных с помощью сопоставления с регулярным выражением, содержащим именованные группы захвата.

/(?<foo>bar)/ =~ baz
^^^^^^^^^^^^^^^^^^^^

Атрибуты

call [R]

attr_reader call: CallNode

targets [R]

attr_reader targets: Array

Открытые методы класса

new (source, node_id, location, flags, call, targets) Показать исходный код
# File lib/prism/node.rb, line 12889
def initialize(source, node_id, location, flags, call, targets)
  @source = source
  @node_id = node_id
  @location = location
  @flags = flags
  @call = call
  @targets = targets
end

Инициализирует новый узел MatchWriteNode.

type () Показать исходный код
# File lib/prism/node.rb, line 12948
def self.type
  :match_write_node
end

Возвращает символьное представление типа этого узла. См. Node::type.

Открытые методы экземпляра

=== (other) Показать исходный код
# File lib/prism/node.rb, line 12954
def ===(other)
  other.is_a?(MatchWriteNode) &&
    (call === other.call) &&
    (targets.length == other.targets.length) &&
    targets.zip(other.targets).all? { |left, right| left === right }
end

Реализует проверку равенства для case для узла. По сути, это ==, но без сравнения значений расположений. Проверяется только наличие расположений.

accept (visitor) Показать исходный код
# File lib/prism/node.rb, line 12899
def accept(visitor)
  visitor.visit_match_write_node(self)
end

def accept: (Visitor visitor) -> void

child_nodes () Показать исходный код
# File lib/prism/node.rb, line 12904
def child_nodes
  [call, *targets]
end

def child_nodes: () -> Array

Также является псевдонимом: deconstruct
comment_targets () Показать исходный код
# File lib/prism/node.rb, line 12914
def comment_targets
  [call, *targets] #: Array[Prism::node | Location]
end

def comment_targets: () -> Array[Node | Location]

compact_child_nodes () Показать исходный код
# File lib/prism/node.rb, line 12909
def compact_child_nodes
  [call, *targets]
end

def compact_child_nodes: () -> Array

copy (node_id: self.node_id, location: self.location, flags: self.flags, call: self.call, targets: self.targets) Показать исходный код
# File lib/prism/node.rb, line 12919
def copy(node_id: self.node_id, location: self.location, flags: self.flags, call: self.call, targets: self.targets)
  MatchWriteNode.new(source, node_id, location, flags, call, targets)
end

def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?call: CallNode, ?targets: Array) -> MatchWriteNode

deconstruct ()

def deconstruct: () -> Array

Псевдоним для: child_nodes
deconstruct_keys (keys) Показать исходный код
# File lib/prism/node.rb, line 12927
def deconstruct_keys(keys)
  { node_id: node_id, location: location, call: call, targets: targets }
end

def deconstruct_keys: (Array keys) -> { node_id: Integer, location: Location, call: CallNode, targets: Array }

inspect () Показать исходный код
# File lib/prism/node.rb, line 12938
def inspect
  InspectVisitor.compose(self)
end

def inspect -> String

type () Показать исходный код
# File lib/prism/node.rb, line 12943
def type
  :match_write_node
end

Возвращает символьное представление типа этого узла. См. Node#type.

Ruby Core © 1993–2025 Yukihiro Matsumoto
Licensed under the Ruby License.
Ruby Standard Library © contributors
Licensed under their own licenses.

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API