Adds Camelize Keys Method to Definitions

This commit is contained in:
Muhammad Nawzad
2023-11-12 14:48:46 +03:00
parent 92d9f33d20
commit e25dfff4ec
2 changed files with 14 additions and 0 deletions

View File

@@ -247,5 +247,15 @@ module Schemable
# 'users' for the User model
# 'citizen_applications' for the CitizenApplication model
def model_name: -> String
# Given a hash, it returns a new hash with all the keys camelized.
#
# @param hash [Array | Hash] The hash with all the keys camelized.
#
# @return [Array | Hash] The hash with all the keys camelized.
#
# @example
# { first_name: 'John', last_name: 'Doe' } => { firstName: 'John', lastName: 'Doe' }
def camelize_keys: (Hash[Symbol, any]) -> (Hash[Symbol, any] | Array[Hash[Symbol, any]])
end
end