Permalink
Browse files

Duck typing here

  • Loading branch information...
1 parent 5dc7f34 commit 2651a87a33981953e2f7966c69dc87e370a7ff11 @spastorino spastorino committed Nov 11, 2010
Showing with 1 addition and 1 deletion.
  1. +1 −1 activesupport/lib/active_support/time_with_zone.rb
View
2 activesupport/lib/active_support/time_with_zone.rb
@@ -73,7 +73,7 @@ def in_time_zone(new_zone = ::Time.zone)
# Returns a <tt>Time.local()</tt> instance of the simultaneous time in your system's <tt>ENV['TZ']</tt> zone
def localtime
- utc.is_a?(DateTime) ? utc.to_time.getlocal : utc.getlocal
+ utc.respond_to?(:getlocal) ? utc.getlocal : utc.to_time.getlocal
end
alias_method :getlocal, :localtime

0 comments on commit 2651a87

Please sign in to comment.