Spec-Zone.ru › Ruby 3.4

class Prism::MatchWriteNode

Parent:
Prism::Node

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

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

Атрибуты

call [R]

attr_reader call: CallNode

targets [R]

attr_reader targets: Массив

Публичные методы класса

new (source, node_id, location, flags, call, targets)
Исходный код
# File lib/prism/node.rb, line 12736
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 12795
def self.type
  :match_write_node
end

Возвращает символическое представление типа узла. См. «Node::type».

Публичные методы экземпляра

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

Реализует равенство по типу для узла. Это по существу ==, но без сравнения значений местоположений. Местоположения проверяются только на наличие.

accept (visitor)
Исходный код
# File lib/prism/node.rb, line 12746
def accept(visitor)
  visitor.visit_match_write_node(self)
end

def accept: (Visitor visitor) -> void

child_nodes ()
Исходный код
# File lib/prism/node.rb, line 12751
def child_nodes
  [call, *targets]
end

def child_nodes: () -> Массив[nil | Узел]

Также алиас: deconstruct
comment_targets ()
Исходный код
# File lib/prism/node.rb, line 12761
def comment_targets
  [call, *targets] #: Array[Prism::node | Location]
end

def comment_targets: () -> Массив[Узел | Местоположение]

compact_child_nodes ()
Исходный код
# File lib/prism/node.rb, line 12756
def compact_child_nodes
  [call, *targets]
end

def compact_child_nodes: () -> Массив

copy (node_id: self.node_id, location: self.location, flags: self.flags, call: self.call, targets: self.targets)
Исходный код
# File lib/prism/node.rb, line 12766
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: Массив) -> MatchWriteNode

deconstruct ()

def deconstruct: () -> Массив[nil | Узел]

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

def deconstruct_keys: (Массив keys) -> { node_id: Integer, location: Location, call: CallNode, targets: Массив }

inspect ()
Исходный код
# File lib/prism/node.rb, line 12785
def inspect
  InspectVisitor.compose(self)
end

def inspect -> String

type ()
Исходный код
# File lib/prism/node.rb, line 12790
def type
  :match_write_node
end

Возвращает символическое представление типа узла. См. ‘Node#type’.

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

Spec-Zone.ru

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