aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib
diff options
context:
space:
mode:
authorGuillermo Iguaran <guilleiguaran@gmail.com>2014-04-08 21:13:21 -0500
committerGuillermo Iguaran <guilleiguaran@gmail.com>2014-04-08 21:13:21 -0500
commitaff37a9ed2463629bee8930be4f0beab1ec7fbb4 (patch)
tree9c8679086dbf776529c0cd2098f7351e78ad54e9 /activesupport/lib
parent30a41e76f6e21b3dbaf502331066d922b24304bf (diff)
parent5aeb3cd3ac88a6a16b6d573e4bbad846938fd5a7 (diff)
downloadrails-aff37a9ed2463629bee8930be4f0beab1ec7fbb4.tar.gz
rails-aff37a9ed2463629bee8930be4f0beab1ec7fbb4.tar.bz2
rails-aff37a9ed2463629bee8930be4f0beab1ec7fbb4.zip
Merge pull request #14652 from Emily/duration_eqls
Fixed problem where `1.day.eql?(1.day)` is false
Diffstat (limited to 'activesupport/lib')
-rw-r--r--activesupport/lib/active_support/duration.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/activesupport/lib/active_support/duration.rb b/activesupport/lib/active_support/duration.rb
index 7df4857c25..09eb732ef7 100644
--- a/activesupport/lib/active_support/duration.rb
+++ b/activesupport/lib/active_support/duration.rb
@@ -49,6 +49,10 @@ module ActiveSupport
end
end
+ def eql?(other)
+ other.is_a?(Duration) && self == other
+ end
+
def self.===(other) #:nodoc:
other.is_a?(Duration)
rescue ::NoMethodError