Class: String

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

Instance Method Summary collapse

Instance Method Details

#underscoreObject

Underscore text (downcase and replace now-char to ‘-’)

Example:
"some_text".underscore # => "some-text"
"R7.com".underscore # => "r7-com"


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

def underscore
  self.strip.downcase.gsub(/\W/, '-')
end