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



9
10
11
# File 'lib/sunrise/core_ext/string.rb', line 9

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

Instance Method Details

#parameterize(sep = '-') ⇒ Object



4
5
6
7
# File 'lib/sunrise/core_ext/string.rb', line 4

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