Module: HashExt

Defined in:
lib/actiondoc/generator.rb

Overview

Monkey patch Hash

Instance Method Summary collapse

Instance Method Details

#deep_symbolize_keysObject



120
121
122
123
124
125
126
127
128
129
130
131
# File 'lib/actiondoc/generator.rb', line 120

def deep_symbolize_keys
  transform_keys(&:to_sym).transform_values do |v|
    case v
    when Hash
      v.deep_symbolize_keys
    when Array
      v.map { |e| e.is_a?(Hash) ? e.deep_symbolize_keys : e }
    else
      v
    end
  end
end