Class: ArchSpec::Rules::Naming::Selected

Inherits:
Object
  • Object
show all
Defined in:
lib/archspec/rules/naming_rules.rb

Overview

A chosen selector, waiting for a constraint. Each constraint method builds a NamingRule, attaches it, and returns the component proxy so rules chain.

Instance Method Summary collapse

Constructor Details

#initialize(component, selector, scope) ⇒ Selected

Returns a new instance of Selected.



186
187
188
189
190
# File 'lib/archspec/rules/naming_rules.rb', line 186

def initialize(component, selector, scope)
  @component = component
  @selector = selector
  @scope = scope
end

Instance Method Details

#forbidden(except: [], because: nil) ⇒ Object



192
193
194
# File 'lib/archspec/rules/naming_rules.rb', line 192

def forbidden(except: [], because: nil)
  add(Forbidden.new(because: because), except)
end

#requires(template, on: nil, scope: :instance, except: [], because: nil) ⇒ Object



196
197
198
199
# File 'lib/archspec/rules/naming_rules.rb', line 196

def requires(template, on: nil, scope: :instance, except: [], because: nil)
  validate_template!(template)
  add(Requires.new(template, on: component_name(on), scope: scope, because: because), except)
end