Class: Attestor::Validations::Follower Private

Inherits:
Validator
  • Object
show all
Defined in:
lib/attestor/validations/follower.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Describe a policy follower for class instances

The follower not only calls an instance method (as validator does), but checks whether the result is valid and raises an exception otherwise.

Examples:

follower = Validator.new(:foo, only: :baz) { FooPolicy.new(foo) }

Instance Method Summary collapse

Methods inherited from Validator

==, initialize, new, used_in_context?, validate

Instance Method Details

#validate(object) ⇒ undefined

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Validates a policy

Parameters:

  • object (Object)

Returns:

  • (undefined)

Raises:



25
26
27
28
29
# File 'lib/attestor/validations/follower.rb', line 25

def validate(object)
  policy = super(object)
  return if policy.valid?
  object.__send__ :invalid, name
end