Class: String

Inherits:
Object
  • Object
show all
Defined in:
lib/sunrise/core_ext/string.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.randomize(length = 8) ⇒ Object



11
12
13
# File 'lib/sunrise/core_ext/string.rb', line 11

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

Instance Method Details

#parameterize(sep = '-') ⇒ Object



6
7
8
9
# File 'lib/sunrise/core_ext/string.rb', line 6

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