Sha256: 1730471b0b2385cfebbe5fbfa4ebd5679d91f97c261f17f8b567a270a2746e49

Contents?: true

Size: 764 Bytes

Versions: 1

Compression:

Stored size: 764 Bytes

Contents

  class {{classname}}{{#allowableValues}}{{#enumVars}}
    {{{name}}} = {{{value}}}.freeze{{/enumVars}}

{{/allowableValues}}
    # Builds the enum from string
    # @param value [String] The enum value in the form of the string
    # @return [String] The enum value
    # @!visibility private
    def self.build_from_hash(value)
      new.build_from_hash(value)
    end

    # Builds the enum from string
    # @param value [String] The enum value in the form of the string
    # @return [String] The enum value
    # @!visibility private
    def build_from_hash(value)
      constantValues = {{classname}}.constants.select { |c| {{classname}}::const_get(c) == value }
      constantValues.empty? ? {{moduleName}}::UnparsedObject.new(value) : value
    end
  end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
datadog_api_client-1.7.0 .generator/templates/partial_model_enum_class.mustache