Sha256: 08a7e5bdfd2bca2c62b0f98fe549b9e3beb942925af7734a4095ef29354a8dc3

Contents?: true

Size: 336 Bytes

Versions: 2

Compression:

Stored size: 336 Bytes

Contents

module Spruz
  module StringCamelize
    def camelize(first_letter = :upper)
      case first_letter
      when :upper, true
        gsub(/\/(.?)/) { "::#{$1.upcase}" }.gsub(/(?:^|_)(.)/) { $1.upcase }
      when :lower, false
        self[0].chr.downcase + camelize[1..-1]
      end
    end
    
    alias camelcase camelize
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
spruz-0.2.11 lib/spruz/string_camelize.rb
spruz-0.2.10 lib/spruz/string_camelize.rb