Spec-Zone.ru › Ruby 3.4

класс Prism::RescueModifierNode

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

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

foo rescue nil
^^^^^^^^^^^^^^

Атрибуты

expression [R]

attr_reader expression: Prism::node

rescue_expression [R]

attr_reader rescue_expression: Prism::node

Методы публичного класса

new (source, node_id, location, flags, expression, keyword_loc, rescue_expression)
Исходный код
# File lib/prism/node.rb, line 15609
def initialize(source, node_id, location, flags, expression, keyword_loc, rescue_expression)
  @source = source
  @node_id = node_id
  @location = location
  @flags = flags
  @expression = expression
  @keyword_loc = keyword_loc
  @rescue_expression = rescue_expression
end

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

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

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

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

=== (other)
Исходный код
# File lib/prism/node.rb, line 15693
def ===(other)
  other.is_a?(RescueModifierNode) &&
    (expression === other.expression) &&
    (keyword_loc.nil? == other.keyword_loc.nil?) &&
    (rescue_expression === other.rescue_expression)
end

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

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

def accept: (Visitor visitor) -> void

child_nodes ()
Исходный код
# File lib/prism/node.rb, line 15625
def child_nodes
  [expression, rescue_expression]
end

def child_nodes: () -> Array[nil | Node]

Также алиасировано как: deconstruct
comment_targets ()
Исходный код
# File lib/prism/node.rb, line 15635
def comment_targets
  [expression, keyword_loc, rescue_expression] #: Array[Prism::node | Location]
end

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

compact_child_nodes ()
Исходный код
# File lib/prism/node.rb, line 15630
def compact_child_nodes
  [expression, rescue_expression]
end

def compact_child_nodes: () -> Array

copy (node_id: self.node_id, location: self.location, flags: self.flags, expression: self.expression, keyword_loc: self.keyword_loc, rescue_expression: self.rescue_expression)
Исходный код
# File lib/prism/node.rb, line 15640
def copy(node_id: self.node_id, location: self.location, flags: self.flags, expression: self.expression, keyword_loc: self.keyword_loc, rescue_expression: self.rescue_expression)
  RescueModifierNode.new(source, node_id, location, flags, expression, keyword_loc, rescue_expression)
end

def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?expression: Prism::node, ?keyword_loc: Location, ?rescue_expression: Prism::node) -> RescueModifierNode

deconstruct ()

def deconstruct: () -> Array[nil | Node]

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

def deconstruct_keys: (Array keys) -> { node_id: Integer, location: Location, expression: Prism::node, keyword_loc: Location, rescue_expression: Prism::node }

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

def inspect -> String

keyword ()
Исходный код
# File lib/prism/node.rb, line 15672
def keyword
  keyword_loc.slice
end

def keyword: () -> String

keyword_loc ()
Исходный код
# File lib/prism/node.rb, line 15656
def keyword_loc
  location = @keyword_loc
  return location if location.is_a?(Location)
  @keyword_loc = Location.new(source, location >> 32, location & 0xFFFFFFFF)
end

attr_reader keyword_loc: Location

save_keyword_loc (repository)
Исходный код
# File lib/prism/node.rb, line 15664
def save_keyword_loc(repository)
  repository.enter(node_id, :keyword_loc)
end

Сохранить расположение keyword_loc с помощью заданного сохраненного источника, чтобы его можно было получить позже.

type ()
Исходный код
# File lib/prism/node.rb, line 15682
def type
  :rescue_modifier_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