Skip to content
Browse files

Introduce BasicObject as Builder::BlankSlate for Ruby 1.9 forward com…

…patibility.

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7762 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
1 parent 1f5c436 commit 34b576700dff8b14ee959072cf303f577b9fc2cd @jeremy jeremy committed Oct 7, 2007
View
2 activesupport/CHANGELOG
@@ -1,5 +1,7 @@
*SVN*
+* Introduce BasicObject as Builder::BlankSlate for Ruby 1.9 forward compatibility. [Jeremy Kemper]
+
* Unbundle Builder in favor of a gem dependency. [Jeremy Kemper]
* Disambiguate Time, Date, and DateTime#to_json formatting. #9750 [Geoff Buesing, Chu Yeow]
View
2 activesupport/lib/active_support.rb
@@ -24,7 +24,7 @@
$:.unshift(File.dirname(__FILE__))
$:.unshift(File.dirname(__FILE__) + "/active_support/vendor")
-require 'builder'
+require 'active_support/basic_object'
require 'active_support/inflector'
View
6 activesupport/lib/active_support/basic_object.rb
@@ -0,0 +1,6 @@
+# Ruby 1.9 introduces BasicObject. Use Builder's BlankSlate before then.
+unless defined? BasicObject
+ require 'rubygems'
+ require 'builder'
+ BasicObject = Builder::BlankSlate
+end
View
4 activesupport/lib/active_support/duration.rb
@@ -4,7 +4,7 @@ module ActiveSupport
# such as in this example:
#
# 1.month.ago # equivalent to Time.now.advance(:months => -1)
- class Duration < Builder::BlankSlate
+ class Duration < BasicObject
attr_accessor :value, :parts
def initialize(value, parts) #:nodoc:
@@ -83,4 +83,4 @@ def method_missing(method, *args, &block) #:nodoc:
value.send(method, *args)
end
end
-end
+end

0 comments on commit 34b5767

Please sign in to comment.
Something went wrong with that request. Please try again.