Sha256: ee87d216972aab3ba9109199c749ebaa88fe54d1260064b5d13d2cfa4d410631

Contents?: true

Size: 353 Bytes

Versions: 174

Compression:

Stored size: 353 Bytes

Contents

module Tins
  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

require 'tins/alias'

Version data entries

174 entries across 156 versions & 9 rubygems

Version Path
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/tins-1.28.0/lib/tins/string_camelize.rb
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/tdiary-5.1.5/vendor/bundle/ruby/3.0.0/gems/tdiary-5.1.4/vendor/bundle/ruby/2.7.0/gems/tins-1.26.0/lib/tins/string_camelize.rb
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/tdiary-5.1.5/vendor/bundle/ruby/3.0.0/gems/tins-1.26.0/lib/tins/string_camelize.rb
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/tins-1.29.1/lib/tins/string_camelize.rb
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/tdiary-5.1.5/vendor/bundle/ruby/2.7.0/gems/tins-1.28.0/lib/tins/string_camelize.rb
tins-1.29.1 lib/tins/string_camelize.rb
tins-1.29.0 lib/tins/string_camelize.rb
tdiary-5.1.5 vendor/bundle/ruby/2.7.0/gems/tins-1.28.0/lib/tins/string_camelize.rb
tdiary-5.1.5 vendor/bundle/ruby/3.0.0/gems/tdiary-5.1.4/vendor/bundle/ruby/2.7.0/gems/tins-1.26.0/lib/tins/string_camelize.rb
tdiary-5.1.5 vendor/bundle/ruby/3.0.0/gems/tins-1.26.0/lib/tins/string_camelize.rb
tins-1.28.0 lib/tins/string_camelize.rb
tins-1.27.1 lib/tins/string_camelize.rb
tins-1.27.0 lib/tins/string_camelize.rb
tdiary-5.1.4 vendor/bundle/ruby/2.7.0/gems/tins-1.26.0/lib/tins/string_camelize.rb
tins-1.26.0 lib/tins/string_camelize.rb
tdiary-5.1.3 vendor/bundle/ruby/2.6.0/gems/tins-1.25.0/lib/tins/string_camelize.rb
tdiary-5.1.3 vendor/bundle/ruby/2.7.0/gems/tins-1.25.0/lib/tins/string_camelize.rb
tdiary-5.1.2 vendor/bundle/ruby/2.7.0/gems/tins-1.25.0/lib/tins/string_camelize.rb
tdiary-5.1.2 vendor/bundle/ruby/2.6.0/gems/tins-0.13.2/lib/tins/string_camelize.rb
tins-1.25.0 lib/tins/string_camelize.rb