Class: Loglevel::Name

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/loglevel/name.rb

Overview

Like a string, but it can safely instantiate a class from itself

Instance Method Summary collapse

Instance Method Details

#to_class(exception_class) ⇒ Object



8
9
10
11
12
# File 'lib/loglevel/name.rb', line 8

def to_class(exception_class)
  Object.const_get(self)
rescue NameError => exception
  Loglevel::Exception.handle_bad_class(self, exception, exception_class)
end