Sha256: 262c79c648347c78eccf0107e3230fe47b4528e637691795d0a6cb25d1e46201

Contents?: true

Size: 912 Bytes

Versions: 19

Compression:

Stored size: 912 Bytes

Contents

require 'zeitwerk'

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

19 entries across 19 versions & 1 rubygems

Version Path
datadog_api_client-2.16.0 .generator/src/generator/templates/inflector.j2
datadog_api_client-2.15.0 .generator/src/generator/templates/inflector.j2
datadog_api_client-2.14.0 .generator/src/generator/templates/inflector.j2
datadog_api_client-2.13.0 .generator/src/generator/templates/inflector.j2
datadog_api_client-2.12.0 .generator/src/generator/templates/inflector.j2
datadog_api_client-2.11.0 .generator/src/generator/templates/inflector.j2
datadog_api_client-2.10.0 .generator/src/generator/templates/inflector.j2
datadog_api_client-2.9.0 .generator/src/generator/templates/inflector.j2
datadog_api_client-2.8.0 .generator/src/generator/templates/inflector.j2
datadog_api_client-2.7.0 .generator/src/generator/templates/inflector.j2
datadog_api_client-2.6.0 .generator/src/generator/templates/inflector.j2
datadog_api_client-2.5.0 .generator/src/generator/templates/inflector.j2
datadog_api_client-2.4.0 .generator/src/generator/templates/inflector.j2
datadog_api_client-2.3.0 .generator/src/generator/templates/inflector.j2
datadog_api_client-2.2.0 .generator/src/generator/templates/inflector.j2
datadog_api_client-2.1.0 .generator/src/generator/templates/inflector.j2
datadog_api_client-2.0.2 .generator/src/generator/templates/inflector.j2
datadog_api_client-2.0.1 .generator/src/generator/templates/inflector.j2
datadog_api_client-2.0.0 .generator/src/generator/templates/inflector.j2