Module: SmartCore::Container::KeyGuard

Defined in:
lib/smart_core/container/key_guard.rb

Overview

Since:

  • 0.1.0

Class Method Summary collapse

Class Method Details

.indifferently_accessable_key(key) ⇒ String

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.

Parameters:

  • key (Symbol, String)

Returns:

  • (String)

Since:

  • 0.1.0



26
27
28
29
# File 'lib/smart_core/container/key_guard.rb', line 26

def indifferently_accessable_key(key)
  prevent_incomparabilities!(key)
  key.to_s
end

.prevent_incomparabilities!(key) ⇒ void

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.

This method returns an undefined value.

Parameters:

  • key (Symbol, String)

Raises:

Since:

  • 0.1.0



14
15
16
17
18
19
# File 'lib/smart_core/container/key_guard.rb', line 14

def prevent_incomparabilities!(key)
  raise(
    SmartCore::Container::IncompatibleEntityNameError,
    'Namespace/Dependency name should be a symbol or a string'
  ) unless key.is_a?(String) || key.is_a?(Symbol)
end