aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/file_update_checker.rb
diff options
context:
space:
mode:
authorFrancesco Rodriguez <lrodriguezsanc@gmail.com>2012-09-17 00:22:18 -0500
committerFrancesco Rodriguez <lrodriguezsanc@gmail.com>2012-09-17 00:22:18 -0500
commitd71d5ba71fadf4219c466c0332f78f6e325bcc6c (patch)
tree24fc4e38ae693219946ad23df6adfe2294cd318f /activesupport/lib/active_support/file_update_checker.rb
parentc1c9f1c7b98eb219eda01f8ddaef7aa2ab710b9f (diff)
downloadrails-d71d5ba71fadf4219c466c0332f78f6e325bcc6c.tar.gz
rails-d71d5ba71fadf4219c466c0332f78f6e325bcc6c.tar.bz2
rails-d71d5ba71fadf4219c466c0332f78f6e325bcc6c.zip
update AS docs [ci skip]
Diffstat (limited to 'activesupport/lib/active_support/file_update_checker.rb')
-rw-r--r--activesupport/lib/active_support/file_update_checker.rb18
1 files changed, 8 insertions, 10 deletions
diff --git a/activesupport/lib/active_support/file_update_checker.rb b/activesupport/lib/active_support/file_update_checker.rb
index 1cc852a3e6..a6b9aa3503 100644
--- a/activesupport/lib/active_support/file_update_checker.rb
+++ b/activesupport/lib/active_support/file_update_checker.rb
@@ -1,23 +1,21 @@
module ActiveSupport
- # \FileUpdateChecker specifies the API used by Rails to watch files
+ # FileUpdateChecker specifies the API used by Rails to watch files
# and control reloading. The API depends on four methods:
#
# * +initialize+ which expects two parameters and one block as
- # described below;
+ # described below.
#
# * +updated?+ which returns a boolean if there were updates in
- # the filesystem or not;
+ # the filesystem or not.
#
# * +execute+ which executes the given block on initialization
- # and updates the latest watched files and timestamp;
+ # and updates the latest watched files and timestamp.
#
- # * +execute_if_updated+ which just executes the block if it was updated;
+ # * +execute_if_updated+ which just executes the block if it was updated.
#
# After initialization, a call to +execute_if_updated+ must execute
# the block only if there was really a change in the filesystem.
#
- # == Examples
- #
# This class is used by Rails to reload the I18n framework whenever
# they are changed upon a new request.
#
@@ -28,7 +26,6 @@ module ActiveSupport
# ActionDispatch::Reloader.to_prepare do
# i18n_reloader.execute_if_updated
# end
- #
class FileUpdateChecker
# It accepts two parameters on initialization. The first is an array
# of files and the second is an optional hash of directories. The hash must
@@ -52,7 +49,7 @@ module ActiveSupport
# Check if any of the entries were updated. If so, the watched and/or
# updated_at values are cached until the block is executed via +execute+
- # or +execute_if_updated+
+ # or +execute_if_updated+.
def updated?
current_watched = watched
if @last_watched.size != current_watched.size
@@ -70,7 +67,8 @@ module ActiveSupport
end
end
- # Executes the given block and updates the latest watched files and timestamp.
+ # Executes the given block and updates the latest watched files and
+ # timestamp.
def execute
@last_watched = watched
@last_update_at = updated_at(@last_watched)