aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport
diff options
context:
space:
mode:
authorVijay Dev <vijaydev.cse@gmail.com>2014-04-18 21:59:44 +0530
committerVijay Dev <vijaydev.cse@gmail.com>2014-04-18 21:59:44 +0530
commitc2fa85f48124fe69a420139360d1369016296e62 (patch)
tree12d33a7e60694eb2a054ff292d852b3e529e95f1 /activesupport
parent2ff138be2c9b315d3f07ed82c91f179b62531783 (diff)
parente50719332e691c97aaae8d3103407d6db2a789ee (diff)
downloadrails-c2fa85f48124fe69a420139360d1369016296e62.tar.gz
rails-c2fa85f48124fe69a420139360d1369016296e62.tar.bz2
rails-c2fa85f48124fe69a420139360d1369016296e62.zip
Merge branch 'master' of github.com:rails/docrails
Diffstat (limited to 'activesupport')
-rw-r--r--activesupport/lib/active_support/core_ext/load_error.rb5
-rw-r--r--activesupport/lib/active_support/core_ext/thread.rb7
2 files changed, 11 insertions, 1 deletions
diff --git a/activesupport/lib/active_support/core_ext/load_error.rb b/activesupport/lib/active_support/core_ext/load_error.rb
index fe24f3716d..768b980f21 100644
--- a/activesupport/lib/active_support/core_ext/load_error.rb
+++ b/activesupport/lib/active_support/core_ext/load_error.rb
@@ -7,6 +7,7 @@ class LoadError
]
unless method_defined?(:path)
+ # Returns the path which was unable to be loaded.
def path
@path ||= begin
REGEXPS.find do |regex|
@@ -17,9 +18,11 @@ class LoadError
end
end
+ # Returns true if the given path name (except perhaps for the ".rb"
+ # extension) is the missing file which caused the exception to be raised.
def is_missing?(location)
location.sub(/\.rb$/, '') == path.sub(/\.rb$/, '')
end
end
-MissingSourceFile = LoadError \ No newline at end of file
+MissingSourceFile = LoadError
diff --git a/activesupport/lib/active_support/core_ext/thread.rb b/activesupport/lib/active_support/core_ext/thread.rb
index ac1ffa4128..4cd6634558 100644
--- a/activesupport/lib/active_support/core_ext/thread.rb
+++ b/activesupport/lib/active_support/core_ext/thread.rb
@@ -62,6 +62,13 @@ class Thread
_locals.has_key?(key.to_sym)
end
+ # Freezes the thread so that thread local variables cannot be set via
+ # Thread#thread_variable_set, nor can fiber local variables be set.
+ #
+ # me = Thread.current
+ # me.freeze
+ # me.thread_variable_set(:oliver, "a") #=> RuntimeError: can't modify frozen thread locals
+ # me[:oliver] = "a" #=> RuntimeError: can't modify frozen thread locals
def freeze
_locals.freeze
super