Skip to main content
Journey Uncommon Logo
JourneyUncommon
mediumRubyrefinements usingSingle-choice MCQ

A refinement on `String` is activated with `using` at the top level. A separate class `Worker` (defined in the same file) has a method that calls the refined method on its argument. What happens when `Worker#run` is invoked from the `using` scope?

module StringExt refine String do def shout = upcase + "!" end end class Worker def run(s) = s.shout end using StringExt Worker.new.run("hi")