Sha256: dab147a273654e4a6c3caf450e206e7a2abc3ad0c320ec7d8934122ea7ad2c3b
Contents?: true
Size: 512 Bytes
Versions: 2
Compression:
Stored size: 512 Bytes
Contents
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
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
noths-0.2.1 | templates/partial_model_enum_class.mustache |
noths-0.2.0 | templates/partial_model_enum_class.mustache |