Sha256: 5a6596debf3882508b748c0aaee0c5bb9decd08b33149079d47fa80d962690e9
Contents?: true
Size: 1.06 KB
Versions: 5
Compression:
Stored size: 1.06 KB
Contents
# encoding: utf-8 module Policy # An exception to be risen by {Policy::Interface#apply} class ViolationError < RuntimeError include Adamantium # @!attribute [r] policy # The violated policy object # # @return [Policy::Follower] attr_reader :policy # @!attribute [r] messages # The list of messages from the broken policy # # @return [Array<String>] attr_reader :messages # @!scope class # @!method new(policy) # Constructs an exception # # @param [Policy::Follower] policy # the violated policy object # # @return [Policy::ViolationError] def initialize(policy) @policy = policy.dup @messages = @policy.messages end # The human-readable description for the exception # # @return [String] def inspect "#<#{ self }: #{ message }>" end # The human-readable exception message # # @return [String] def message "#{ policy } violated: #{ messages }" end memoize :policy, :messages end # module Follower end # module Policy
Version data entries
5 entries across 5 versions & 1 rubygems