1
0
Fork 0
mirror of https://github.com/awesome-print/awesome_print synced 2023-03-27 23:22:34 -04:00

Bring back compatibility with old ActiveSupport versions without TimeWithZone defined

(cherry picked from commit dfb2cdd485)
This commit is contained in:
Thibaut Barrère 2012-01-07 21:20:32 +01:00 committed by Mike Dvorkin
parent 23b9ad9122
commit 2960784d81

View file

@ -14,7 +14,7 @@ module AwesomePrint
def cast_with_active_support(object, type) def cast_with_active_support(object, type)
cast = cast_without_active_support(object, type) cast = cast_without_active_support(object, type)
if defined?(::ActiveSupport) && defined?(::HashWithIndifferentAccess) if defined?(::ActiveSupport) && defined?(::HashWithIndifferentAccess)
if object.is_a?(::ActiveSupport::TimeWithZone) || object.is_a?(::Date) if (defined?(::ActiveSupport::TimeWithZone) && object.is_a?(::ActiveSupport::TimeWithZone)) || object.is_a?(::Date)
cast = :active_support_time cast = :active_support_time
elsif object.is_a?(::HashWithIndifferentAccess) elsif object.is_a?(::HashWithIndifferentAccess)
cast = :hash_with_indifferent_access cast = :hash_with_indifferent_access