Sha256: 3052ee883eda58baf860a5e7daca2e7f584308192affde9866b6c2c28146e592
Contents?: true
Size: 915 Bytes
Versions: 4
Compression:
Stored size: 915 Bytes
Contents
# frozen_string_literal: true module BingAdsRubySdk module Preprocessors class Camelize def initialize(params) @params = params end def call process(@params) end private # NOTE: there is a potential for high memory usage here as we're using recursive method calling def process(obj) return obj unless obj.is_a?(Hash) obj.each_with_object({}) do |(k, v), h| case v when Hash then v = process(v) when Array then v = v.map { |elt| process(elt) } end h[transform_key(k.to_s)] = v end end def transform_key(key) if BLACKLIST.include?(key) key else camelize(key) end end def camelize(string) BingAdsRubySdk::StringUtils.camelize(string) end BLACKLIST = %w[long string] end end end
Version data entries
4 entries across 4 versions & 1 rubygems