class ArchSpec::Rules::NamingRule
Backs the +methods.matching(…)+ DSL. One rule pairs a selector (which methods it judges) with a constraint (what must hold of them). It judges a component’s defined, public methods, or every defined method in the project when source is nil. Every finding is name-based and exact, so confidence is always :high.
Attributes
Public Class Methods
# File lib/archspec/rules/naming_rules.rb, line 15 def initialize(source:, selector:, constraint:, scope: :instance, except: []) @source = source&.to_sym @selector = selector @constraint = constraint @scope = scope @except = Array(except).flatten.map(&:to_sym).to_set end
Public Instance Methods
Source
# File lib/archspec/rules/naming_rules.rb, line 27 def evaluate(graph) selected = candidate_methods(graph).filter_map do |definition| next if except.include?(definition.name) match = selector.match(definition) [definition, match] if match end @constraint.diagnostics(selected, self, graph) end