Class: String

Inherits:
Object
  • Object
show all
Defined in:
lib/extentions/string.rb

Instance Method Summary collapse

Instance Method Details

#to_underscoreObject



7
8
9
# File 'lib/extentions/string.rb', line 7

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

#to_underscore!Object



2
3
4
5
# File 'lib/extentions/string.rb', line 2

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