Class: String
- Inherits:
-
Object
- Object
- String
- Defined in:
- lib/lotr/response.rb
Overview
underscore! method is not available outside of Rails, had to write a simple implementation
Instance Method Summary collapse
-
#underscore! ⇒ Object
ruby mutation methods have the expectation to return self if a mutation occurred, nil otherwise.
Instance Method Details
#underscore! ⇒ Object
ruby mutation methods have the expectation to return self if a mutation occurred, nil otherwise. (see www.ruby-doc.org/core-1.9.3/String.html#method-i-gsub-21)
24 25 26 27 |
# File 'lib/lotr/response.rb', line 24 def underscore! gsub!(/(.)([A-Z])/, '\1_\2') downcase! end |