Custom attribute writer method checking allowed values (enum).
 @param [Object] race Object to be assigned
167030
def race=(race)
      validator = EnumAttributeValidator.new('String', ["Caucasian", "Asian", "Black or African American", "American Indian", "Hawaiian or Other Pacific Islander", "Two or More Races", "Unknown", ""])
      unless validator.valid?(race)
        fail ArgumentError, "invalid value for 'race', must be one of #{validator.allowable_values}."
      end
      @race = race
    end
669529
def sort_order=(sort_order)
      validator = EnumAttributeValidator.new('String', ["DESC", "ASC"])
      unless validator.valid?(sort_order)
        fail ArgumentError, "invalid value for 'sort_order', must be one of #{validator.allowable_values}."
      end
      @sort_order = sort_order
    end
790389
def visibility=(visibility)
      validator = EnumAttributeValidator.new('String', ["PUBLIC", "PRIVATE"])
      unless validator.valid?(visibility)
        fail ArgumentError, "invalid value for 'visibility', must be one of #{validator.allowable_values}."
      end
      @visibility = visibility
    end
858057
def validate_ENUM(in_value, restriction):
    
    value = _get_val(in_value)
    if type(value) is list:
        for subval in value:
            if type(subval) is tuple:
                subval = subval[1]
            validate_ENUM(subval, restriction)
    else:
        if value not in restriction:
            raise ValidationError("ENUM : %s"%(restriction))
1026761
def _handle_enum(self, node, scope, ctxt, stream):
        
        self._dlog("handling enum")
        if node.type is None:
            enum_cls = fields.Int
        else:
            enum_cls = self._handle_node(node.type, scope, ctxt, stream)

        enum_vals = {}
        curr_val = enum_cls()
        curr_val._pfp__value = -1
        for enumerator in node.values.enumerators:
            if enumerator.value is not None:
                curr_val = self._handle_node(enumerator.value, scope, ctxt, stream)
            else:
                curr_val = curr_val + 1
            curr_val._pfp__freeze()
            enum_vals[enumerator.name] = curr_val
            enum_vals[fields.PYVAL(curr_val)] = enumerator.name
            scope.add_local(enumerator.name, curr_val)

        if node.name is not None:
            enum_cls = EnumDef(node.name, enum_cls, enum_vals)
            scope.add_type_class(node.name, enum_cls)

        else:
            enum_cls = EnumDef("enum_" + enum_cls.__name__, enum_cls, enum_vals)
            # don't add to scope if we don't have a name

        return enum_cls
429347
def event=(event)
      validator = EnumAttributeValidator.new('String', ["video-passed", "video-error", "video-warning", "video-rejected", "video-canceled"])
      unless validator.valid?(event)
        fail ArgumentError, "invalid value for 'event', must be one of #{validator.allowable_values}."
      end
      @event = event
    end
819595
def ell_status=(ell_status)
      validator = EnumAttributeValidator.new('String', ["Y", "N", ""])
      unless validator.valid?(ell_status)
        fail ArgumentError, "invalid value for 'ell_status', must be one of #{validator.allowable_values}."
      end
      @ell_status = ell_status
    end
757446
static boolean attributeHasEnum(XsdAttribute attribute) {
        List<XsdRestriction> restrictions = getAttributeRestrictions(attribute);

        return restrictions != null && restrictions.size() == 1 && restrictions.get(0).getEnumeration() != null && !restrictions.get(0).getEnumeration().isEmpty();
    }
796859
def selection_type=(selection_type)
      validator = EnumAttributeValidator.new('String', ["SINGLE", "MULTIPLE"])
      unless validator.valid?(selection_type)
        fail ArgumentError, "invalid value for 'selection_type', must be one of #{validator.allowable_values}."
      end
      @selection_type = selection_type
    end
140398
def translate_enum(attribute, &block)
      builder = Builder.new(self, attribute, &block)

      # User.translated_status(:active)
      define_singleton_method(builder.method_name_singular) do |key|
        I18n.translate("#{builder.i18n_scope}.#{builder.i18n_location(key)}", default: builder.i18n_default_location(key))
      end

      # @return [Array]
      # @example
      #   f.select_field :gender, f.object.class.translated_genders
      define_singleton_method(builder.method_name_plural) do
        public_send(builder.enum_klass_method_name).map do |key, value|
          [public_send(builder.method_name_singular, key), key, value]
        end
      end

      # @return [String]
      # @example
      #   @user.translated_gender
      define_method(builder.method_name_singular) do
        if (key = public_send(builder.enum_instance_method_name)).present?
          self.class.public_send(builder.method_name_singular, key)
        end
      end
    end
1239069
def have_enum_values(enum, values, headers = nil, &b)
      values.each do |value|
        have_enum_value(enum, value, headers, &b)
      end
    end
204760
def gender=(gender)
      validator = EnumAttributeValidator.new('String', ["M", "F", ""])
      unless validator.valid?(gender)
        fail ArgumentError, "invalid value for 'gender', must be one of #{validator.allowable_values}."
      end
      @gender = gender
    end
414190
def write_enum(fo, datum, schema):
    """"""
    index = schema['symbols'].index(datum)
    write_int(fo, index)
699397
def isconst(cls, val):
        ''' 

        '''
        return isinstance(val, string_types) and \
               ((len(val) == 7 and val[0] == "#") or val in enums.NamedColor)
826716
def method=(method)
      validator = EnumAttributeValidator.new('String', ["ENUM", "FC"])
      unless validator.valid?(method)
        fail ArgumentError, "invalid value for 'method', must be one of #{validator.allowable_values}."
      end
      @method = method
    end
1145293
def write_attribute(name, value)
      name = name.to_sym

      if association = @associations[name]
        association.reset
      end

      @attributes_before_type_cast[name] = value

      value_casted = TypeCasting.cast_field(value, self.class.attributes[name])
      attributes[name] = value_casted
    end
595562
def inclusion_type=(inclusion_type)
      validator = EnumAttributeValidator.new('String', ["ADDITIVE", "INCLUSIVE"])
      unless validator.valid?(inclusion_type)
        fail ArgumentError, "invalid value for 'inclusion_type', must be one of #{validator.allowable_values}."
      end
      @inclusion_type = inclusion_type
    end