Why doesn’t this work?
module XT
puts Fixnum.class # So we're sure to re-open the Fixnum class
class Fixnum
def hi
puts "HI from module XT"
end
end
end
After requiring and loading the module, the hi method is still not added to Fixnum. It works if I remove the module wrapper.
You are defining
XT::Fixnum, notFixnum.