Crystal::Macros::NamedTupleLiteral - Crystal 1.21.0

# class Crystal::Macros::NamedTupleLiteral

- Crystal::Macros::NamedTupleLiteral
- Crystal::Macros::ASTNode

##
Overview

A named tuple literal.

##
Defined in:

compiler/crystal/macros.cr

##
Instance Method Summary

- #[](key : SymbolLiteral | StringLiteral | MacroId) : ASTNode

  Similar to `NamedTuple#[]` but returns `NilLiteral` if key is undefined.

- #[]=(key : SymbolLiteral | StringLiteral | MacroId, value : ASTNode) : ASTNode

  Adds or replaces a key.

- #double_splat(trailing_string : StringLiteral = nil) : MacroId

  Similar to `HashLiteral#double_splat`

- #each(&) : NilLiteral

  Similar to `NamedTuple#each`

- #each_with_index(&) : NilLiteral

  Similar to `NamedTuple#each_with_index`

- #empty? : BoolLiteral

  Similar to `NamedTuple#empty?`

- #has_key?(key : SymbolLiteral | StringLiteral | MacroId) : ASTNode

  Similar to `NamedTuple#has_key?`

- #keys : ArrayLiteral

  Similar to `NamedTuple#keys`

- #map(&) : ArrayLiteral

  Similar to `NamedTuple#map`

- #reject(&) : NamedTupleLiteral

  Similar to `Hash#reject`

- #reject(*keys : SymbolLiteral | StringLiteral | MacroId) : NamedTupleLiteral

  Returns a new `NamedTupleLiteral` without the provided keys.

- #select(&) : NamedTupleLiteral

  Similar to `Hash#select`

- #select(*keys : SymbolLiteral | StringLiteral | MacroId) : NamedTupleLiteral

  Returns a new `NamedTupleLiteral` with only the provided keys.

- #size : NumberLiteral

  Similar to `NamedTuple#size`

- #to_a : ArrayLiteral(TupleLiteral)

  Similar to `NamedTuple#to_a`

- #values : ArrayLiteral

  Similar to `NamedTuple#values`

### Instance methods inherited from class `Crystal::Macros::ASTNode`

!=(other : ASTNode) : BoolLiteral !=, ==(other : ASTNode) : BoolLiteral ==, class_name : StringLiteral class_name, column_number : StringLiteral | NilLiteral column_number, doc : StringLiteral doc, doc_comment : MacroId doc_comment, end_column_number : StringLiteral | NilLiteral end_column_number, end_line_number : StringLiteral | NilLiteral end_line_number, filename : StringLiteral | NilLiteral filename, id : MacroId id, is_a?(type : TypeNode) : BoolLiteral is_a?, line_number : StringLiteral | NilLiteral line_number, nil? : BoolLiteral nil?, raise(message) : NoReturn raise, stringify : StringLiteral stringify, symbolize : SymbolLiteral symbolize, warning(message : StringLiteral) : NilLiteral warning

##
Instance Method Detail

def [](key : SymbolLiteral | StringLiteral | MacroId) : ASTNode #

Similar to `NamedTuple#[]` but returns `NilLiteral` if key is undefined.

def []=(key : SymbolLiteral | StringLiteral | MacroId, value : ASTNode) : ASTNode #

Adds or replaces a key.

def double_splat(trailing_string : StringLiteral = nil) : MacroId #

Similar to `HashLiteral#double_splat`

def each(&) : NilLiteral #

Similar to `NamedTuple#each`

def each_with_index(&) : NilLiteral #

Similar to `NamedTuple#each_with_index`

def empty? : BoolLiteral #

Similar to `NamedTuple#empty?`

def has_key?(key : SymbolLiteral | StringLiteral | MacroId) : ASTNode #

Similar to `NamedTuple#has_key?`

def keys : ArrayLiteral #

Similar to `NamedTuple#keys`

def map(&) : ArrayLiteral #

Similar to `NamedTuple#map`

def reject(&) : NamedTupleLiteral #

Similar to `Hash#reject`

def reject(*keys : SymbolLiteral | StringLiteral | MacroId) : NamedTupleLiteral #

Returns a new `NamedTupleLiteral` without the provided keys.

def select(&) : NamedTupleLiteral #

Similar to `Hash#select`

def select(*keys : SymbolLiteral | StringLiteral | MacroId) : NamedTupleLiteral #

Returns a new `NamedTupleLiteral` with only the provided keys.

def size : NumberLiteral #

Similar to `NamedTuple#size`

def to_a : ArrayLiteral(TupleLiteral) #

Similar to `NamedTuple#to_a`

def values : ArrayLiteral #

Similar to `NamedTuple#values`