method
making_declared_methods_public
1.2.8 -
Show latest stable
- Class:
Spec::Matchers::Matcher
making_declared_methods_public(# :nodoc:)private
No documentation available.
# File lib/spec/matchers/matcher.rb, line 54
def making_declared_methods_public # :nodoc:
# Our home-grown instance_exec in ruby 1.8.6 results in any methods
# declared in the block eval'd by instance_exec in the block to which we
# are yielding here are scoped private. This is NOT the case for Ruby
# 1.8.7 or 1.9.
#
# Also, due some crazy scoping that I don't understand, these methods
# are actually available in the specs (something about the matcher being
# defined in the scope of Spec::Matchers or within an example), so not
# doing the following will not cause specs to fail, but they *will*
# cause features to fail and that will make users unhappy. So don't.
orig_private_methods = private_methods
yield
st = (class << self; self; end)
(private_methods - orig_private_methods).each {|m| st.__send__ :public, m}
end