aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support
diff options
context:
space:
mode:
authorPratik Naik <pratiknaik@gmail.com>2008-09-05 21:32:38 +0100
committerPratik Naik <pratiknaik@gmail.com>2008-09-05 21:32:38 +0100
commit1990f815bc624a95d447cdb7de3e0f42bcd81db9 (patch)
tree12e2de8dd4389507b6293f985dfc150230a26b31 /activesupport/lib/active_support
parentaf04ea87de993a1aeeaba9460cf1ce32f556fb91 (diff)
parent227ee2ecb46f1609938a83ed82abde1a45ebe2eb (diff)
downloadrails-1990f815bc624a95d447cdb7de3e0f42bcd81db9.tar.gz
rails-1990f815bc624a95d447cdb7de3e0f42bcd81db9.tar.bz2
rails-1990f815bc624a95d447cdb7de3e0f42bcd81db9.zip
Merge commit 'mainstream/master'
Diffstat (limited to 'activesupport/lib/active_support')
-rw-r--r--activesupport/lib/active_support/cache.rb2
-rw-r--r--activesupport/lib/active_support/core_ext/time.rb2
-rw-r--r--activesupport/lib/active_support/vendor/i18n-0.0.1/i18n/backend/simple.rb9
3 files changed, 9 insertions, 4 deletions
diff --git a/activesupport/lib/active_support/cache.rb b/activesupport/lib/active_support/cache.rb
index 95eae3a77e..51a6309dce 100644
--- a/activesupport/lib/active_support/cache.rb
+++ b/activesupport/lib/active_support/cache.rb
@@ -62,7 +62,7 @@ module ActiveSupport
write(key, value, options)
@logger_off = false
- log("write (will save #{'%.5f' % seconds})", key, nil)
+ log("write (will save #{'%.2f' % (seconds * 1000)}ms)", key, nil)
value
end
diff --git a/activesupport/lib/active_support/core_ext/time.rb b/activesupport/lib/active_support/core_ext/time.rb
index 2006cf4946..78bbfc917c 100644
--- a/activesupport/lib/active_support/core_ext/time.rb
+++ b/activesupport/lib/active_support/core_ext/time.rb
@@ -15,7 +15,7 @@ class Time
alias_method :_original_load, :_load
def _load(marshaled_time)
time = _original_load(marshaled_time)
- utc = time.send(:remove_instance_variable, '@marshal_with_utc_coercion')
+ utc = time.instance_variable_get('@marshal_with_utc_coercion')
utc ? time.utc : time
end
end
diff --git a/activesupport/lib/active_support/vendor/i18n-0.0.1/i18n/backend/simple.rb b/activesupport/lib/active_support/vendor/i18n-0.0.1/i18n/backend/simple.rb
index da89b30c54..e2d19cdd45 100644
--- a/activesupport/lib/active_support/vendor/i18n-0.0.1/i18n/backend/simple.rb
+++ b/activesupport/lib/active_support/vendor/i18n-0.0.1/i18n/backend/simple.rb
@@ -4,6 +4,7 @@ module I18n
module Backend
class Simple
INTERPOLATION_RESERVED_KEYS = %w(scope default)
+ DEPRECATED_INTERPOLATORS = { '%d' => '{{count}}', '%s' => '{{value}}' }
MATCH = /(\\\\)?\{\{([^\}]+)\}\}/
# Accepts a list of paths to translation files. Loads translations from
@@ -107,7 +108,7 @@ module I18n
raise InvalidPluralizationData.new(entry, count) unless entry.has_key?(key)
entry[key]
end
-
+
# Interpolates values into a given string.
#
# interpolate "file {{file}} opened by \\{{user}}", :file => 'test.txt', :user => 'Mr. X'
@@ -119,7 +120,11 @@ module I18n
def interpolate(locale, string, values = {})
return string unless string.is_a?(String)
- string = string.gsub(/%d/, '{{count}}').gsub(/%s/, '{{value}}')
+ string = string.gsub(/%d|%s/) do |s|
+ instead = DEPRECATED_INTERPOLATORS[s]
+ ActiveSupport::Deprecation.warn "using #{s} in messages is deprecated; use #{instead} instead."
+ instead
+ end
if string.respond_to?(:force_encoding)
original_encoding = string.encoding