Class: Substation::DSL::Guard

Inherits:
Object
  • Object
show all
Includes:
Adamantium::Flat
Defined in:
lib/substation/dsl/guard.rb

Overview

A guard used for rejecting invalid names in Substation::DSL

Instance Method Summary collapse

Constructor Details

#initialize(_reserved_names = EMPTY_ARRAY) ⇒ undefined

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Initialize a new instance


20
21
22
# File 'lib/substation/dsl/guard.rb', line 20

def initialize(_reserved_names = EMPTY_ARRAY)
  super
end

Instance Method Details

#call(name, registry) ⇒ undefined

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Raise if #name is either reserved or already registered

Raises:


41
42
43
44
# File 'lib/substation/dsl/guard.rb', line 41

def call(name, registry)
  raise_if_already_registered(name, registry)
  raise_if_reserved(name)
end