From 7bd33735d413f06d06b3057e8244f9f3e5b518a5 Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Fri, 28 Dec 2007 11:14:18 +0000 Subject: Introduce ActiveSupport::BasicObject which bridges Builder::BlankSlate and Ruby 1.9 BasicObject. Closes #10634 [Frederick Cheung] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8500 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- activesupport/lib/active_support/basic_object.rb | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'activesupport/lib') diff --git a/activesupport/lib/active_support/basic_object.rb b/activesupport/lib/active_support/basic_object.rb index 5e79de993f..009a521a40 100644 --- a/activesupport/lib/active_support/basic_object.rb +++ b/activesupport/lib/active_support/basic_object.rb @@ -1,5 +1,14 @@ -# Ruby 1.9 introduces BasicObject. Use Builder's BlankSlate until then. -unless defined? BasicObject - require 'blankslate' - BasicObject = BlankSlate +# Ruby 1.9 introduces BasicObject which differs slighly from Builder's BlankSlate +# that had been used so far ActiveSupport::BasicObject provides a barebones object with +# the same method on both versions. +module ActiveSupport + if RUBY_VERSION >= '1.9' + class BasicObject < ::BasicObject + undef_method :== + undef_method :equal? + end + else + require 'blankslate' + BasicObject = BlankSlate + end end -- cgit v1.2.3