struct

Config::Any

Inherits Enumerable < Struct < Value < Object

Constructors

new(raw : Config::Type)

Creates a Config::Any that wraps the given Config::Type.

Source

Instance methods

==(other : Config::Any)

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

Source
==(other)

Returns true if the raw object is equal to other.

Source
[](index : Int::Primitive) : Any

Assumes the underlying value is an Array and returns the element at the given index.

Raises if the underlying value is not an Array.

Source
[](key : String) : Any

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

Raises if the underlying value is not a Hash.

Source
[]?(index : Int::Primitive) : Any | Nil

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

Raises if the underlying value is not an Array.

Source
[]?(key : String) : Any | Nil

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.

Source
as_a(*path : KeyTypes, each_as : U.class) : Array(U) forall U

Assumes the underlying value is indexable and returns the specified element at the given key path as an Array of type U.

Raises if it is not an Array, not found, or an entry is not able to be cast to type U.

Source
as_a

Returns the underlying value as an Array(Any) if it can.

Raises otherwise.

Source
as_a(*path : KeyTypes) : Array(Any)

Assumes the underlying value is indexable and returns the specified element at the given key path as an Array(Any).

Raises if it is not an Array or not found.

Source
as_a(*path : KeyTypes, each_as : U.class, &block : U -> Nil) : Nil forall U

Assumes the underlying value is indexable and yields each element at the given key path as type U.

Raises if it is not an Array, not found, or an entry is not able to be cast to type U.

Source
as_a?(*path : KeyTypes, each_as : U.class, skip : Bool = true) : Array(U) | Nil forall U

Assumes the underlying value is indexable and returns the specified element at the given key path as an Array of type U.

Returns nil if it is not an Array or not found.

Note: If an entry is not able to be cast to type U and skip is not false (the default) it is skipped.

Source
as_a?

Returns the underlying value as an Array(Any) if it can.

Returns nil otherwise.

Source
as_a?(*path : KeyTypes) : Array(Any) | Nil

Assumes the underlying value is indexable and returns the specified element at the given key path as an Array(Any).

Returns nil if it is not an Array or not found.

Source
as_a?(*path : KeyTypes, each_as : U.class | Nil = nil, &block : U -> Nil) : Bool forall U

Assumes the underlying value is indexable and yields each element at the given key path as type U.

Returns a Bool indicating if the Array was found.

Note: If an entry is not able to be cast to type U it is skipped.

Source
as_bool

Returns the underlying value as an Bool if it can.

Raises otherwise.

Source
as_bool(*path : KeyTypes) : Bool

Assumes the underlying value is indexable and returns the element with the given key as a Bool.

Raises otherwise.

Source
as_bool?

Returns the underlying value as an Bool if it can.

Returns nil otherwise.

Source
as_bool?(*path : KeyTypes) : Bool | Nil

Assumes the underlying value is indexable and returns the element with the given key as a Bool.

Returns nil otherwise.

Source
as_f

Returns the underlying value as an Float64 if it can.

Raises otherwise.

Source
as_f(*path : KeyTypes) : Float64

Assumes the underlying value is indexable and returns the element with the given key as a Float64.

Raises otherwise.

Source
as_f32

Returns the underlying value as an Float32 if it can.

Raises otherwise.

Source
as_f32(*path : KeyTypes) : Float32

Assumes the underlying value is indexable and returns the element with the given key as a Float32.

Raises otherwise.

Source
as_f32?

Returns the underlying value as an Float32 if it can.

Returns nil otherwise.

Source
as_f32?(*path : KeyTypes) : Float32 | Nil

Assumes the underlying value is indexable and returns the element with the given key as a Float32.

Returns nil otherwise.

Source
as_f?

Returns the underlying value as an Float64 if it can.

Returns nil otherwise.

Source
as_f?(*path : KeyTypes) : Float64 | Nil

Assumes the underlying value is indexable and returns the element with the given key as a Float64.

Returns nil otherwise.

Source
as_h(*path : KeyTypes, each_as : U.class) : Hash(String, U) forall U

Assumes the underlying value is indexable and returns the specified element at the given key path as a Hash of type U.

Raises if it is not an Hash, not found, or an entry is not able to be cast to type U.

Source
as_h

Returns the underlying value as an Hash(String, Any) if it can.

Raises otherwise.

Source
as_h(*path : KeyTypes) : Hash(String, Any)

Assumes the underlying value is indexable and returns the specified element at the given key path as an Hash(String, Any).

