Hash transformations - solnic/transproc GitHub Wiki

Pascalize keys

Assumes pascalize is defined.

  # Convert keys in a given +hash+ by using the +pascalaize+ conversion.
  #
  # E.g.
  #   t(:pascalaize_keys).(messages_count: 1, conversations_count: 2)
  # result
  #   { messagesCount: 1, conversationsCount: 2 }
  def self.pascalaize_keys(hash)
    (t(:map_keys, t(:pascalaize)).>> t(:symbolize_keys)).call(hash)
  end