Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #1188 from thedarkone/duplicable-duration

Fix AS::Duration#duplicable? on 1.8
  • Loading branch information...
commit f007885a0371bd22d802a3d133d9bce645f5730c 2 parents eb02579 + 03cd88a
@josevalim josevalim authored
View
1  activesupport/lib/active_support/duration.rb
@@ -10,6 +10,7 @@ module ActiveSupport
# 1.month.ago # equivalent to Time.now.advance(:months => -1)
class Duration < BasicObject
attr_accessor :value, :parts
+ delegate :duplicable?, :to => :value # required when using ActiveSupport's BasicObject on 1.8
def initialize(value, parts) #:nodoc:
@value, @parts = value, parts
View
3  activesupport/test/core_ext/duplicable_test.rb
@@ -1,9 +1,10 @@
require 'abstract_unit'
require 'bigdecimal'
require 'active_support/core_ext/object/duplicable'
+require 'active_support/core_ext/numeric/time'
class DuplicableTest < Test::Unit::TestCase
- NO = [nil, false, true, :symbol, 1, 2.3, BigDecimal.new('4.56'), Class.new, Module.new]
+ NO = [nil, false, true, :symbol, 1, 2.3, BigDecimal.new('4.56'), Class.new, Module.new, 5.seconds]
YES = ['1', Object.new, /foo/, [], {}, Time.now]
def test_duplicable
Please sign in to comment.
Something went wrong with that request. Please try again.