lib/twitter/ext/stdlib.rb in twitter4r-0.2.3 vs lib/twitter/ext/stdlib.rb in twitter4r-0.2.4

- old
+ new

@@ -19,14 +19,18 @@ end # Extension to Time that outputs RFC2822 compliant string on #to_s class Time alias :old_to_s :to_s + # Returns RFC2822 compliant string for <tt>Time</tt> object. # For example, # # Tony Blair's last day in office (hopefully) # best_day_ever = Time.local(2007, 6, 27) # best_day_ever.to_s # => "Wed, 27 Jun 2007 00:00:00 +0100" - def to_s - self.rfc2822 + # You can also pass in an option <tt>format</tt> argument that + # corresponds to acceptable values according to ActiveSupport's + # +Time#to_formatted_s+ method. + def to_s(format = nil) + format ? self.to_formatted_s(format) : self.rfc2822 end end