Sha256: e1fc9b848619106d2f46ca67c451a14ec0a68d3f28d3abc19a60064ceefba8bb
Contents?: true
Size: 331 Bytes
Versions: 84
Compression:
Stored size: 331 Bytes
Contents
# frozen_string_literal: true module Utils def symbolize_keys(hash) hash.transform_keys(&:to_sym) end def camel_case_to_slug(str) str.split("").map.with_index { |ch, idx| is_upper?(ch) && !is_upper?(str[idx - 1]) ? "-#{ch.downcase}" : ch.downcase }.join end def is_upper?(str) str == str.upcase end end
Version data entries
84 entries across 84 versions & 2 rubygems