Sha256: ba8d6d9fd4fa2424d95bb38ec44b4603b6ca93d68133d1b0d61c67981838e1a4

Contents?: true

Size: 916 Bytes

Versions: 9

Compression:

Stored size: 916 Bytes

Contents

require 'zeitwerk'

module {{ module_name }}
  class {{ module_name }}Inflector < Zeitwerk::Inflector
    def camelize(basename, abspath)
      model_name = "#{abspath.scan(/v[0-9]/).last}.#{basename}"
      overrides[model_name] || basename.split('_').each(&:capitalize!).join
    end

    def overrides
      @overrides ||= {
        # Models
        {%- for version, models in all_models.items() %}
        {%- for model in models|sort %}
          "{{ version }}.{{ model|snake_case }}" => "{{ model }}",
        {%- endfor %}
        {%- endfor %}
        # APIs
        {%- for version, apis in all_apis.items() %}
        {%- for api in apis|sort %}
        {%- set name = api.replace(" ", "") + "API" %}
        "{{ version }}.{{ api|snake_case }}_api" => "{{ name }}"{%-if not loop.last %},{% endif %}
        {%- endfor %}{%-if not loop.last %},{% endif %}
        {%- endfor %}
        }
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
datadog_api_client-2.26.0 .generator/src/generator/templates/inflector.j2
datadog_api_client-2.25.0 .generator/src/generator/templates/inflector.j2
datadog_api_client-2.24.0 .generator/src/generator/templates/inflector.j2
datadog_api_client-2.22.0 .generator/src/generator/templates/inflector.j2
datadog_api_client-2.21.0 .generator/src/generator/templates/inflector.j2
datadog_api_client-2.20.0 .generator/src/generator/templates/inflector.j2
datadog_api_client-2.19.0 .generator/src/generator/templates/inflector.j2
datadog_api_client-2.18.0 .generator/src/generator/templates/inflector.j2
datadog_api_client-2.17.0 .generator/src/generator/templates/inflector.j2