Class: String
- Inherits:
-
Object
- Object
- String
- Defined in:
- lib/lathe/string.rb
Instance Method Summary collapse
Instance Method Details
#camelize ⇒ Object
2 3 4 |
# File 'lib/lathe/string.rb', line 2 def camelize dup.camelize! end |
#camelize! ⇒ Object
5 6 7 |
# File 'lib/lathe/string.rb', line 5 def camelize! self.replace(self.split("_").each {|s| s.capitalize! }.join("")) end |
#underscore ⇒ Object
8 9 10 |
# File 'lib/lathe/string.rb', line 8 def underscore dup.underscore! end |
#underscore! ⇒ Object
11 12 13 |
# File 'lib/lathe/string.rb', line 11 def underscore! self.replace(self.scan(/[A-Z][a-z]*/).join("_").downcase) end |