class Prism::MatchWriteNode
Представляет запись локальных переменных с помощью сопоставления с регулярным выражением, содержащим именованные группы захвата.
/(?<foo>bar)/ =~ baz ^^^^^^^^^^^^^^^^^^^^
Атрибуты
attr_reader targets: Array
Открытые методы класса
# 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.
# File lib/prism/node.rb, line 12948 def self.type :match_write_node end
Возвращает символьное представление типа этого узла. См. Node::type.
Открытые методы экземпляра
# 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 для узла. По сути, это ==, но без сравнения значений расположений. Проверяется только наличие расположений.
# File lib/prism/node.rb, line 12899 def accept(visitor) visitor.visit_match_write_node(self) end
def accept: (Visitor visitor) -> void
# File lib/prism/node.rb, line 12904 def child_nodes [call, *targets] end
def child_nodes: () -> Array
# File lib/prism/node.rb, line 12914 def comment_targets [call, *targets] #: Array[Prism::node | Location] end
def comment_targets: () -> Array[Node | Location]
# File lib/prism/node.rb, line 12909 def compact_child_nodes [call, *targets] end
def compact_child_nodes: () -> Array
# 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
# 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 }
# File lib/prism/node.rb, line 12938 def inspect InspectVisitor.compose(self) end
def inspect -> String
# 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.