module ApexCharts::Utils::Hash
Public Instance Methods
camelize(key)
click to toggle source
# File lib/apex_charts/utils/hash.rb, line 18 def camelize(key) key.to_s.gsub(/_(.)/) {|m| m[1].upcase }.to_sym end
camelize_keys(value)
click to toggle source
# File lib/apex_charts/utils/hash.rb, line 22 def camelize_keys(value) case value when ::Hash ::Hash[value.map {|k, v| [camelize(k), camelize_keys(v)] }] when Array value.map {|e| camelize_keys(e) } else value end end
deep_merge(first_hash, second_hash)
click to toggle source
# File lib/apex_charts/utils/hash.rb, line 8 def deep_merge(first_hash, second_hash) first_hash.merge(second_hash) do |_key, this_val, other_val| if this_val.is_a?(::Hash) && other_val.is_a?(::Hash) deep_merge(this_val.dup, other_val) else other_val end end end