module Crystalizer::Any

Direct including types

Defined in:

any.cr

Instance Method Summary

Instance Method Detail

def ==(other : Any) : Bool #

Returns true if both self and other's raw object are equal.


[View source]
def [](index : Int) #

Assumes the underlying value is an Indexable or a Hash, and returns the element at the given index.

Raises if the underlying value is not an Indexable or a Hash.


[View source]
def [](key) #

Assumes the underlying value is a Hash and returns the element with the given key.

Raises if the underlying value is not a Hash.


[View source]
def []?(index : Int) #

Assumes the underlying value is an Indexable and returns the element at the given index, or nil if out of bounds.

Raises if the underlying value is not an Indexable.


[View source]
def []?(key) #

Assumes the underlying value is a Hash and returns the element with the given key, or nil if the key is not present.

Raises if the underlying value is not a Hash.


[View source]
def clone : Any #

Returns a new Any instance with the #raw value #cloneed.


[View source]
def dig(key_or_index, *subkeys) #

Traverses the depth of a structure and returns the value, otherwise raises.


[View source]
def dig?(key, *subkeys) #

Traverses the depth of a structure and returns the value. Returns nil if not found.


[View source]
def dup : Any #

Returns a new Any instance with the #raw value #duped.


[View source]
def hash(hasher) #

See Object#hash(hasher)


[View source]
abstract def raw #

Returns the raw underlying value.


[View source]
def size : Int #

[View source]
def to(type : T.class) : T forall T #

Casts the underlying value to T.


[View source]
def to?(type : T.class) forall T #

Casts the underlying value to T, or return nil if not possible.


[View source]