Class: String

Inherits:
Object show all
Defined in:
lib/nali/extensions.rb

Instance Method Summary collapse

Instance Method Details

#camelizeObject



24
25
26
# File 'lib/nali/extensions.rb', line 24

def camelize
  self.split( '_' ).collect( &:capitalize ).join
end

#underscoreObject



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