What's difference between class_eval and module_eval?

– test.rb –

module M
def self.test
puts “M.test is called”
end
end

M.test
M.instance_eval { test }
M.class_eval { test }
M.module_eval { test }

— result —

M.test is called
M.test is called
M.test is called
M.test is called

From: [email protected] [mailto:[email protected]]

What’s difference between class_eval and module_eval ?

none. one is just an alias of the other.