Sha256: e89cfb07624fb3d41d36011d5920b76706b5b1afe5386e3b7e4f11954ff76e1f
Contents?: true
Size: 479 Bytes
Versions: 44
Compression:
Stored size: 479 Bytes
Contents
class Symbol def camelize(uppercase_first_letter = true) string = to_s string = if uppercase_first_letter string.sub(/^[a-z\d]*/) { $&.capitalize } else string.sub(/^(?:(?=\b|[A-Z_])|\w)/) { $&.downcase } end string.gsub!(/(?:_|(\/))([a-z\d]*)/i) do "#{Regexp.last_match(1)}#{Regexp.last_match(2).capitalize}" end string.gsub!(/\//, "::") string end unless :sym.respond_to?(:camelize) end
Version data entries
44 entries across 44 versions & 1 rubygems