Skip to content

End of Life Ruby 3.2 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →

class method

Module.used_modules

used_modules → array

Returns an array of all modules used in the current scope. The ordering of modules in the resulting array is not defined.

Example
module A
  refine Object do
  end
end

module B
  refine Object do
  end
end

using A
using B
p Module.used_modules

produces:

Example
[B, A]
See also .new .used_refinements .nesting #< also in 4.1 · 4.0 · 3.4 · 3.3 · 3.1 · 3.0