Sha256: 4e75eb6cb7436f574537176a4e7b020e4ee8527f9b2f332cd9a3bc021aa37e94

Contents?: true

Size: 360 Bytes

Versions: 6

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

  # simple transformation to CamelCase from snake_case
  #
  #   'foo_bar'.camel_case # => 'FooBar'

  def camel_case
    split('_').map{|e| e.capitalize}.join
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
ramaze-0.1.1 lib/ramaze/snippets/string/camel_case.rb
ramaze-0.1.3 lib/ramaze/snippets/string/camel_case.rb
ramaze-0.1.2 lib/ramaze/snippets/string/camel_case.rb
ramaze-0.1.4 lib/ramaze/snippets/string/camel_case.rb
ramaze-0.2.0 lib/ramaze/snippets/string/camel_case.rb
ramaze-0.2.1 lib/ramaze/snippets/string/camel_case.rb