Raises if it is not an Hash or not found.

Source
as_h(*path : KeyTypes, each_as : U.class, &block : String, U -> Nil) : Nil forall U

Assumes the underlying value is indexable and yields each element at the given key path as type U.

Raises if it is not a Hash, not found, or an entry is not able to be cast to type U.

Source
as_h?(*path : KeyTypes, each_as : U.class, skip : Bool = true) : Hash(String, U) | Nil forall U

Assumes the underlying value is indexable and returns the specified element at the given key path as a Hash of type U.

Returns nil if it is not a Hash or not found.

Note: If an entry is not able to be cast to type U and skip is not false (the default) it is skipped.

Source
as_h?

Returns the underlying value as an Hash(String, Any) if it can.

Returns nil otherwise.

Source
as_h?(*path : KeyTypes) : Hash(String, Any) | Nil

Assumes the underlying value is indexable and returns the specified element at the given key path as an Hash(String, Any).

Returns nil if it is not an Hash or not found.

Source
as_h?(*path : KeyTypes, each_as : U.class | Nil = nil, &block : String, U -> Nil) : Bool forall U

Assumes the underlying value is indexable and yields each element at the given key path as type U.

Returns a Bool indicating if the Hash was found.

Note: If an entry is not able to be cast to type U it is skipped.

Source
as_i

Returns the underlying value as an Int32 if it can.

Raises otherwise.

Source
as_i(*path : KeyTypes) : Int32

Assumes the underlying value is indexable and returns the element with the given key as a Int32.

Raises otherwise.

Source
as_i128

Returns the underlying value as an Int128 if it can.

Raises otherwise.

Source
as_i128(*path : KeyTypes) : Int128

Assumes the underlying value is indexable and returns the element with the given key as a Int128.

Raises otherwise.

Source
as_i128?

Returns the underlying value as an Int128 if it can.

Returns nil otherwise.

Source
as_i128?(*path : KeyTypes) : Int128 | Nil

Assumes the underlying value is indexable and returns the element with the given key as a Int128.

Returns nil otherwise.

Source
as_i64

Returns the underlying value as an Int64 if it can.

Raises otherwise.

Source
as_i64(*path : KeyTypes) : Int64

Assumes the underlying value is indexable and returns the element with the given key as a Int64.

Raises otherwise.

Source
as_i64?

Returns the underlying value as an Int64 if it can.

Returns nil otherwise.

Source
as_i64?(*path : KeyTypes) : Int64 | Nil

Assumes the underlying value is indexable and returns the element with the given key as a Int64.

Returns nil otherwise.

Source
as_i?

Returns the underlying value as an Int32 if it can.

Returns nil otherwise.

Source
as_i?(*path : KeyTypes) : Int32 | Nil

Assumes the underlying value is indexable and returns the element with the given key as a Int32.

Returns nil otherwise.

Source
as_s

Returns the underlying value as an String if it can.

Raises otherwise.

Source
as_s(*path : KeyTypes) : String

Assumes the underlying value is indexable and returns the element with the given key as a String.

Raises otherwise.

Source
as_s?

Returns the underlying value as an String if it can.

Returns nil otherwise.

Source
as_s?(*path : KeyTypes) : String | Nil

Assumes the underlying value is indexable and returns the element with the given key as a String.

Returns nil otherwise.

Source
dig(*path : KeyTypes) : Any

Extracts the nested value specified by the sequence of path keys by calling dig at each step, raising if any intermediate step fails.

Source
dig?(*path : KeyTypes) : Any | Nil

Extracts the nested value specified by the sequence of path keys by calling dig at each step, returning nil if any intermediate step is nil.

Source
each

Assumes the underlying value is an Array or Hash and yields each of the elements or key/values, always as Config::Any. Raises if the underlying value is not an Array or Hash.

Source
hash(hasher)

See Object#hash(hasher)

Source
is_nil?

Returns a Bool indicating if the value at the key is nil.

Source
is_nil?(*path : KeyTypes) : Bool

Assumes the underlying value is indexable and returns a Bool that indicates if the element at the given paths underlying value is Nil.

Raises if nothing exists at path.

Source
raw

Returns the raw underlying value, a Config::Type.

Source
size

Assumes the underlying value is an Array, Hash, or String and returns its size.

Raises if the underlying value is not an Array, Hash, or String.

Source
size?

Assumes the underlying value is an Array, Hash, or String and returns its size.

Raises if the underlying value is not an Array, Hash, or String.

Source

Nested types