Sha256: 656d1b23f113dd86c0d6ce0e4c3e36781e89cf150b83f27b74f68925e84fae82

Contents?: true

Size: 337 Bytes

Versions: 5

Compression:

Stored size: 337 Bytes

Contents

module SmartIoC
  class StringUtils
    class << self
      def camelize(term)
        string = term.to_s
        string = string.sub(/^[a-z\d]*/) { |match| match.capitalize }
        string.gsub!(/(?:_|(\/))([a-z\d]*)/) { "#{$1}#{$2.capitalize}" }
        string.gsub!("/".freeze, "::".freeze)
        string
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
smart_ioc-0.5.2 lib/smart_ioc/string_utils.rb
smart_ioc-0.5.1 lib/smart_ioc/string_utils.rb
smart_ioc-0.5.0 lib/smart_ioc/string_utils.rb
smart_ioc-0.3.9 lib/smart_ioc/string_utils.rb
smart_ioc-0.3.8 lib/smart_ioc/string_utils.rb