aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/vendor/builder/blankslate.rb
diff options
context:
space:
mode:
authorJeremy Kemper <jeremy@bitsweat.net>2007-10-07 01:05:42 +0000
committerJeremy Kemper <jeremy@bitsweat.net>2007-10-07 01:05:42 +0000
commit1f5c4365a7429d7f5de0f515b89761434a159d99 (patch)
tree9862da02a946e3fde47803216a23fbe18a4c4a77 /activesupport/lib/active_support/vendor/builder/blankslate.rb
parent52ca5dad1ecf64ff508a4f16202171693921890f (diff)
downloadrails-1f5c4365a7429d7f5de0f515b89761434a159d99.tar.gz
rails-1f5c4365a7429d7f5de0f515b89761434a159d99.tar.bz2
rails-1f5c4365a7429d7f5de0f515b89761434a159d99.zip
Unbundle Builder in favor of a gem dependency.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7761 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activesupport/lib/active_support/vendor/builder/blankslate.rb')
-rw-r--r--activesupport/lib/active_support/vendor/builder/blankslate.rb63
1 files changed, 0 insertions, 63 deletions
diff --git a/activesupport/lib/active_support/vendor/builder/blankslate.rb b/activesupport/lib/active_support/vendor/builder/blankslate.rb
deleted file mode 100644
index 57701d8713..0000000000
--- a/activesupport/lib/active_support/vendor/builder/blankslate.rb
+++ /dev/null
@@ -1,63 +0,0 @@
-#!/usr/bin/env ruby
-#--
-# Copyright 2004 by Jim Weirich (jim@weirichhouse.org).
-# All rights reserved.
-
-# Permission is granted for use, copying, modification, distribution,
-# and distribution of modified versions of this work as long as the
-# above copyright notice is included.
-#++
-
-module Builder #:nodoc:
-
- # BlankSlate provides an abstract base class with no predefined
- # methods (except for <tt>\_\_send__</tt> and <tt>\_\_id__</tt>).
- # BlankSlate is useful as a base class when writing classes that
- # depend upon <tt>method_missing</tt> (e.g. dynamic proxies).
- 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)
- undef_method name if
- instance_methods.include?(name.to_s) and
- name !~ /^(__|instance_eval)/
- end
- end
-
- instance_methods.each { |m| hide(m) }
- end
-end
-
-# Since Ruby is very dynamic, methods added to the ancestors of
-# BlankSlate <em>after BlankSlate is defined</em> will show up in the
-# list of available BlankSlate methods. We handle this by defining a
-# hook in the Object and Kernel classes that will hide any defined
-module Kernel #:nodoc:
- class << self
- alias_method :blank_slate_method_added, :method_added
-
- # Detect method additions to Kernel and remove them in the
- # BlankSlate class.
- def method_added(name)
- blank_slate_method_added(name)
- return if self != Kernel
- Builder::BlankSlate.hide(name)
- end
- end
-end
-
-class Object
- class << self
- alias_method :blank_slate_method_added, :method_added
-
- # Detect method additions to Object and remove them in the
- # BlankSlate class.
- def method_added(name) #:nodoc:
- blank_slate_method_added(name)
- return if self != Object
- Builder::BlankSlate.hide(name)
- end
- end
-end