From baba9984eabc43d9a46f70f838bb51639cdcc420 Mon Sep 17 00:00:00 2001 From: Jim Weirich Date: Sun, 9 Sep 2012 07:24:46 -0400 Subject: [PATCH] suppress warning while undefining object_id --- lib/blankslate.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/blankslate.rb b/lib/blankslate.rb index e947376..931c8a7 100644 --- a/lib/blankslate.rb +++ b/lib/blankslate.rb @@ -44,12 +44,16 @@ class << self # Hide the method named +name+ in the BlankSlate class. Don't # hide +instance_eval+ or any method beginning with "__". def hide(name) - if instance_methods.include?(name._blankslate_as_name) and - name !~ /^(__|instance_eval$)/ + warn_level = $VERBOSE + $VERBOSE = nil + if instance_methods.include?(name._blankslate_as_name) && + name !~ /^(__|instance_eval$)/ @hidden_methods ||= {} @hidden_methods[name.to_sym] = instance_method(name) undef_method name end + ensure + $VERBOSE = warn_level end def find_hidden_method(name)