Execute all rules in this context against the resource.

 @param [Object] resource
   the resource to be validated

 @return [Array(Violation)]
   an Array of Violations
773740
def validate(resource)
      rules = rules_for_resource(resource)
      rules.map { |rule| rule.validate(resource) }.compact
      # TODO:
      #   violations = rules.map { |rule| rule.validate(resource) }.compact
      #   ViolationSet.new(resource).concat(violations)
    end
778136
def each_page_each_resource(args={})
      self.each_page(args) do |page|
        page.resources.each do |item|
          yield(item)
        end
      end
    end
5880
def execute
    begin
      @response = OData::Resource.new(build_query_uri, @rest_options).get
    rescue Exception => e
      handle_exception(e)
    end
    return Integer(@response.body) if @response.body =~ /\A\d+\z/
    handle_collection_result(@response.body)
  end
130100
def perform(*all_args)
      return yield if block_given?
      op, key, *args = *all_args

      key = key.to_s
      key = validate_key(key)
      begin
        server = ring.server_for_key(key)
        ret = server.request(op, key, *args)
        ret
      rescue NetworkError => e
        Dalli.logger.debug { e.inspect }
        Dalli.logger.debug { "retrying request with new server" }
        retry
      end
    end
744245
def flash_errors(resource, e: nil)
      raise 'expected an ActiveRecord resource' unless resource.respond_to?(:errors)

      messages = resource.errors.map do |attribute, message|
        if message[0] == message[0].upcase # If the error begins with a capital letter
          message
        elsif attribute == :base
          message
        elsif attribute.to_s.end_with?('_ids')
          "#{resource.class.human_attribute_name(attribute.to_s[0..-5].pluralize).downcase} #{message}"
        else
          "#{resource.class.human_attribute_name(attribute).downcase} #{message}"
        end
      end

      messages << e.message if messages.blank? && e && e.respond_to?(:message)

      messages.to_sentence.presence
    end
1341279
def validation(html, resource_name)
      resource_data_path = File.join(@data_folder, filenameize(resource_name))
      HTMLValidationResult.new(resource_name, html, resource_data_path,  @tidy_flags, @options)
    end
886139
def full_messages
      violations.inject([]) do |list, (attribute_name, violations)|
        messages = violations
        messages = violations.full_messages if violations.respond_to?(:full_messages)
        list.concat(messages)
      end
    end
797089
private function execute() {

		if(false === $this -> getExecuted()) {

			foreach($this -> rules as $rule) {

				$value = $this -> getValue($rule -> field, $rule -> prefix);

				//Execute custom extended validator
				if($rule -> closure) {

					if(false === call_user_func($rule -> closure, $rule -> field, $value)) {

						$this -> setPasses(false);

						$instance = $this -> getMessageInstance();
						$instance :: setFieldnames([$rule -> field]);
						$instance :: setError($rule -> prefix, $rule -> field, $rule -> message);
					}

					continue;
				}

				//Execute build in validator
				$class = $this -> getRuleClass($rule -> rule);
				$class = new $class();

				//Set rule data
				$class -> setField($rule -> field);
				$class -> setValue($value);
				$class -> setPrefix($rule -> prefix);
				$class -> setParameters($rule -> parameters);
				$class -> setValidateAsArray($this -> isValidateArray($rule -> field));

				if(true === is_callable([$class, 'requestParameters'])) {
					
					$params = call_user_func_array([$class, 'requestParameters'], []);

					foreach($params as $param) {
						
						$value = $this -> getValue($param, $rule -> prefix);
						$class -> setValues($param, $value);
					}
				}

				//Check if rule passes
				if(false === $this -> isRequired($rule -> field, $value) && false === $class -> isValid()) {

					$this -> setPasses(false);
					$this -> setErrorMessage($rule, $class);

					foreach($this -> combine as $combine) {
						
						if($combine -> getName() === $rule -> field) {

							foreach($combine -> getFieldnames() as $fieldname) {

								$rule -> field = $fieldname;
								$this -> setErrorMessage($rule, $class);
							}

							break;
						}
					}
				}
			}

			$this -> setExecuted(true);
		}
	}
1281548
def process
      @deferred_process = []
      @reader.rules.each do |rule|
        if rule.deferred
          @deferred_process << rule
        else
          rule.files_list(@runner.options.root_path).each do |file|
            check(rule, file)
          end
        end
      end
      
      @deferred_process.each do |rule|
        rule.exec_rule.run(@runner.options.root_path, rule.files_list(@runner.options.root_path))
      end
      
      self
    end
778434
def execute
      return :locked if @resource.locked_to_user? @headers

      if @resource.true? options[:overwrite]
        previous_resource_existed = overwrite_destination
      end

      status = super
      return status if %i[precondition_failed conflict].include? status

      @resource.delete_collection

      response_status status, previous_resource_existed
    end
554168
def allowed_params_for(resource, params, controller=nil)
      controller  = set_controller(resource, controller)
      resource    = set_resource(resource)

      current_permission = load_permission(controller)

      if current_permission && current_permission.allowed_params
        params.require(resource).permit *current_permission.allowed_params
      end
    end
87273
def run(self):
        
        failed_result = None
        for rule in self.rules_list:
            for check, deny in rule:
                if not check():
                    failed_result = (False, deny)
                    break
            else:
                return (True, None)
        return failed_result
394170
def run_validations(validations = nil)
      # Default to running the class level validations
      validations ||= self.class.validations_to_run

      promise = Promise.new.resolve(nil)
      if validations

        # Run through each validation
        validations.each_pair do |field_name, options|
          promise = promise.then { run_validation(field_name, options) }
        end
      end

      promise
    end
204543
def _run_validators(self, value):
        
        errors = []
        for v in self.validators:
            try:
                v(value)
            except ValidationError, e:
                errors.extend(e.messages)
        if errors:
            raise ValidationError(errors)
510420
def execute_all(event, object)
      each_subscription_id(event) do |subscription_id|
        execute(subscription_id, event, object)
      end
    end
36209
def execute_rule(rule, matches, context):
    
    if rule.enabled(context):
        log(rule.log_level, "Checking rule condition: %s", rule)
        when_response = rule.when(matches, context)
        if when_response:
            log(rule.log_level, "Rule was triggered: %s", when_response)
            log(rule.log_level, "Running rule consequence: %s %s", rule, when_response)
            rule.then(matches, when_response, context)
            return when_response
    else:
        log(rule.log_level, "Rule is disabled: %s", rule)
1260909
def execute(method, path, parameters, headers = { accept: :json }, &block)
      payload = {}.merge(parameters)
      url = base_url + path

      request_arguments = {
        method:  method,
        url:     url,
        payload: payload,
        headers: headers
      }

      RestClient::Request.execute(request_arguments, &block)
    rescue RestClient::Unauthorized
      raise AuthError, "Authentication failed"
    rescue RestClient::InternalServerError
      raise ServerError, "Server error"
    rescue RestClient::Forbidden => e
      raise BadRequest, e.http_body
    end