Class: Class

Inherits:
Object show all
Defined in:
modules/stdlib/spec/monkey_patches/publicize_methods.rb

Overview

Some monkey-patching to allow us to test private methods.

Instance Method Summary collapse

Instance Method Details

#publicize_methods(*methods) ⇒ Object



3
4
5
6
7
8
9
# File 'modules/stdlib/spec/monkey_patches/publicize_methods.rb', line 3

def publicize_methods(*methods)
  saved_private_instance_methods = methods.empty? ? private_instance_methods : methods

  class_eval { public(*saved_private_instance_methods) }
  yield
  class_eval { private(*saved_private_instance_methods) }
end