Permalink
Browse files

As per commit 130d281, changed some metaclass.class_eval's to metacla…

…ss.send's.
  • Loading branch information...
1 parent 130d281 commit d4a19382c60de0b2d114aa3ad25de69888ff5c30 @floehopper floehopper committed Jan 29, 2009
Showing with 4 additions and 3 deletions.
  1. +4 −3 lib/mocha/any_instance_method.rb
@@ -17,7 +17,7 @@ def mock
def hide_original_method
if method_exists?(method)
begin
- stubbee.class_eval("alias_method :#{hidden_method}, :#{method}", __FILE__, __LINE__)
+ stubbee.send(:alias_method, hidden_method, method)
rescue NameError
# deal with nasties like ActiveRecord::Associations::AssociationProxy
end
@@ -29,13 +29,14 @@ def define_new_method
end
def remove_new_method
- stubbee.class_eval("remove_method :#{method}", __FILE__, __LINE__)
+ stubbee.send(:remove_method, method)
end
def restore_original_method
if method_exists?(hidden_method)
begin
- stubbee.class_eval("alias_method :#{method}, :#{hidden_method}; remove_method :#{hidden_method}", __FILE__, __LINE__)
+ stubbee.send(:alias_method, method, hidden_method)
+ stubbee.send(:remove_method, hidden_method)
rescue NameError
# deal with nasties like ActiveRecord::Associations::AssociationProxy
end

0 comments on commit d4a1938

Please sign in to comment.