Sha256: b2b2124b4d0daf349409bc36f59b0c6abb655d9a4957a722f2af77bdde03fcd5

Contents?: true

Size: 346 Bytes

Versions: 7

Compression:

Stored size: 346 Bytes

Contents

# frozen_string_literal: true

module FractalApi
  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..-1].map(&:capitalize)

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

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
fractal_api-0.1.6 lib/fractal_api/camelizer_lower.rb
fractal_api-0.1.5 lib/fractal_api/camelizer_lower.rb
fractal_api-0.1.4 lib/fractal_api/camelizer_lower.rb
fractal_api-0.1.3 lib/fractal_api/camelizer_lower.rb
fractal_api-0.1.2 lib/fractal_api/camelizer_lower.rb
fractal_api-0.1.1 lib/fractal_api/camelizer_lower.rb
fractal_api-0.1.0 lib/fractal_api/camelizer_lower.rb