Sha256: e8fab04676144fb6c9de50231294aa79e44751459e51b40726e9b0f99d642d13
Contents?: true
Size: 499 Bytes
Versions: 10
Compression:
Stored size: 499 Bytes
Contents
# frozen_string_literal: true module PagesCore module HumanizableParam include ActiveSupport::Inflector extend ActiveSupport::Concern def humanized_param(slug) return id.to_s unless slug&.present? "#{id}-" + transliterate(slug) .downcase .gsub(/[\[{]/, "(") .gsub(/}\]/, ")") .gsub(/[^[[:alnum:]]()-]+/, "-") .gsub(/-{2,}/, "-") .gsub(/(^-|-$)/, "") end end end
Version data entries
10 entries across 10 versions & 1 rubygems