Doubt at ActionController::Routing::RouteSet::NamedRouteCollection#clear!

I would like to know if anyone could explain me something:

def clear!
          @routes = {}
          @helpers = []

          @module ||= Module.new
          @module.instance_methods.each do |selector|
            @module.class_eval { remove_method selector }
          end
end

The thing I don't understang clearly it's why
@module.instance_methods.each do ... it's done since when we create an
anonymous Module it has none instance methods:

irb(main):017:0* m = Module.new
=> #<Module:0x5be78>
irb(main):018:0> m.instance_methods
=> []

Any suggestions?

Farruco Sanjurjo.

I would like to know if anyone could explain me something:

def clear!
@routes = {}
@helpers = []

      @module ||= Module\.new
      @module\.instance\_methods\.each do |selector|
        @module\.class\_eval \{ remove\_method selector \}
      end

end

The thing I don't understang clearly it's why
@module.instance_methods.each do ... it's done since when we create an
anonymous Module it has none instance methods:

I don't know this code at all, but module isn't necessarily an empty
module (since we're doing ||=)

Fred