Class: Class

Inherits:
Object show all
Defined in:
vendor_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



5
6
7
8
9
10
11
# File 'vendor_modules/stdlib/spec/monkey_patches/publicize_methods.rb', line 5

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