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

handlebars.ruby.partial_model_enum_class.mustache Maven / Gradle / Ivy

There is a newer version: 1.0.54
Show newest version
  class {{classname}}
    {{#allowableValues}}
    {{#enumVars}}
    {{{name}}} = {{{value}}}.freeze
    {{/enumVars}}
    {{/allowableValues}}

    # 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)
      constantValues = {{classname}}.constants.select { |c| {{classname}}::const_get(c) == value }
      raise "Invalid ENUM value #{value} for class #{{{classname}}}" if constantValues.empty?
      value
    end
  end




© 2015 - 2024 Weber Informatics LLC | Privacy Policy