Method: Bundler::Thor::Util.namespaces_in_content
- Defined in:
- lib/bundler/vendor/thor/lib/thor/util.rb
permalink .namespaces_in_content(contents, file = __FILE__) ⇒ Object
Given the contents, evaluate it inside the sandbox and returns the namespaces defined in the sandbox.
Parameters
contents<String>
Returns
58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/bundler/vendor/thor/lib/thor/util.rb', line 58 def namespaces_in_content(contents, file = __FILE__) old_constants = Bundler::Thor::Base.subclasses.dup Bundler::Thor::Base.subclasses.clear load_thorfile(file, contents) new_constants = Bundler::Thor::Base.subclasses.dup Bundler::Thor::Base.subclasses.replace(old_constants) new_constants.map!(&:namespace) new_constants.compact! new_constants end |