Sha256: 8bd171ba8228807c0378c5361a0d65cd6003013680c8fe7aec390c470b996a32

Contents?: true

Size: 347 Bytes

Versions: 2

Compression:

Stored size: 347 Bytes

Contents

# frozen_string_literal: true

require 'active_support/inflector/inflections'

class String
  def parameterize(sep = '-')
    value = Sunrise::Utils::Transliteration.transliterate(self)
    ActiveSupport::Inflector.parameterize(value, sep)
  end

  def self.randomize(length = 8)
    Array.new(length) { (rand(122 - 97) + 97).chr }.join
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
sunrise-cms-1.1.1 lib/sunrise/core_ext/string.rb
sunrise-cms-1.1.0 lib/sunrise/core_ext/string.rb