class Prism::KeywordHashNode
Представляет литерал хеша без открывающих и закрывающих фигурных скобок.
foo(a: b)
^^^^ Атрибуты
attr_reader elements: Array[AssocNode | AssocSplatNode]
Публичные методы класса
# File lib/prism/node.rb, line 11437 def initialize(source, node_id, location, flags, elements) @source = source @node_id = node_id @location = location @flags = flags @elements = elements end
Инициализирует новый узел KeywordHashNode.
# File lib/prism/node.rb, line 11497 def self.type :keyword_hash_node end
Возвращает символьное представление типа этого узла. См. Node::type.
Публичные методы экземпляра
# File lib/prism/node.rb, line 11503
def ===(other)
other.is_a?(KeywordHashNode) &&
(flags === other.flags) &&
(elements.length == other.elements.length) &&
elements.zip(other.elements).all? { |left, right| left === right }
end Реализует проверку равенства по case для узла. По сути, это ==, но без сравнения значений расположений. Проверяется только наличие расположений.
# File lib/prism/node.rb, line 11446 def accept(visitor) visitor.visit_keyword_hash_node(self) end
def accept: (Visitor visitor) -> void
# File lib/prism/node.rb, line 11451 def child_nodes [*elements] end
def child_nodes: () -> Array
# File lib/prism/node.rb, line 11461 def comment_targets [*elements] #: Array[Prism::node | Location] end
def comment_targets: () -> Array[Node | Location]
# File lib/prism/node.rb, line 11456 def compact_child_nodes [*elements] end
def compact_child_nodes: () -> Array
# File lib/prism/node.rb, line 11466 def copy(node_id: self.node_id, location: self.location, flags: self.flags, elements: self.elements) KeywordHashNode.new(source, node_id, location, flags, elements) end
def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?elements: Array[AssocNode | AssocSplatNode]) -> KeywordHashNode
# File lib/prism/node.rb, line 11474
def deconstruct_keys(keys)
{ node_id: node_id, location: location, elements: elements }
end def deconstruct_keys: (Array keys) -> { node_id: Integer, location: Location, elements: Array[AssocNode | AssocSplatNode] }
# File lib/prism/node.rb, line 11487 def inspect InspectVisitor.compose(self) end
def inspect -> String
# File lib/prism/node.rb, line 11479 def symbol_keys? flags.anybits?(KeywordHashNodeFlags::SYMBOL_KEYS) end
def symbol_keys?: () -> bool
# File lib/prism/node.rb, line 11492 def type :keyword_hash_node end
Возвращает символьное представление типа этого узла. См. Node#type.
Ruby Core © 1993–2025 Yukihiro Matsumoto
Licensed under the Ruby License.
Ruby Standard Library © contributors
Licensed under their own licenses.