Sha256: 35d20438a4ceeff37a31f2d5cb737c02b24b9d0149511292a54777b4f9383f49
Contents?: true
Size: 261 Bytes
Versions: 34
Compression:
Stored size: 261 Bytes
Contents
module TransformHashKeys def self.camelize_keys(hash) hash .filter { |_, v| v } .transform_keys { |k| camelize(k) } end def self.camelize(term) term.to_s.gsub(/(?:^|_+)([^_])/) { $1.upcase }.tap { |s| s[0] = s[0].downcase } end end
Version data entries
34 entries across 34 versions & 1 rubygems