Load Ruby gem into a user-defined namespace
问题 Given a gem that defines top-level classes that clash with some code I have written, is it possible to require the gem in such a way that all its classes are grouped inside a module I can define? For example, if an unsafe_gem defines a class: class Word # ... some code end I would need something like: class Word # My word class. end module SafeContainer # This obviously doesn't work # (i.e. the gem still defines ::Word). require 'unsafe_gem' end So that I can distinguish between: Word.new # =