Sha256: 40c9315e4792eead3d18b14e683854544ff751064b86e8b6f63ac4a885be97fd

Contents?: true

Size: 517 Bytes

Versions: 1

Compression:

Stored size: 517 Bytes

Contents

# encoding: UTF-8

module Rosette
  module Core

    # General-purpose string manipulation utilities.
    class StringUtils
      class << self
        # Converts a snake_cased string into a CamelCased one.
        #
        # @example
        #   StringUtils.camelize('foo_bar')  # => "FooBar"
        #
        # @param [String] str The snake_cased string to convert.
        # @return [String]
        def camelize(str)
          str.gsub(/(^\w|[-_]\w)/) { $1[-1].upcase }
        end
      end
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rosette-core-1.0.1 lib/rosette/core/string_utils.rb