crystal.partial_model_enum_class.mustache Maven / Gradle / Ivy
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