module_eval is a instance method of Module.

It is available to anything that is a Module.

irb(main):001:0> Object.is_a?(Module)
=> true
irb(main):002:0> String.is_a?(Module)
=> true
irb(main):003:0> self.is_a?(Module)
=> false