All Downloads are FREE. Search and download functionalities are using the official Maven repository.

crystal.partial_model_enum_class.mustache Maven / Gradle / Ivy

There is a newer version: 7.9.0
Show newest version
  class {{classname}}{{#allowableValues}}{{#enumVars}}
    {{{name}}} = {{{value}}}
  {{/enumVars}} {{/allowableValues}}
    # Builds the enum from string
    # @param [String] The enum value in the form of the string
    # @return [String] The enum value
    def self.build_from_hash(value)
      new.build_from_hash(value)
    end

    # Builds the enum from string
    # @param [String] The enum value in the form of the string
    # @return [String] The enum value
    def build_from_hash(value)
      case value{{#allowableValues}}{{#enumVars}}
      when {{{value}}}
        {{{name}}}{{/enumVars}}{{/allowableValues}}
      else
        raise "Invalid ENUM value #{value} for class #{{{classname}}}"
      end
    end
  end




© 2015 - 2024 Weber Informatics LLC | Privacy Policy