diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2007-12-15 02:27:11 +0000 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2007-12-15 02:27:11 +0000 |
commit | 3d90733e937d11b6905ff11ce006a591ec11b4f4 (patch) | |
tree | 4ea501853a55974e9627e30ee2042734a48e3271 /activesupport/lib/active_support/core_ext/range | |
parent | 8d8b573275495648a5bb423198be3575e476cfd1 (diff) | |
download | rails-3d90733e937d11b6905ff11ce006a591ec11b4f4.tar.gz rails-3d90733e937d11b6905ff11ce006a591ec11b4f4.tar.bz2 rails-3d90733e937d11b6905ff11ce006a591ec11b4f4.zip |
Ruby 1.9 compat: prefer builtin String#starts_ and ends_with? if available [chuyeow]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8397 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activesupport/lib/active_support/core_ext/range')
-rw-r--r-- | activesupport/lib/active_support/core_ext/range/conversions.rb | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/activesupport/lib/active_support/core_ext/range/conversions.rb b/activesupport/lib/active_support/core_ext/range/conversions.rb index 77e86a6ae6..3d12605f4d 100644 --- a/activesupport/lib/active_support/core_ext/range/conversions.rb +++ b/activesupport/lib/active_support/core_ext/range/conversions.rb @@ -1,9 +1,9 @@ module ActiveSupport #:nodoc: module CoreExtensions #:nodoc: module Range #:nodoc: - # Getting dates in different convenient string representations and other objects + # Getting ranges in different convenient string representations and other objects module Conversions - DATE_FORMATS = { + RANGE_FORMATS = { :db => Proc.new { |start, stop| "BETWEEN '#{start.to_s(:db)}' AND '#{stop.to_s(:db)}'" } } @@ -15,7 +15,7 @@ module ActiveSupport #:nodoc: end def to_formatted_s(format = :default) - DATE_FORMATS[format] ? DATE_FORMATS[format].call(first, last) : to_default_s + RANGE_FORMATS[format] ? RANGE_FORMATS[format].call(first, last) : to_default_s end end end |