Skip to content

Commit

Permalink
1.day should respond_to kind_of too
Browse files Browse the repository at this point in the history
[#4656 state:resolved]

Signed-off-by: José Valim <jose.valim@gmail.com>
  • Loading branch information
Neeraj Singh authored and josevalim committed May 21, 2010
1 parent 1bc6b43 commit cc45a10
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions activesupport/lib/active_support/duration.rb
Expand Up @@ -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>.
Expand Down
1 change: 1 addition & 0 deletions activesupport/test/core_ext/duration_test.rb
Expand Up @@ -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)
Expand Down

0 comments on commit cc45a10

Please sign in to comment.