Skip to content
This repository was archived by the owner on Dec 28, 2019. It is now read-only.

Hash transformations

Aleksander Smywiński-Pohl edited this page Mar 16, 2018 · 2 revisions

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

Clone this wiki locally