diff options
Diffstat (limited to 'activesupport/lib')
8 files changed, 23 insertions, 20 deletions
diff --git a/activesupport/lib/active_support/cache.rb b/activesupport/lib/active_support/cache.rb index fdef9cbfc0..625be2c959 100644 --- a/activesupport/lib/active_support/cache.rb +++ b/activesupport/lib/active_support/cache.rb @@ -353,8 +353,11 @@ module ActiveSupport # Returns a hash with the data for each of the names. For example: # # cache.write("bim", "bam") - # cache.fetch_multi("bim", "boom") { |key| key * 2 } - # # => { "bam" => "bam", "boom" => "boomboom" } + # cache.fetch_multi("bim", "unknown_key") do |key| + # "Fallback value for key: #{key}" + # end + # # => { "bim" => "bam", + # # "unknown_key" => "Fallback value for key: unknown_key" } # def fetch_multi(*names) options = names.extract_options! @@ -565,7 +568,7 @@ module ActiveSupport race_ttl = options[:race_condition_ttl].to_i if race_ttl && (Time.now.to_f - entry.expires_at <= race_ttl) # When an entry has :race_condition_ttl defined, put the stale entry back into the cache - # for a brief period while the entry is begin recalculated. + # for a brief period while the entry is being recalculated. entry.expires_at = Time.now + race_ttl write_entry(key, entry, :expires_in => race_ttl * 2) else diff --git a/activesupport/lib/active_support/cache/strategy/local_cache.rb b/activesupport/lib/active_support/cache/strategy/local_cache.rb index 73c6b3cb88..a913736fc3 100644 --- a/activesupport/lib/active_support/cache/strategy/local_cache.rb +++ b/activesupport/lib/active_support/cache/strategy/local_cache.rb @@ -39,7 +39,7 @@ module ActiveSupport @data = {} end - # Don't allow synchronizing since it isn't thread safe, + # Don't allow synchronizing since it isn't thread safe. def synchronize # :nodoc: yield end diff --git a/activesupport/lib/active_support/core_ext/module/remove_method.rb b/activesupport/lib/active_support/core_ext/module/remove_method.rb index 8a2569a7d0..52632d2c6b 100644 --- a/activesupport/lib/active_support/core_ext/module/remove_method.rb +++ b/activesupport/lib/active_support/core_ext/module/remove_method.rb @@ -1,13 +1,13 @@ class Module - # Remove the named method, if it exists. + # Removes the named method, if it exists. def remove_possible_method(method) if method_defined?(method) || private_method_defined?(method) undef_method(method) end end - # Replace the existing method definition, if there is one, with the contents - # of the block. + # Replaces the existing method definition, if there is one, with the passed + # block as its body. def redefine_method(method, &block) remove_possible_method(method) define_method(method, &block) diff --git a/activesupport/lib/active_support/number_helper.rb b/activesupport/lib/active_support/number_helper.rb index cfca42bc69..258d9b34e1 100644 --- a/activesupport/lib/active_support/number_helper.rb +++ b/activesupport/lib/active_support/number_helper.rb @@ -95,8 +95,8 @@ module ActiveSupport # (defaults to current locale). # * <tt>:precision</tt> - Sets the precision of the number # (defaults to 3). Keeps the number's precision if nil. - # * <tt>:significant</tt> - If +true+, precision will be the # - # of significant_digits. If +false+, the # of fractional + # * <tt>:significant</tt> - If +true+, precision will be the number + # of significant_digits. If +false+, the number of fractional # digits (defaults to +false+). # * <tt>:separator</tt> - Sets the separator between the # fractional and integer digits (defaults to "."). @@ -163,8 +163,8 @@ module ActiveSupport # (defaults to current locale). # * <tt>:precision</tt> - Sets the precision of the number # (defaults to 3). Keeps the number's precision if nil. - # * <tt>:significant</tt> - If +true+, precision will be the # - # of significant_digits. If +false+, the # of fractional + # * <tt>:significant</tt> - If +true+, precision will be the number + # of significant_digits. If +false+, the number of fractional # digits (defaults to +false+). # * <tt>:separator</tt> - Sets the separator between the # fractional and integer digits (defaults to "."). @@ -210,8 +210,8 @@ module ActiveSupport # (defaults to current locale). # * <tt>:precision</tt> - Sets the precision of the number # (defaults to 3). - # * <tt>:significant</tt> - If +true+, precision will be the # - # of significant_digits. If +false+, the # of fractional + # * <tt>:significant</tt> - If +true+, precision will be the number + # of significant_digits. If +false+, the number of fractional # digits (defaults to +true+) # * <tt>:separator</tt> - Sets the separator between the # fractional and integer digits (defaults to "."). @@ -260,8 +260,8 @@ module ActiveSupport # (defaults to current locale). # * <tt>:precision</tt> - Sets the precision of the number # (defaults to 3). - # * <tt>:significant</tt> - If +true+, precision will be the # - # of significant_digits. If +false+, the # of fractional + # * <tt>:significant</tt> - If +true+, precision will be the number + # of significant_digits. If +false+, the number of fractional # digits (defaults to +true+) # * <tt>:separator</tt> - Sets the separator between the # fractional and integer digits (defaults to "."). diff --git a/activesupport/lib/active_support/number_helper/number_to_currency_converter.rb b/activesupport/lib/active_support/number_helper/number_to_currency_converter.rb index fb5adb574a..ce03700de1 100644 --- a/activesupport/lib/active_support/number_helper/number_to_currency_converter.rb +++ b/activesupport/lib/active_support/number_helper/number_to_currency_converter.rb @@ -29,14 +29,14 @@ module ActiveSupport def options @options ||= begin defaults = default_format_options.merge(i18n_opts) - # Override negative format if format options is given + # Override negative format if format options are given defaults[:negative_format] = "-#{opts[:format]}" if opts[:format] defaults.merge!(opts) end end def i18n_opts - # Set International negative format if not exists + # Set International negative format if it does not exist i18n = i18n_format_options i18n[:negative_format] ||= "-#{i18n[:format]}" if i18n[:format] i18n diff --git a/activesupport/lib/active_support/string_inquirer.rb b/activesupport/lib/active_support/string_inquirer.rb index 45271c9163..bc673150d0 100644 --- a/activesupport/lib/active_support/string_inquirer.rb +++ b/activesupport/lib/active_support/string_inquirer.rb @@ -1,7 +1,7 @@ module ActiveSupport # Wrapping a string in this class gives you a prettier way to test # for equality. The value returned by <tt>Rails.env</tt> is wrapped - # in a StringInquirer object so instead of calling this: + # in a StringInquirer object, so instead of calling this: # # Rails.env == 'production' # diff --git a/activesupport/lib/active_support/tagged_logging.rb b/activesupport/lib/active_support/tagged_logging.rb index 9086a959aa..bcd7bf74c0 100644 --- a/activesupport/lib/active_support/tagged_logging.rb +++ b/activesupport/lib/active_support/tagged_logging.rb @@ -43,7 +43,7 @@ module ActiveSupport end def current_tags - # We use our object ID here to void conflicting with other instances + # We use our object ID here to avoid conflicting with other instances thread_key = @thread_key ||= "activesupport_tagged_logging_tags:#{object_id}".freeze Thread.current[thread_key] ||= [] end diff --git a/activesupport/lib/active_support/time_with_zone.rb b/activesupport/lib/active_support/time_with_zone.rb index 8ddf233b3e..c28de4e21c 100644 --- a/activesupport/lib/active_support/time_with_zone.rb +++ b/activesupport/lib/active_support/time_with_zone.rb @@ -252,7 +252,7 @@ module ActiveSupport utc.hash end - # Adds an interval of time to the current object's time and return that + # Adds an interval of time to the current object's time and returns that # value as a new TimeWithZone object. # # Time.zone = 'Eastern Time (US & Canada)' # => 'Eastern Time (US & Canada)' |