Sha256: 37fb3f4afbd72094d64a388aec9d8261f0527374e51e547f7d46e3230a1a41e6
Contents?: true
Size: 813 Bytes
Versions: 2
Compression:
Stored size: 813 Bytes
Contents
# encoding: utf-8 module Attestor module Validations # 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. # # @example # follower = Validator.new(:foo, only: :baz) { FooPolicy.new(foo) } # # @api private class Follower < Validator # Validates a policy # # @param [Object] object # # @raise [Attestor::InvalidError] if a policy isn't valid # # @return [undefined] def validate(object) policy = super(object) return if policy.valid? object.__send__ :invalid, name end end # class Follower end # module Validations end # module Attestor
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
attestor-0.4.0 | lib/attestor/validations/follower.rb |
attestor-0.3.0 | lib/attestor/validations/follower.rb |