struct Config::Any
- Config::Any
- Struct
- Value
- Object
Included Modules
- Enumerable(Config::Any)
Defined in:
config/any.crConstructors
-
.new(raw : Config::Type)
Creates a
Config::Any
that wraps the givenConfig::Type
.
Instance Method Summary
-
#==(other : Config::Any)
Returns
true
if bothself
and other's raw object are equal. -
#==(other)
Returns
true
if the raw object is equal to other. -
#[](index : Int::Primitive) : Any
Assumes the underlying value is an
Array
and returns the element at the given index. -
#[](key : String) : Any
Assumes the underlying value is a
Hash
and returns the element with the given key. -
#[]?(index : Int::Primitive) : Any | Nil
Assumes the underlying value is an
Array
and returns the element at the given index, ornil
if out of bounds. -
#[]?(key : String) : Any | Nil
Assumes the underlying value is a
Hash
and returns the element with the given key, ornil
if the key is not present. -
#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 typeU
. -
#as_a : Array(Any)
Returns the underlying value as an
Array(Any)
if it can. -
#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)
. -
#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
. -
#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 typeU
. -
#as_a? : Array(Any) | Nil
Returns the underlying value as an
Array(Any)
if it can. -
#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)
. -
#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
. -
#as_bool : Bool
Returns the underlying value as an
Bool
if it can. -
#as_bool(*path : KeyTypes) : Bool
Assumes the underlying value is indexable and returns the element with the given key as a
Bool
. -
#as_bool? : Bool | Nil
Returns the underlying value as an
Bool
if it can. -
#as_bool?(*path : KeyTypes) : Bool | Nil
Assumes the underlying value is indexable and returns the element with the given key as a
Bool
. -
#as_f : Float64
Returns the underlying value as an
Float64
if it can. -
#as_f(*path : KeyTypes) : Float64
Assumes the underlying value is indexable and returns the element with the given key as a
Float64
. -
#as_f32 : Float32
Returns the underlying value as an
Float32
if it can. -
#as_f32(*path : KeyTypes) : Float32
Assumes the underlying value is indexable and returns the element with the given key as a
Float32
. -
#as_f32? : Float32 | Nil
Returns the underlying value as an
Float32
if it can. -
#as_f32?(*path : KeyTypes) : Float32 | Nil
Assumes the underlying value is indexable and returns the element with the given key as a
Float32
. -
#as_f? : Float64 | Nil
Returns the underlying value as an
Float64
if it can. -
#as_f?(*path : KeyTypes) : Float64 | Nil
Assumes the underlying value is indexable and returns the element with the given key as a
Float64
. -
#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 typeU
. -
#as_h : Hash(String, Any)
Returns the underlying value as an
Hash(String, Any)
if it can. -
#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)
. -
#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
. -
#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 typeU
. -
#as_h? : Hash(String, Any) | Nil
Returns the underlying value as an
Hash(String, Any)
if it can. -
#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)
. -
#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
. -
#as_i : Int32
Returns the underlying value as an
Int32
if it can. -
#as_i(*path : KeyTypes) : Int32
Assumes the underlying value is indexable and returns the element with the given key as a
Int32
. -
#as_i128 : Int128
Returns the underlying value as an
Int128
if it can. -
#as_i128(*path : KeyTypes) : Int128
Assumes the underlying value is indexable and returns the element with the given key as a
Int128
. -
#as_i128? : Int128 | Nil
Returns the underlying value as an
Int128
if it can. -
#as_i128?(*path : KeyTypes) : Int128 | Nil
Assumes the underlying value is indexable and returns the element with the given key as a
Int128
. -
#as_i64 : Int64
Returns the underlying value as an
Int64
if it can. -
#as_i64(*path : KeyTypes) : Int64
Assumes the underlying value is indexable and returns the element with the given key as a
Int64
. -
#as_i64? : Int64 | Nil
Returns the underlying value as an
Int64
if it can. -
#as_i64?(*path : KeyTypes) : Int64 | Nil
Assumes the underlying value is indexable and returns the element with the given key as a
Int64
. -
#as_i? : Int32 | Nil
Returns the underlying value as an
Int32
if it can. -
#as_i?(*path : KeyTypes) : Int32 | Nil
Assumes the underlying value is indexable and returns the element with the given key as a
Int32
. -
#as_s : String
Returns the underlying value as an
String
if it can. -
#as_s(*path : KeyTypes) : String
Assumes the underlying value is indexable and returns the element with the given key as a
String
. -
#as_s? : String | Nil
Returns the underlying value as an
String
if it can. -
#as_s?(*path : KeyTypes) : String | Nil
Assumes the underlying value is indexable and returns the element with the given key as a
String
. -
#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.
-
#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 isnil
. -
#each(&block : Any -> _)
Assumes the underlying value is an
Array
orHash
and yields each of the elements or key/values, always asConfig::Any
. -
#hash(hasher)
See
Object#hash(hasher)
-
#is_nil? : Bool
Returns a
Bool
indicating if the value at the key isnil
. -
#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 isNil
. -
#raw : Config::Type
Returns the raw underlying value, a
Config::Type
. -
#size : Int
Assumes the underlying value is an
Array
,Hash
, orString
and returns its size. -
#size? : Int32 | Nil
Assumes the underlying value is an
Array
,Hash
, orString
and returns its size.
Instance methods inherited from class Object
===(other : Config::Any)
===
Constructor Detail
Instance Method Detail
Assumes the underlying value is an Array
and returns the element at the
given index.
Raises if the underlying value is not an Array
.
Assumes the underlying value is a Hash
and returns the element with the
given key.
Raises if the underlying value is not a Hash
.
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
.
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
.
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
.
Returns the underlying value as an Array(Any)
if it can.
Raises otherwise.
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.
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
.
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.
Returns the underlying value as an Array(Any)
if it can.
Returns nil
otherwise.
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.
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.
Assumes the underlying value is indexable and returns the element with the
given key as a Bool
.
Raises otherwise.
Returns the underlying value as an Bool
if it can.
Returns nil
otherwise.
Assumes the underlying value is indexable and returns the element with the
given key as a Bool
.
Returns nil
otherwise.
Assumes the underlying value is indexable and returns the element with the
given key as a Float64
.
Raises otherwise.
Assumes the underlying value is indexable and returns the element with the
given key as a Float32
.
Raises otherwise.
Returns the underlying value as an Float32
if it can.
Returns nil
otherwise.
Assumes the underlying value is indexable and returns the element with the
given key as a Float32
.
Returns nil
otherwise.
Returns the underlying value as an Float64
if it can.
Returns nil
otherwise.
Assumes the underlying value is indexable and returns the element with the
given key as a Float64
.
Returns nil
otherwise.
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
.
Returns the underlying value as an Hash(String, Any)
if it can.
Raises otherwise.
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.
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
.
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.
Returns the underlying value as an Hash(String, Any)
if it can.
Returns nil
otherwise.
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.
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.
Assumes the underlying value is indexable and returns the element with the
given key as a Int32
.
Raises otherwise.
Assumes the underlying value is indexable and returns the element with the
given key as a Int128
.
Raises otherwise.
Returns the underlying value as an Int128
if it can.
Returns nil
otherwise.
Assumes the underlying value is indexable and returns the element with the
given key as a Int128
.
Returns nil
otherwise.
Assumes the underlying value is indexable and returns the element with the
given key as a Int64
.
Raises otherwise.
Returns the underlying value as an Int64
if it can.
Returns nil
otherwise.
Assumes the underlying value is indexable and returns the element with the
given key as a Int64
.
Returns nil
otherwise.
Returns the underlying value as an Int32
if it can.
Returns nil
otherwise.
Assumes the underlying value is indexable and returns the element with the
given key as a Int32
.
Returns nil
otherwise.
Assumes the underlying value is indexable and returns the element with the
given key as a String
.
Raises otherwise.
Returns the underlying value as an String
if it can.
Returns nil
otherwise.
Assumes the underlying value is indexable and returns the element with the
given key as a String
.
Returns nil
otherwise.
Extracts the nested value specified by the sequence of path keys by calling dig at each step, raising if any intermediate step fails.
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
.
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
.
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.
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
.
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
.