Sha256: 230c1fa9f9dabd55973b22e08905b04ec09f905a9c2edccb23f60d97ce298781
Contents?: true
Size: 360 Bytes
Versions: 8
Compression:
Stored size: 360 Bytes
Contents
# Copyright (c) 2008 Michael Fellinger m.fellinger@gmail.com # All files in this distribution are subject to the terms of the Ruby license. # Extensions for String class String # convert to snake_case from CamelCase # # 'FooBar'.snake_case # => 'foo_bar' def snake_case gsub(/\B[A-Z][^A-Z]/, '_\&').downcase.gsub(' ', '_') end end
Version data entries
8 entries across 8 versions & 3 rubygems