Skip to content
Browse files

1.day should respond_to kind_of too

[#4656 state:resolved]

Signed-off-by: José Valim <jose.valim@gmail.com>
  • Loading branch information...
1 parent 1bc6b43 commit cc45a1068f7920454d6d3a1cdabf844f17417908 Neeraj Singh committed with josevalim May 19, 2010
Showing with 2 additions and 0 deletions.
  1. +1 −0 activesupport/lib/active_support/duration.rb
  2. +1 −0 activesupport/test/core_ext/duration_test.rb
View
1 activesupport/lib/active_support/duration.rb
@@ -38,6 +38,7 @@ def -@ #:nodoc:
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>.
View
1 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)

0 comments on commit cc45a10

Please sign in to comment.
Something went wrong with that request. Please try again.