Class: Class

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

Overview

! /usr/bin/env ruby -S rspec Some monkey-patching to allow us to test private methods.

Instance Method Summary collapse

Instance Method Details

#publicize_methods(*methods) ⇒ Object



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

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

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