diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2007-12-28 11:14:18 +0000 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2007-12-28 11:14:18 +0000 |
commit | 7bd33735d413f06d06b3057e8244f9f3e5b518a5 (patch) | |
tree | 7a051be3987334df55835689c0d96306835a6771 | |
parent | 7555073803ffb455715b74664a0cfb48c271fe89 (diff) | |
download | rails-7bd33735d413f06d06b3057e8244f9f3e5b518a5.tar.gz rails-7bd33735d413f06d06b3057e8244f9f3e5b518a5.tar.bz2 rails-7bd33735d413f06d06b3057e8244f9f3e5b518a5.zip |
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
-rw-r--r-- | actionpack/lib/action_view/helpers/prototype_helper.rb | 6 | ||||
-rw-r--r-- | activesupport/lib/active_support/basic_object.rb | 17 |
2 files changed, 14 insertions, 9 deletions
diff --git a/actionpack/lib/action_view/helpers/prototype_helper.rb b/actionpack/lib/action_view/helpers/prototype_helper.rb index f4ea25af16..68e22ff032 100644 --- a/actionpack/lib/action_view/helpers/prototype_helper.rb +++ b/actionpack/lib/action_view/helpers/prototype_helper.rb @@ -1065,11 +1065,7 @@ module ActionView end # Converts chained method calls on DOM proxy elements into JavaScript chains - class JavaScriptProxy < BasicObject #:nodoc: - if ::RUBY_VERSION >= '1.9' - undef_method :== - undef_method :equal? - end + class JavaScriptProxy < ActiveSupport::BasicObject #:nodoc: def initialize(generator, root = nil) @generator = generator 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 |