Sha256: 528d4ebff9bd20237e55428ee553f20d968e72774e78390f31ddbea42f7e14f6

Contents?: true

Size: 335 Bytes

Versions: 5

Compression:

Stored size: 335 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.

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

5 entries across 5 versions & 1 rubygems

Version Path
ramaze-0.0.7 lib/ramaze/snippets/string/camel_case.rb
ramaze-0.0.8 lib/ramaze/snippets/string/camel_case.rb
ramaze-0.0.9 lib/ramaze/snippets/string/camel_case.rb
ramaze-0.0.6 lib/ramaze/snippets/string/camel_case.rb
ramaze-0.1.0 lib/ramaze/snippets/string/camel_case.rb