Sha256: d963c8c64525b85864c56f23537c0cf47908eb376bb56bf92dddf4b5d9e738a1
Contents?: true
Size: 697 Bytes
Versions: 4
Compression:
Stored size: 697 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 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) constantValues = {{classname}}.constants.select { |c| {{classname}}::const_get(c) == value } constantValues.empty? ? {{moduleName}}::UnparsedObject.new(value) : value end end
Version data entries
4 entries across 4 versions & 1 rubygems