Module: Karafka::Helpers::Inflector

Defined in:
lib/karafka/helpers/inflector.rb

Overview

Inflector provides inflection for the whole Karafka framework with additional inflection caching (due to the fact, that Dry::Inflector is slow)

Class Method Summary collapse

Class Method Details

.map(string) ⇒ String

Returns inflected string.

Examples:

Karafka::Helpers::Inflector.map('Module/ControllerName') #=> 'module_controller_name'

Parameters:

  • string (String)

    string that we want to convert to our underscore format

Returns:

  • (String)

    inflected string



20
21
22
# File 'lib/karafka/helpers/inflector.rb', line 20

def map(string)
  @map[string] ||= ENGINE.underscore(string).tr('/', '_')
end