Class: Hanami::Utils::Class
- Inherits:
-
Object
- Object
- Hanami::Utils::Class
- Defined in:
- lib/hanami/utils/class.rb
Overview
Class utilities
Class Method Summary collapse
-
.load(name, namespace = Object) ⇒ Class, ...
Loads a class for the given name, only if it’s defined.
-
.load!(name, namespace = Object) ⇒ Class, Module
Loads a class for the given name.
Class Method Details
.load(name, namespace = Object) ⇒ Class, ...
Loads a class for the given name, only if it’s defined.
71 72 73 |
# File 'lib/hanami/utils/class.rb', line 71 def self.load(name, namespace = Object) load!(name, namespace) if namespace.const_defined?(name.to_s, false) end |
.load!(name, namespace = Object) ⇒ Class, Module
Loads a class for the given name.
40 41 42 |
# File 'lib/hanami/utils/class.rb', line 40 def self.load!(name, namespace = Object) namespace.const_get(name.to_s, false) end |