diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2014-08-22 11:07:26 -0300 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2014-08-22 11:07:26 -0300 |
commit | 9b61a7eda929fcc2e2b0cd34e27d0fceafa7c389 (patch) | |
tree | d6539bce22e7e282d60603ef9f4c33efc2a8f3cc /activesupport/lib | |
parent | f020f302ad8e3be9ccd06099e59337afa1bb5000 (diff) | |
parent | eb73d7dafa343507a60f765c43c748d6987ec652 (diff) | |
download | rails-9b61a7eda929fcc2e2b0cd34e27d0fceafa7c389.tar.gz rails-9b61a7eda929fcc2e2b0cd34e27d0fceafa7c389.tar.bz2 rails-9b61a7eda929fcc2e2b0cd34e27d0fceafa7c389.zip |
Merge pull request #16560 from robin850/rbx-duration-eql
Define the Duration#instance_of? method
Diffstat (limited to 'activesupport/lib')
-rw-r--r-- | activesupport/lib/active_support/duration.rb | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/activesupport/lib/active_support/duration.rb b/activesupport/lib/active_support/duration.rb index 0ae641d05b..084d13a9e3 100644 --- a/activesupport/lib/active_support/duration.rb +++ b/activesupport/lib/active_support/duration.rb @@ -35,10 +35,14 @@ module ActiveSupport end def is_a?(klass) #:nodoc: - Duration == klass || value.is_a?(klass) + instance_of?(klass) || value.is_a?(klass) end alias :kind_of? :is_a? + def instance_of?(klass) # :nodoc: + Duration == klass + end + # Returns +true+ if +other+ is also a Duration instance with the # same +value+, or if <tt>other == value</tt>. def ==(other) |