aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/core_ext/time/conversions.rb
diff options
context:
space:
mode:
authorAlexey Gaziev <alex.gaziev@gmail.com>2012-04-26 17:20:36 +0400
committerAlexey Gaziev <alex.gaziev@gmail.com>2012-04-29 03:09:44 +0400
commit1946d7b9229fabb52226f9ff82de72872c748d90 (patch)
tree9d45b28547accec3c53d177fd0a6b727afb1be18 /activesupport/lib/active_support/core_ext/time/conversions.rb
parent242f4d1ebadd0cff83c10270aecd56752b9befc5 (diff)
downloadrails-1946d7b9229fabb52226f9ff82de72872c748d90.tar.gz
rails-1946d7b9229fabb52226f9ff82de72872c748d90.tar.bz2
rails-1946d7b9229fabb52226f9ff82de72872c748d90.zip
AS core_ext refactoring
Diffstat (limited to 'activesupport/lib/active_support/core_ext/time/conversions.rb')
-rw-r--r--activesupport/lib/active_support/core_ext/time/conversions.rb10
1 files changed, 8 insertions, 2 deletions
diff --git a/activesupport/lib/active_support/core_ext/time/conversions.rb b/activesupport/lib/active_support/core_ext/time/conversions.rb
index 0fdcd383f0..f7e237912f 100644
--- a/activesupport/lib/active_support/core_ext/time/conversions.rb
+++ b/activesupport/lib/active_support/core_ext/time/conversions.rb
@@ -8,8 +8,14 @@ class Time
:time => "%H:%M",
:short => "%d %b %H:%M",
:long => "%B %d, %Y %H:%M",
- :long_ordinal => lambda { |time| time.strftime("%B #{ActiveSupport::Inflector.ordinalize(time.day)}, %Y %H:%M") },
- :rfc822 => lambda { |time| time.strftime("%a, %d %b %Y %H:%M:%S #{time.formatted_offset(false)}") }
+ :long_ordinal => lambda { |time|
+ day_format = ActiveSupport::Inflector.ordinalize(time.day)
+ time.strftime("%B #{day_format}, %Y %H:%M")
+ },
+ :rfc822 => lambda { |time|
+ offset_format = time.formatted_offset(false)
+ time.strftime("%a, %d %b %Y %H:%M:%S #{offset_format}")
+ }
}
# Converts to a formatted string. See DATE_FORMATS for builtin formats.