Class: String

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

Instance Method Summary collapse

Instance Method Details

#camelizeObject



25
26
27
# File 'lib/apiway/extensions.rb', line 25

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

#underscoreObject



21
22
23
# File 'lib/apiway/extensions.rb', line 21

def underscore
  dup.tap { |s| s.underscore! }
end

#underscore!Object



16
17
18
19
# File 'lib/apiway/extensions.rb', line 16

def underscore!
  gsub!( /(.)([A-Z])/, '\1_\2' )
  downcase!
end