diff options
author | icebaker <icebaker@proton.me> | 2024-01-10 20:05:48 -0300 |
---|---|---|
committer | icebaker <icebaker@proton.me> | 2024-01-10 20:05:48 -0300 |
commit | 3dc22548895718ffc7396227267ecbb4902b62f9 (patch) | |
tree | d19984eef953a2cd1e57c6fd51a73f2bcbb77541 /logic/helpers | |
parent | a36604d266cb019311cdf67110596a16986a0fff (diff) |
improving markdown parser
Diffstat (limited to 'logic/helpers')
-rw-r--r-- | logic/helpers/hash.rb | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/logic/helpers/hash.rb b/logic/helpers/hash.rb index 90432b5..4cb44ac 100644 --- a/logic/helpers/hash.rb +++ b/logic/helpers/hash.rb @@ -17,6 +17,19 @@ module NanoBot end end + def self.stringify_keys(object) + case object + when ::Hash + object.each_with_object({}) do |(key, value), result| + result[key.to_s] = stringify_keys(value) + end + when Array + object.map { |e| stringify_keys(e) } + else + object + end + end + def self.fetch(object, path) node = object |