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

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

Instance Method Summary collapse

Methods inherited from Exception

new

Instance Method Details

#initialize_with_kwargs(mod:, namespace:) ⇒ Object



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