diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2007-10-07 01:07:00 +0000 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2007-10-07 01:07:00 +0000 |
commit | 34b576700dff8b14ee959072cf303f577b9fc2cd (patch) | |
tree | a006f9ada6aa17bb7249fdea89626af53c9b4526 | |
parent | 1f5c4365a7429d7f5de0f515b89761434a159d99 (diff) | |
download | rails-34b576700dff8b14ee959072cf303f577b9fc2cd.tar.gz rails-34b576700dff8b14ee959072cf303f577b9fc2cd.tar.bz2 rails-34b576700dff8b14ee959072cf303f577b9fc2cd.zip |
Introduce BasicObject as Builder::BlankSlate for Ruby 1.9 forward compatibility.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7762 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
-rw-r--r-- | activesupport/CHANGELOG | 2 | ||||
-rw-r--r-- | activesupport/lib/active_support.rb | 2 | ||||
-rw-r--r-- | activesupport/lib/active_support/basic_object.rb | 6 | ||||
-rw-r--r-- | activesupport/lib/active_support/duration.rb | 4 |
4 files changed, 11 insertions, 3 deletions
diff --git a/activesupport/CHANGELOG b/activesupport/CHANGELOG index da51b8aea8..ffc88ef6af 100644 --- a/activesupport/CHANGELOG +++ b/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] diff --git a/activesupport/lib/active_support.rb b/activesupport/lib/active_support.rb index 28424dd6a7..33ed840aa7 100644 --- a/activesupport/lib/active_support.rb +++ b/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' diff --git a/activesupport/lib/active_support/basic_object.rb b/activesupport/lib/active_support/basic_object.rb new file mode 100644 index 0000000000..7a3d1a9ed0 --- /dev/null +++ b/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 diff --git a/activesupport/lib/active_support/duration.rb b/activesupport/lib/active_support/duration.rb index 0d3016a690..fd9b505c2f 100644 --- a/activesupport/lib/active_support/duration.rb +++ b/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 @@ module ActiveSupport value.send(method, *args) end end -end
\ No newline at end of file +end |