Module: ArchSpec::DSL
- Defined in:
- lib/archspec/dsl.rb
Overview
The ArchSpec DSL.
An Archspec.rb file is evaluated in this context, so every method here is
a top-level call in that file.
Defined Under Namespace
Modules: Context Classes: ComponentProxy
Class Method Summary collapse
-
.assert_known_components!(definition, names, for_rule:) ⇒ Object
Raises when any of
namesis not a declared component.
Class Method Details
.assert_known_components!(definition, names, for_rule:) ⇒ Object
Raises when any of names is not a declared component. Shared by the
top-level DSL and the component proxies.
13 14 15 16 17 18 19 |
# File 'lib/archspec/dsl.rb', line 13 def self.assert_known_components!(definition, names, for_rule:) unknown = Array(names).flatten.compact.map(&:to_sym).reject { |name| definition.component?(name) }.uniq.sort return if unknown.empty? label = unknown.length == 1 ? 'component' : 'components' raise Error, "#{for_rule} references unknown #{label}: #{unknown.join(', ')}" end |