Skip to content

Preview Ruby 4.1 is a preview. It can change before the final release. Switch to Ruby 4.0 →

class method · added in Ruby 3.2

Module.used_refinements

() -> ::Array[::Refinement]
used_refinements → 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_refinements

produces:

[#<refinement:Object@B>, #<refinement:Object@A>]

Ruby version changes

  1. 3.2
See also .used_modules #< .new #<= also in 4.0 · 3.4 · 3.3 · 3.2