diff options
author | Neeraj Singh <neerajdotname@gmail.com> | 2010-05-19 23:43:39 -0400 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2010-05-21 16:00:55 +0200 |
commit | cc45a1068f7920454d6d3a1cdabf844f17417908 (patch) | |
tree | 3435a9cc0b374c6d1e416e6eb376cc5d6e61824f /activesupport | |
parent | 1bc6b43f535d8b56cb6f25d36e7605d32cb0dd2e (diff) | |
download | rails-cc45a1068f7920454d6d3a1cdabf844f17417908.tar.gz rails-cc45a1068f7920454d6d3a1cdabf844f17417908.tar.bz2 rails-cc45a1068f7920454d6d3a1cdabf844f17417908.zip |
1.day should respond_to kind_of too
[#4656 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
Diffstat (limited to 'activesupport')
-rw-r--r-- | activesupport/lib/active_support/duration.rb | 1 | ||||
-rw-r--r-- | activesupport/test/core_ext/duration_test.rb | 1 |
2 files changed, 2 insertions, 0 deletions
diff --git a/activesupport/lib/active_support/duration.rb b/activesupport/lib/active_support/duration.rb index db5afb5324..cd0d66a482 100644 --- a/activesupport/lib/active_support/duration.rb +++ b/activesupport/lib/active_support/duration.rb @@ -38,6 +38,7 @@ module ActiveSupport def is_a?(klass) #:nodoc: Duration == klass || value.is_a?(klass) end + alias :kind_of? :is_a? # Returns true if <tt>other</tt> is also a Duration instance with the # same <tt>value</tt>, or if <tt>other == value</tt>. diff --git a/activesupport/test/core_ext/duration_test.rb b/activesupport/test/core_ext/duration_test.rb index 05f529dc7d..710c221fac 100644 --- a/activesupport/test/core_ext/duration_test.rb +++ b/activesupport/test/core_ext/duration_test.rb @@ -5,6 +5,7 @@ class DurationTest < ActiveSupport::TestCase def test_is_a d = 1.day assert d.is_a?(ActiveSupport::Duration) + assert_kind_of ActiveSupport::Duration, d assert_kind_of Numeric, d assert_kind_of Fixnum, d assert !d.is_a?(Hash) |