Sha256: 630b1a516a879d3d01ed5724e670064395e44e4ba8a5820f06d1f388b85fe783
Contents?: true
Size: 360 Bytes
Versions: 2
Compression:
Stored size: 360 Bytes
Contents
# Copyright (c) 2006 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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
ramaze-0.2.0 | lib/ramaze/snippets/string/snake_case.rb |
ramaze-0.2.1 | lib/ramaze/snippets/string/snake_case.rb |