Custom attribute writer method checking allowed values (enum).
 @param [Object] match_type Object to be assigned
194419
def match_type=(match_type)
      validator = EnumAttributeValidator.new('String', ["Exact", "StartsWith", "EndsWith", "Contains"])
      if match_type.to_i == 0
        unless validator.valid?(match_type)
          raise ArgumentError, "invalid value for 'match_type', must be one of #{validator.allowable_values}."
        end
        @match_type = match_type
      else
        @match_type = validator.allowable_values[match_type.to_i]
      end
    end
563419
def validate_enum_attribute(fully_qualified_name: str, spec: Dict[str, Any], attribute: str,
                            candidates: Set[Union[str, int, float]]) -> Optional[InvalidValueError]:
    

    if attribute not in spec:
        return

    if spec[attribute] not in candidates:
        return InvalidValueError(fully_qualified_name, spec, attribute, candidates)
1093618
def entry_method=(entry_method)
      validator = EnumAttributeValidator.new('String', ["SWIPED", "KEYED", "EMV", "ON_FILE", "CONTACTLESS"])
      unless validator.valid?(entry_method)
        fail ArgumentError, "invalid value for 'entry_method', must be one of #{validator.allowable_values}."
      end
      @entry_method = entry_method
    end
934434
def valid_input?(input)
      case @attributes[:type]
      when :boolean
        [true,false].include?(input)
      when :enum
        raise MissingValuesError unless @attributes[:values]
        raise InvalidValuesError unless @attributes[:values].class == Array
        @attributes[:values].include?(input)
      when :string
        format = @attributes[:format] || :anything
        Validator.valid_input?(format, input)
      when :number
        [Integer, Fixnum].include?(input.class)
      when :timestamp
        # TODO timestamp pending
        # raise PendingBranchError
        true
      else
        false
      end
    end
820418
def is_enum_type(type_):
    

    return isinstance(type_, type) and issubclass(type_, tuple(_get_types(Types.ENUM)))
318743
def attr_match(cond)
      cond.each_pair { |k,v| return false unless v == @attributes[k.to_sym] || v == @attributes[k.to_s] }
      true
    end
1189281
def rule=(rule)
      validator = EnumAttributeValidator.new('String', ["INCLUDE", "EXCLUDE"])
      unless validator.valid?(rule)
        fail ArgumentError, "invalid value for 'rule', must be one of #{validator.allowable_values}."
      end
      @rule = rule
    end
113605
def match_condition(value, condition)
        case condition
          when String
            value && value == condition
          when Regexp
            value && value.match(condition)
          when Numeric
            value == condition.to_s
          when true
            !value.nil?
          when false, nil
            value.nil?
          else
            false
        end
      end
759565
def match_type(mtype, patterns):
    ''''''
    for p in patterns:
        if fnmatch.fnmatch(mtype, p):
            return True
    return False
76048
def schedule_type=(schedule_type)
      validator = EnumAttributeValidator.new('String', ["SCHEDULED", "ASAP"])
      unless validator.valid?(schedule_type)
        fail ArgumentError, "invalid value for 'schedule_type', must be one of #{validator.allowable_values}."
      end
      @schedule_type = schedule_type
    end
1232556
def match_type?(object)
            result = object.kind_of_any? self.type_classes
            if not result
                result = object.type_of_any? self.type_types
            end
            
            return result
        end
166505
def build_matcher(options, whitelist_option, blacklist_option)
        options.assert_exclusive_keys(whitelist_option, blacklist_option)
        
        if options.include?(whitelist_option)
          value = options[whitelist_option]
          value.is_a?(Matcher) ? value : WhitelistMatcher.new(options[whitelist_option])
        elsif options.include?(blacklist_option)
          value = options[blacklist_option]
          raise ArgumentError, ":#{blacklist_option} option cannot use matchers; use :#{whitelist_option} instead" if value.is_a?(Matcher)
          BlacklistMatcher.new(value)
        else
          AllMatcher.instance
        end
      end
573126
def validate_enum_attribute(self, attribute: str,
                                candidates: Set[Union[str, int, float]]) -> None:
        
        self.add_errors(
            validate_enum_attribute(self.fully_qualified_name, self._spec, attribute, candidates))
471545
def check_type(node,expected_type,label,accept_nil = false)
              
        valid_type = true;
        if(@types.has_key?(expected_type))
          valid_type = match_node(node,@types[expected_type],label)
        elsif node.class.to_s != expected_type && !(node.kind_of?(NilClass) && (expected_type=='empty' || accept_nil))
          valid_type = false
        end
       
        return valid_type
        
      end
144230
def event_type=(event_type)
      validator = EnumAttributeValidator.new('String', ["API_CREATE", "API_EDIT", "API_DELETE", "REGISTER_CLOCKIN", "REGISTER_CLOCKOUT", "DASHBOARD_SUPERVISOR_CLOSE", "DASHBOARD_EDIT", "DASHBOARD_DELETE"])
      unless validator.valid?(event_type)
        fail ArgumentError, "invalid value for 'event_type', must be one of #{validator.allowable_values}."
      end
      @event_type = event_type
    end
196746
def adjustment_type=(adjustment_type)
      validator = EnumAttributeValidator.new('String', ["TAX"])
      unless validator.valid?(adjustment_type)
        fail ArgumentError, "invalid value for 'adjustment_type', must be one of #{validator.allowable_values}."
      end
      @adjustment_type = adjustment_type
    end
1340470
def match?(attribute, type = nil, **options)
      if @attribute != attribute || (type && @type != type)
        return false
      end

      options.each do |key, value|
        if @options[key] != value
          return false
        end
      end

      true
    end