Sha256: aa52187fe9820aba1e6cc791904aed58906f288d8a0421be0c2911e83cd52244

Contents?: true

Size: 437 Bytes

Versions: 9

Compression:

Stored size: 437 Bytes

Contents

# Rgentpl
module Rgentpl
  # Core Extensions
  module CoreExt
    String.class_eval do
      # Camelize
      #
      # @return [String] the camelized string
      def camelize
        split(/\s|-|_/).each { |s| s.capitalize! }.join('')
      end

      # Camelize!
      #
      # @return [String] the camelized string
      def camelize!
        replace(split(/\s|-|_/).each { |s| s.capitalize! }.join(''))
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
rgentpl-1.0.9 lib/rgentpl/core_ext/string.rb
rgentpl-1.0.8 lib/rgentpl/core_ext/string.rb
rgentpl-1.0.7 lib/rgentpl/core_ext/string.rb
rgentpl-1.0.6 lib/rgentpl/core_ext/string.rb
rgentpl-1.0.5 lib/rgentpl/core_ext/string.rb
rgentpl-1.0.4 lib/rgentpl/core_ext/string.rb
rgentpl-1.0.3 lib/rgentpl/core_ext/string.rb
rgentpl-1.0.2 lib/rgentpl/core_ext/string.rb
rgentpl-1.0.1 lib/rgentpl/core_ext/string.rb