Sha256: 8564c2afaed310145886a6cd9dfddec34a25a70aea9899d19e439664b3bfc6fd

Contents?: true

Size: 332 Bytes

Versions: 2

Compression:

Stored size: 332 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.13 lib/spruz/string_camelize.rb
spruz-0.2.12 lib/spruz/string_camelize.rb