1 if defined?(BlankSlate)
4 class BlankSlate < ::BlankSlate
9 # 'backported' for Rails pre 2.0
12 # Copyright 2004, 2006 by Jim Weirich (jim@weirichhouse.org).
13 # All rights reserved.
15 # Permission is granted for use, copying, modification, distribution,
16 # and distribution of modified versions of this work as long as the
17 # above copyright notice is included.
20 ######################################################################
21 # BlankSlate provides an abstract base class with no predefined
22 # methods (except for <tt>\_\_send__</tt> and <tt>\_\_id__</tt>).
23 # BlankSlate is useful as a base class when writing classes that
24 # depend upon <tt>method_missing</tt> (e.g. dynamic proxies).
28 # Hide the method named +name+ in the BlankSlate class. Don't
29 # hide +instance_eval+ or any method beginning with "__".
31 if instance_methods.include?(name.to_s) and name !~ /^(__|instance_eval|methods)/
32 @hidden_methods ||= {}
33 @hidden_methods[name.to_sym] = instance_method(name)
38 # Redefine a previously hidden method so that it may be called on a blank
41 # no-op here since we don't hide the methods we reveal where this is
42 # used in this implementation
47 instance_methods.each { |m| hide(m) }