Log::Metadata::Value
Constructors
Creates Log::Metadata from the given values.
All keys are converted to String
Instance methods
Assumes the underlying value is an Array or Hash
and returns the element at the given index_or_key.
Raises if the underlying value is not an Array nor a Hash.
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.
Raises if the underlying value is not an Array nor a Hash.
Checks that the underlying value is Array(self), and returns its value.
Raises otherwise.
Checks that the underlying value is Array(self), and returns its value.
Returns nil otherwise.
Checks that the underlying value is Bool, and returns its value.
Raises otherwise.
Checks that the underlying value is Bool, and returns its value.
Returns nil otherwise.
Checks that the underlying value is Float32, and returns its value.
Raises otherwise.
Checks that the underlying value is Float64, and returns its value.
Raises otherwise.
Checks that the underlying value is Float64, and returns its value.
Returns nil otherwise.
Checks that the underlying value is Float32, and returns its value.
Returns nil otherwise.
Checks that the underlying value is Hash(String, self), and returns its value.
Raises otherwise.
Checks that the underlying value is Hash(String, self), and returns its value.
Returns nil otherwise.
Checks that the underlying value is Int32, and returns its value.
Raises otherwise.
Checks that the underlying value is Int64, and returns its value.
Raises otherwise.
Checks that the underlying value is Int64, and returns its value.
Returns nil otherwise.
Checks that the underlying value is Int32, and returns its value.
Returns nil otherwise.
Checks that the underlying value is Nil, and returns its value.
Raises otherwise.
Checks that the underlying value is String, and returns its value.
Raises otherwise.
Checks that the underlying value is String, and returns its value.
Returns nil otherwise.
Checks that the underlying value is Time, and returns its value.
Raises otherwise.
Checks that the underlying value is Time, and returns its value.
Returns nil otherwise.
Checks that the underlying value is UInt32, and returns its value.
Raises otherwise.
Checks that the underlying value is UInt64, and returns its value.
Raises otherwise.
Checks that the underlying value is UInt64, and returns its value.
Returns nil otherwise.
Checks that the underlying value is UInt32, and returns its value.
Returns nil otherwise.
Traverses the depth of a structure and returns the value, otherwise raises.
Traverses the depth of a structure and returns the value.
Returns nil if not found.
See Object#hash(hasher)
Appends this struct's name and instance variables names and values to the given IO.
struct Point
def initialize(@x : Int32, @y : Int32)
end
end
p1 = Point.new 1, 2
p1.to_s # "Point(@x=1, @y=2)"
p1.inspect # "Point(@x=1, @y=2)"
Returns the raw underlying value, a Type.
Assumes the underlying value is an Array or Hash and returns its size.
Raises if the underlying value is not an Array or Hash.
Returns Log::Metadata::Value as JSON value.
NOTE: require "log/json" is required to opt-in to this feature.