module AmazingPrint::ActiveSupport
def self.included(base)
def self.included(base) base.send :alias_method, :cast_without_active_support, :cast base.send :alias_method, :cast, :cast_with_active_support end
def awesome_active_support_time(object)
Format ActiveSupport::TimeWithZone as standard Time.
def awesome_active_support_time(object) colorize(object.inspect, :time) end
def awesome_hash_with_indifferent_access(object)
Format HashWithIndifferentAccess as standard Hash.
def awesome_hash_with_indifferent_access(object) awesome_hash(object) end
def cast_with_active_support(object, type)
def cast_with_active_support(object, type) cast = cast_without_active_support(object, type) if defined?(::ActiveSupport) && defined?(::HashWithIndifferentAccess) if (defined?(::ActiveSupport::TimeWithZone) && object.is_a?(::ActiveSupport::TimeWithZone)) || object.is_a?(::Date) cast = :active_support_time elsif object.is_a?(::HashWithIndifferentAccess) cast = :hash_with_indifferent_access end end cast end