aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2013-12-02 22:12:36 -0200
committerRafael Mendonça França <rafaelmfranca@gmail.com>2013-12-02 22:12:36 -0200
commitd3b93e403b3d0c11607e037770ad91c062b2e897 (patch)
tree1fe5f112d215cf72887835b6190f50400767e4dc /activesupport
parentfc73ebf332c4dbd36dcf7e7a39a0e120b7680bd2 (diff)
downloadrails-d3b93e403b3d0c11607e037770ad91c062b2e897.tar.gz
rails-d3b93e403b3d0c11607e037770ad91c062b2e897.tar.bz2
rails-d3b93e403b3d0c11607e037770ad91c062b2e897.zip
Make load of NumberHelper thread safe
Diffstat (limited to 'activesupport')
-rw-r--r--activesupport/lib/active_support.rb7
-rw-r--r--activesupport/lib/active_support/number_helper.rb18
-rw-r--r--activesupport/lib/active_support/number_helper/number_to_currency_converter.rb (renamed from activesupport/lib/active_support/number_helper/number_to_currency.rb)3
-rw-r--r--activesupport/lib/active_support/number_helper/number_to_delimited_converter.rb (renamed from activesupport/lib/active_support/number_helper/number_to_delimited.rb)2
-rw-r--r--activesupport/lib/active_support/number_helper/number_to_human_converter.rb (renamed from activesupport/lib/active_support/number_helper/number_to_human.rb)3
-rw-r--r--activesupport/lib/active_support/number_helper/number_to_human_size_converter.rb (renamed from activesupport/lib/active_support/number_helper/number_to_human_size.rb)3
-rw-r--r--activesupport/lib/active_support/number_helper/number_to_percentage_converter.rb (renamed from activesupport/lib/active_support/number_helper/number_to_percentage.rb)3
-rw-r--r--activesupport/lib/active_support/number_helper/number_to_phone_converter.rb (renamed from activesupport/lib/active_support/number_helper/number_to_phone.rb)3
-rw-r--r--activesupport/lib/active_support/number_helper/number_to_rounded_converter.rb (renamed from activesupport/lib/active_support/number_helper/number_to_rounded.rb)2
9 files changed, 18 insertions, 26 deletions
diff --git a/activesupport/lib/active_support.rb b/activesupport/lib/active_support.rb
index 5e1fe9e556..a40c6b559c 100644
--- a/activesupport/lib/active_support.rb
+++ b/activesupport/lib/active_support.rb
@@ -52,6 +52,7 @@ module ActiveSupport
autoload :MessageEncryptor
autoload :MessageVerifier
autoload :Multibyte
+ autoload :NumberHelper
autoload :OptionMerger
autoload :OrderedHash
autoload :OrderedOptions
@@ -63,6 +64,12 @@ module ActiveSupport
autoload :Rescuable
autoload :SafeBuffer, "active_support/core_ext/string/output_safety"
autoload :TestCase
+
+ def self.eager_load!
+ super
+
+ NumberHelper.eager_load!
+ end
end
autoload :I18n, "active_support/i18n"
diff --git a/activesupport/lib/active_support/number_helper.rb b/activesupport/lib/active_support/number_helper.rb
index 53f08efae5..2df1aada50 100644
--- a/activesupport/lib/active_support/number_helper.rb
+++ b/activesupport/lib/active_support/number_helper.rb
@@ -1,14 +1,18 @@
module ActiveSupport
module NumberHelper
+ extend ActiveSupport::Autoload
- autoload :NumberToRoundedConverter, "active_support/number_helper/number_to_rounded"
- autoload :NumberToDelimitedConverter, "active_support/number_helper/number_to_delimited"
- autoload :NumberToHumanConverter, "active_support/number_helper/number_to_human"
- autoload :NumberToHumanSizeConverter, "active_support/number_helper/number_to_human_size"
- autoload :NumberToPhoneConverter, "active_support/number_helper/number_to_phone"
- autoload :NumberToCurrencyConverter, "active_support/number_helper/number_to_currency"
- autoload :NumberToPercentageConverter, "active_support/number_helper/number_to_percentage"
+ eager_autoload do
+ autoload :NumberConverter
+ autoload :NumberToRoundedConverter
+ autoload :NumberToDelimitedConverter
+ autoload :NumberToHumanConverter
+ autoload :NumberToHumanSizeConverter
+ autoload :NumberToPhoneConverter
+ autoload :NumberToCurrencyConverter
+ autoload :NumberToPercentageConverter
+ end
extend self
diff --git a/activesupport/lib/active_support/number_helper/number_to_currency.rb b/activesupport/lib/active_support/number_helper/number_to_currency_converter.rb
index 402b0b56aa..113e557415 100644
--- a/activesupport/lib/active_support/number_helper/number_to_currency.rb
+++ b/activesupport/lib/active_support/number_helper/number_to_currency_converter.rb
@@ -1,6 +1,3 @@
-require 'active_support/number_helper/number_converter'
-require 'active_support/number_helper/number_to_rounded'
-
module ActiveSupport
module NumberHelper
class NumberToCurrencyConverter < NumberConverter # :nodoc:
diff --git a/activesupport/lib/active_support/number_helper/number_to_delimited.rb b/activesupport/lib/active_support/number_helper/number_to_delimited_converter.rb
index b543b0c19d..6604b9cce4 100644
--- a/activesupport/lib/active_support/number_helper/number_to_delimited.rb
+++ b/activesupport/lib/active_support/number_helper/number_to_delimited_converter.rb
@@ -1,5 +1,3 @@
-require 'active_support/number_helper/number_converter'
-
module ActiveSupport
module NumberHelper
class NumberToDelimitedConverter < NumberConverter #:nodoc:
diff --git a/activesupport/lib/active_support/number_helper/number_to_human.rb b/activesupport/lib/active_support/number_helper/number_to_human_converter.rb
index 70d669f175..3cdf6ff9f8 100644
--- a/activesupport/lib/active_support/number_helper/number_to_human.rb
+++ b/activesupport/lib/active_support/number_helper/number_to_human_converter.rb
@@ -1,6 +1,3 @@
-require 'active_support/number_helper/number_converter'
-require 'active_support/number_helper/number_to_rounded'
-
module ActiveSupport
module NumberHelper
class NumberToHumanConverter < NumberConverter # :nodoc:
diff --git a/activesupport/lib/active_support/number_helper/number_to_human_size.rb b/activesupport/lib/active_support/number_helper/number_to_human_size_converter.rb
index c0930564bc..6a0f6e70b7 100644
--- a/activesupport/lib/active_support/number_helper/number_to_human_size.rb
+++ b/activesupport/lib/active_support/number_helper/number_to_human_size_converter.rb
@@ -1,6 +1,3 @@
-require 'active_support/number_helper/number_converter'
-require 'active_support/number_helper/number_to_rounded'
-
module ActiveSupport
module NumberHelper
class NumberToHumanSizeConverter < NumberConverter
diff --git a/activesupport/lib/active_support/number_helper/number_to_percentage.rb b/activesupport/lib/active_support/number_helper/number_to_percentage_converter.rb
index 25e136be60..b7926cf151 100644
--- a/activesupport/lib/active_support/number_helper/number_to_percentage.rb
+++ b/activesupport/lib/active_support/number_helper/number_to_percentage_converter.rb
@@ -1,6 +1,3 @@
-require 'active_support/number_helper/number_converter'
-require 'active_support/number_helper/number_to_rounded'
-
module ActiveSupport
module NumberHelper
class NumberToPercentageConverter < NumberConverter # :nodoc:
diff --git a/activesupport/lib/active_support/number_helper/number_to_phone.rb b/activesupport/lib/active_support/number_helper/number_to_phone_converter.rb
index 171c2dff18..c4aa5c311a 100644
--- a/activesupport/lib/active_support/number_helper/number_to_phone.rb
+++ b/activesupport/lib/active_support/number_helper/number_to_phone_converter.rb
@@ -1,6 +1,3 @@
-require 'active_support/number_helper/number_converter'
-require 'active_support/number_helper/number_to_rounded'
-
module ActiveSupport
module NumberHelper
class NumberToPhoneConverter < NumberConverter
diff --git a/activesupport/lib/active_support/number_helper/number_to_rounded.rb b/activesupport/lib/active_support/number_helper/number_to_rounded_converter.rb
index 817ac1ebb2..355c810dc9 100644
--- a/activesupport/lib/active_support/number_helper/number_to_rounded.rb
+++ b/activesupport/lib/active_support/number_helper/number_to_rounded_converter.rb
@@ -1,5 +1,3 @@
-require 'active_support/number_helper/number_converter'
-
module ActiveSupport
module NumberHelper
class NumberToRoundedConverter < NumberConverter # :nodoc: