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::Anythat wraps the givenConfig::Type.
Instance Method Summary
-
#==(other)
Returns
trueif the raw object is equal to other. -
#==(other : Config::Any)
Returns
trueif bothselfand other's raw object are equal. -
#[](index : Int::Primitive) : Any
Assumes the underlying value is an
Arrayand returns the element at the given index. -
#[](key : String) : Any
Assumes the underlying value is a
Hashand returns the element with the given key. -
#[]?(index : Int::Primitive) : Any?
Assumes the underlying value is an
Arrayand returns the element at the given index, ornilif out of bounds. -
#[]?(key : String) : Any?
Assumes the underlying value is a
Hashand returns the element with the given key, ornilif the key is not present. -
#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 : Array(Any)
Returns the underlying value as an
Array(Any)if it can. -
#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
Arrayof 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? = 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_a?(*path : KeyTypes, each_as : U.class, skip : Bool = true) : Array(U)? forall U
Assumes the underlying value is indexable and returns the specified element at the given key path as an
Arrayof typeU. -
#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
Returns the underlying value as an
Boolif 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?
Returns the underlying value as an
Boolif it can. -
#as_f : Float64
Returns the underlying value as an
Float64if 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(*path : KeyTypes) : Float32
Assumes the underlying value is indexable and returns the element with the given key as a
Float32. -
#as_f32 : Float32
Returns the underlying value as an
Float32if 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?
Returns the underlying value as an
Float32if it can. -
#as_f? : Float64?
Returns the underlying value as an
Float64if 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_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
Hashof 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? : 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? = 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_h?(*path : KeyTypes, each_as : U.class, skip : Bool = true) : Hash(String, U)? forall U
Assumes the underlying value is indexable and returns the specified element at the given key path as a
Hashof typeU. -
#as_i(*path : KeyTypes) : Int32
Assumes the underlying value is indexable and returns the element with the given key as a
Int32. -
#as_i : Int32
Returns the underlying value as an
Int32if it can. -
#as_i128 : Int128
Returns the underlying value as an
Int128if 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?(*path : KeyTypes) : Int128?
Assumes the underlying value is indexable and returns the element with the given key as a
Int128. -
#as_i128? : Int128?
Returns the underlying value as an
Int128if 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
Returns the underlying value as an
Int64if it can. -
#as_i64? : Int64?
Returns the underlying value as an
Int64if 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_i?(*path : KeyTypes) : Int32?
Assumes the underlying value is indexable and returns the element with the given key as a
Int32. -
#as_i? : Int32?
Returns the underlying value as an
Int32if 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
Returns the underlying value as an
Stringif 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?
Returns the underlying value as an
Stringif it can. -
#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?
Extracts the nested value specified by the sequence of path keys by calling dig at each step, returning
nilif any intermediate step isnil. -
#each(&block : Any -> _)
Assumes the underlying value is an
ArrayorHashand yields each of the elements or key/values, always asConfig::Any. -
#hash(hasher)
See
Object#hash(hasher) -
#is_nil?(*path : KeyTypes) : Bool
Assumes the underlying value is indexable and returns a
Boolthat indicates if the element at the given paths underlying value isNil. -
#is_nil? : Bool
Returns a
Boolindicating if the value at the key isnil. -
#raw : Config::Type
Returns the raw underlying value, a
Config::Type. -
#size : Int
Assumes the underlying value is an
Array,Hash, orStringand returns its size. -
#size? : Int32?
Assumes the underlying value is an
Array,Hash, orStringand 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(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.
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 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.
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 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.
Assumes the underlying value is indexable and returns the element with the
given key as a Bool.
Raises 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.
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 Float32 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.
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 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.
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.
Assumes the underlying value is indexable and returns the element with the
given key as a Int128.
Returns nil 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 Int64.
Raises otherwise.
Assumes the underlying value is indexable and returns the element with the
given key as a Int64.
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.
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.