class ArchSpec::Rules::Naming::NameSelector
Selects methods whose name matches a regex. A named capture in the regex (such as (?<base>.+)) is exposed to the requires constraint.
Attributes
Public Class Methods
Source
# File lib/archspec/rules/naming_rules.rb, line 60 def initialize(regex) raise Error, "method_names matching expects a Regexp, got #{regex.inspect}" unless regex.is_a?(Regexp) @regex = regex end
Public Instance Methods
Source
# File lib/archspec/rules/naming_rules.rb, line 70 def describe "matches #{regex.inspect}" end
Source
# File lib/archspec/rules/naming_rules.rb, line 66 def match(definition) regex.match(definition.name.to_s) end