]> git.donarmstrong.com Git - dsa-puppet.git/blob - 3rdparty/modules/stdlib/spec/monkey_patches/publicize_methods.rb
upgrade to stdlib 4.6.1
[dsa-puppet.git] / 3rdparty / modules / stdlib / spec / monkey_patches / publicize_methods.rb
1 #! /usr/bin/env ruby -S rspec
2 # Some monkey-patching to allow us to test private methods.
3 class Class
4     def publicize_methods(*methods)
5         saved_private_instance_methods = methods.empty? ? self.private_instance_methods : methods
6
7         self.class_eval { public(*saved_private_instance_methods) }
8         yield
9         self.class_eval { private(*saved_private_instance_methods) }
10     end
11 end