Exception: ConvenientService::Utils::Module::Exceptions::NestingUnderAnonymousNamespace Private

Inherits:
Exception
  • Object
show all
Defined in:
lib/convenient_service/utils/module/exceptions.rb

Overview

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

Since:

  • 1.0.0

Instance Method Summary collapse

Methods inherited from Exception

new

Instance Method Details

#initialize_with_kwargs(mod:, namespace:) ⇒ Object

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.

Since:

  • 1.0.0



13
14
15
16
17
18
19
20
21
22
23
# File 'lib/convenient_service/utils/module/exceptions.rb', line 13

def initialize_with_kwargs(mod:, namespace:)
  message = <<~TEXT
    `#{mod}` is nested under anonymous namespace `#{namespace}`.

    Unfortunately, Ruby does NOT have a reliable way to get corresponding `Module` or `Class` object by anonymous namespace name.
    - https://bugs.ruby-lang.org/issues/15408
    - https://stackoverflow.com/questions/2818602/in-ruby-why-does-inspect-print-out-some-kind-of-object-id-which-is-different
  TEXT

  initialize(message)
end