From d1f2237db943103da2de43f9af33b9d442d97b64 Mon Sep 17 00:00:00 2001 From: Fredrik Bagge Carlson Date: Mon, 12 Apr 2021 16:15:03 +0200 Subject: [PATCH] [RFC] allow conversion of ConfParse to a Dict This PR adds the ability to request a `Dict(s::ConfParse)` which just retrieves the internally stored dict. `Dict(s::ConfParse)` and `convert` are the two methods I guess most users would try if they want to get a Dict back. --- src/ConfParser.jl | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/ConfParser.jl b/src/ConfParser.jl index 3082ced..51e61e7 100644 --- a/src/ConfParser.jl +++ b/src/ConfParser.jl @@ -417,4 +417,7 @@ Check if a key exists inside an ini file block. """ haskey(s::ConfParse, block::String, key::String) = haskey(s._data, lowercase(block)) && haskey(s._data[lowercase(block)], key) +Base.Dict(s::ConfParse) = s._data +Base.convert(::Type{Dict}, s::ConfParse) = s._data + end # module ConfParser