diff --git a/src/axioms.jl b/src/axioms.jl index 66fca6f..29557c6 100644 --- a/src/axioms.jl +++ b/src/axioms.jl @@ -351,6 +351,32 @@ struct Constant{S<:String,D,V} value::V end +""" + Constant(constant::Dict{String, Any}) -> Constant + +Create a `Constant` object from a dictionary. + +# Arguments + + - `constant::Dict{String, Any}`: A dictionary containing the following keys: + + + `"description"`: Description of the constant. + + `"short_name"`: Short name of the constant. + + `"default"`: Default value of the constant. + +# Returns + + - `Constant`: An instance of the `Constant` struct with fields populated based on the provided dictionary. + +# Example + +```julia +constant_dict = Dict( + "description" => "Speed of light in vacuum", "short_name" => "c", "default" => 299792458 +) +constant = Constant(constant_dict) +``` +""" function Constant(constant::Dict{String,Any}) description = constant["description"] short_name = constant["short_name"]