lib/hanami/utils/basic_object.rb in hanami-utils-1.3.3 vs lib/hanami/utils/basic_object.rb in hanami-utils-1.3.4
- old
+ new
@@ -2,9 +2,26 @@
module Utils
# BasicObject
#
# @since 0.3.5
class BasicObject < ::BasicObject
+ # Lookup constants at the top-level namespace, if they are missing in the
+ # current context.
+ #
+ # @param name [Symbol] the constant name
+ #
+ # @return [Object, Module] the constant
+ #
+ # @raise [NameError] if the constant cannot be found
+ #
+ # @since 1.3.4
+ # @api private
+ #
+ # @see https://ruby-doc.org/core/Module.html#method-i-const_missing
+ def self.const_missing(name)
+ ::Object.const_get(name)
+ end
+
# Return the class for debugging purposes.
#
# @since 0.3.5
#
# @see http://ruby-doc.org/core/Object.html#method-i-class