Method: String#dasherize

Defined in:
lib/comet-html/utils.rb

#dasherizeObject



7
8
9
10
11
12
# File 'lib/comet-html/utils.rb', line 7

def dasherize
  tmp = self.gsub(/([A-Z]+)/, '_\1')
  parts = tmp.split(/_+|-+|\W+/)
  parts.select! {|item| item != ""}
  (parts.map do |part| part.downcase end).join '-'
end