Class: String
Instance Method Summary collapse
Instance Method Details
#camelize ⇒ Object
24 25 26 |
# File 'lib/nali/extensions.rb', line 24 def camelize self.split( '_' ).collect( &:capitalize ).join end |
#underscore ⇒ Object
20 21 22 |
# File 'lib/nali/extensions.rb', line 20 def underscore dup.tap { |s| s.underscore! } end |
#underscore! ⇒ Object
15 16 17 18 |
# File 'lib/nali/extensions.rb', line 15 def underscore! gsub!( /(.)([A-Z])/, '\1_\2' ) downcase! end |