Module: Rwsc::Utils::StringUtils
- Defined in:
- lib/rwsc/utils/string_utils.rb
Class Method Summary collapse
-
.underscore(word) ⇒ Object
The reverse of
camelize
.
Class Method Details
.underscore(word) ⇒ Object
The reverse of camelize
. Makes an underscored, lowercase .
7 8 9 10 |
# File 'lib/rwsc/utils/string_utils.rb', line 7 def self.underscore word return word unless word =~ /[A-Z]/ word.gsub(/([a-z\d]+)([A-Z]+)/, '\1_\2').downcase end |