Skip to content

Commit

Permalink
Introduce BasicObject as Builder::BlankSlate for Ruby 1.9 forward com…
Browse files Browse the repository at this point in the history
…patibility.

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7762 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information
jeremy committed Oct 7, 2007
1 parent 1f5c436 commit 34b5767
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
2 changes: 2 additions & 0 deletions activesupport/CHANGELOG
Original file line number Diff line number Diff line change
@@ -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]
Expand Down
2 changes: 1 addition & 1 deletion activesupport/lib/active_support.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand Down
6 changes: 6 additions & 0 deletions activesupport/lib/active_support/basic_object.rb
Original file line number Diff line number Diff line change
@@ -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
4 changes: 2 additions & 2 deletions activesupport/lib/active_support/duration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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.