module ActiveSerialize::KeyFormatter

Public Class Methods

call(config, hash) click to toggle source
# File lib/active_serialize/key_formatter.rb, line 5
def self.call(config, hash)
  return hash unless config.present?
  hash.deep_transform_keys! do |k, _|
    case config.to_sym
    when :underscore; k.underscore
    when :camelize; k.camelize
    when :camelize_lower; k.camelize(:lower)
    else k
    end
  end
end