Sha256: 55a040ca0e50a09593958b5bf6c8ba616264ecb25ad9e938d4981daf3301e4d4

Contents?: true

Size: 953 Bytes

Versions: 4

Compression:

Stored size: 953 Bytes

Contents

require 'zeitwerk'

module {{ module_name }}
  class {{ module_name }}Inflector < Zeitwerk::Inflector
    def camelize(basename, abspath)
      model_name = "#{abspath.match(/datadog_api_client\/(v[0-9])\//)&.captures&.first}.#{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

4 entries across 4 versions & 1 rubygems

Version Path
datadog_api_client-2.29.1 .generator/src/generator/templates/inflector.j2
datadog_api_client-2.28.1 .generator/src/generator/templates/inflector.j2
datadog_api_client-2.27.1 .generator/src/generator/templates/inflector.j2
datadog_api_client-2.26.1 .generator/src/generator/templates/inflector.j2