module ArchSpec::Rules::Reasoned
Attaches a human reason to any rule without coupling that metadata to the rule’s implementation or to diagnostic fingerprints.
Attributes
Public Instance Methods
Source
# File lib/archspec/rules/reasoned.rb, line 10 def archspec_because=(reason) return unless reason reason = reason.to_s.strip raise Error, 'because: must not be empty' if reason.empty? if archspec_because && archspec_because != reason raise Error, "the same rule cannot have two reasons: #{archspec_because.inspect} and #{reason.inspect}" end @archspec_because = reason end
Source
# File lib/archspec/rules/reasoned.rb, line 22 def evaluate(graph) super.map { |diagnostic| diagnostic.with_reason(archspec_because) } end
Calls superclass method