lib/time_crisis/support/ext/time/conversions.rb in time_crisis-0.3.1 vs lib/time_crisis/support/ext/time/conversions.rb in time_crisis-0.3.2

- old
+ new

@@ -8,10 +8,15 @@ :time => "%H:%M", :short => "%d %b %H:%M", :long => "%B %d, %Y %H:%M", :rfc822 => lambda { |time| time.strftime("%a, %d %b %Y %H:%M:%S #{time.formatted_offset(false)}") } } + + if instance_methods.include?('to_default_s') + undef_method :to_s + alias_method :to_s, :to_default_s + end def to_formatted_s(format = :default) if formatter = DATE_FORMATS[format] formatter.respond_to?(:call) ? formatter.call(self).to_s : strftime(formatter) else @@ -21,9 +26,14 @@ alias_method :to_default_s, :to_s alias_method :to_s, :to_formatted_s def formatted_offset(colon = true, alternate_utc_string = nil) utc? && alternate_utc_string || TimeCrisis::TimeZone.seconds_to_utc_offset(utc_offset, colon) + end + + if instance_methods.include?('default_inspect') + undef_method :inspect + alias_method :inspect, :default_inspect end def readable_inspect "#<TimeCrisis::Time #{self.to_s(:rfc822)}>" end \ No newline at end of file