Module: LightGptProxy::Helpers::HashDeepStringifyHelper
- Defined in:
- lib/light_gpt_proxy/helpers/hash_deep_stringify_helper.rb
Class Method Summary collapse
Class Method Details
.perform(hash) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/light_gpt_proxy/helpers/hash_deep_stringify_helper.rb', line 6 def self.perform(hash) result = {} hash.each do |key, value| new_key = key.to_s new_value = case value when Hash perform(value) when Array value.map { |element| element.is_a?(Hash) ? perform(element) : element } else value end result[new_key] = new_value end result end |