struct Log::Metadata::Value
inherits Struct
¶
Class methods¶
.new(hash : NamedTuple | Hash)
¶
(hash : NamedTuple | Hash)
Creates Log::Metadata from the given values.
All keys are converted to String
Methods¶
#[](index_or_key) : self
¶
View source
(index_or_key) : self
#[]?(index_or_key) : self?
¶
(index_or_key) : self?
Assumes the underlying value is an Array or Hash and returns the element
at the given index_or_key, or nil if out of bounds or the key is missing.
#as_a : Array(self)
¶
: Array(self)
Checks that the underlying value is Array(self), and returns its value.
Raises otherwise.
#as_a? : Array(self)?
¶
: Array(self)?
Checks that the underlying value is Array(self), and returns its value.
Returns nil otherwise.
#as_bool : Bool
¶
: Bool
Checks that the underlying value is Bool, and returns its value.
Raises otherwise.
#as_bool? : Bool?
¶
: Bool?
Checks that the underlying value is Bool, and returns its value.
Returns nil otherwise.
#as_f : Float32
¶
: Float32
Checks that the underlying value is Float32, and returns its value.
Raises otherwise.
#as_f64 : Float64
¶
: Float64
Checks that the underlying value is Float64, and returns its value.
Raises otherwise.
#as_f64? : Float64?
¶
: Float64?
Checks that the underlying value is Float64, and returns its value.
Returns nil otherwise.
#as_f? : Float32?
¶
: Float32?
Checks that the underlying value is Float32, and returns its value.
Returns nil otherwise.
#as_h : Hash(String, self)
¶
: Hash(String, self)
Checks that the underlying value is Hash(String, self), and returns its value.
Raises otherwise.
#as_h? : Hash(String, self)?
¶
: Hash(String, self)?
Checks that the underlying value is Hash(String, self), and returns its value.
Returns nil otherwise.
#as_i64 : Int64
¶
: Int64
Checks that the underlying value is Int64, and returns its value.
Raises otherwise.
#as_i64? : Int64?
¶
: Int64?
Checks that the underlying value is Int64, and returns its value.
Returns nil otherwise.
#as_i? : Int32?
¶
: Int32?
Checks that the underlying value is Int32, and returns its value.
Returns nil otherwise.
#as_s : String
¶
: String
Checks that the underlying value is String, and returns its value.
Raises otherwise.
#as_s? : String?
¶
: String?
Checks that the underlying value is String, and returns its value.
Returns nil otherwise.
#as_time : Time
¶
: Time
Checks that the underlying value is Time, and returns its value.
Raises otherwise.
#as_time? : Time?
¶
: Time?
Checks that the underlying value is Time, and returns its value.
Returns nil otherwise.
#dig(index_or_key, *subkeys) : self
¶
(index_or_key, *subkeys) : self
Traverses the depth of a structure and returns the value, otherwise raises.
#dig?(index_or_key, *subkeys) : self?
¶
(index_or_key, *subkeys) : self?
Traverses the depth of a structure and returns the value.
Returns nil if not found.
#hash(hasher)
¶
(hasher)