Sha256: 7fbf57131e4c19196d43cc7e83ea6ac51cb1103e668c47fa5a2d5b44b827e3fd

Contents?: true

Size: 347 Bytes

Versions: 3

Compression:

Stored size: 347 Bytes

Contents

# frozen_string_literal: true

module CreditGateway
  class CamelizerLower
    # Converts this_is_my_string to thisIsMyString and returns it as a symbol.
    def self.transform(underscore_string)
      parts = underscore_string.to_s.split('_')

      rest = parts[1..].map(&:capitalize)

      rest.unshift(parts[0]).join.to_sym
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
credit_gateway-0.3.2 lib/credit_gateway/camelizer_lower.rb
credit_gateway-0.3.1 lib/credit_gateway/camelizer_lower.rb
credit_gateway-0.3.0 lib/credit_gateway/camelizer_lower.rb