Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove warning of removing object_id #13

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 5 additions & 3 deletions lib/blankslate.rb
Expand Up @@ -16,17 +16,19 @@
#
class BlankSlate
class << self

# Hide the method named +name+ in the BlankSlate class. Don't
# hide +instance_eval+ or any method beginning with "__".
def hide(name)
methods = instance_methods.map(&:to_sym)
v, $VERBOSE = $VERBOSE, nil
if methods.include?(name.to_sym) and
name !~ /^(__|instance_eval)/
@hidden_methods ||= {}
@hidden_methods[name.to_sym] = instance_method(name)
undef_method name
end
$VERBOSE = v
end

def find_hidden_method(name)
Expand All @@ -42,7 +44,7 @@ def reveal(name)
define_method(name, hidden_method)
end
end

instance_methods.each { |m| hide(m) }
end

Expand Down Expand Up @@ -107,4 +109,4 @@ def append_features(mod)
end
result
end
end
end