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

Version Path
sapience-2.4.0 lib/sapience/core_ext/symbol.rb
sapience-2.3.5 lib/sapience/core_ext/symbol.rb
sapience-2.3.4 lib/sapience/core_ext/symbol.rb
sapience-2.3.3 lib/sapience/core_ext/symbol.rb
sapience-2.2.3 lib/sapience/core_ext/symbol.rb
sapience-2.2.1 lib/sapience/core_ext/symbol.rb
sapience-2.2.0 lib/sapience/core_ext/symbol.rb
sapience-2.1.0 lib/sapience/core_ext/symbol.rb
sapience-2.0.5 lib/sapience/core_ext/symbol.rb
sapience-2.0.4 lib/sapience/core_ext/symbol.rb
sapience-2.0.3 lib/sapience/core_ext/symbol.rb
sapience-2.0.2 lib/sapience/core_ext/symbol.rb
sapience-2.0.1 lib/sapience/core_ext/symbol.rb
sapience-2.0.0 lib/sapience/core_ext/symbol.rb
sapience-1.0.15 lib/sapience/core_ext/symbol.rb
sapience-1.0.14 lib/sapience/core_ext/symbol.rb
sapience-1.0.13 lib/sapience/core_ext/symbol.rb
sapience-1.0.12 lib/sapience/core_ext/symbol.rb
sapience-1.0.11 lib/sapience/core_ext/symbol.rb
sapience-1.0.10 lib/sapience/core_ext/symbol.rb