From 8c110387f442aeaf19357f44fb20c2464a4f2754 Mon Sep 17 00:00:00 2001 From: Ray Baxter Date: Sun, 26 Jun 2011 15:16:29 -0700 Subject: correct error message for failed creation --- activesupport/lib/active_support/testing/assertions.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'activesupport') diff --git a/activesupport/lib/active_support/testing/assertions.rb b/activesupport/lib/active_support/testing/assertions.rb index 05da50e150..3864b1f5a6 100644 --- a/activesupport/lib/active_support/testing/assertions.rb +++ b/activesupport/lib/active_support/testing/assertions.rb @@ -68,7 +68,7 @@ module ActiveSupport # # A error message can be specified. # - # assert_no_difference 'Article.count', "An Article should not be destroyed" do + # assert_no_difference 'Article.count', "An Article should not be created" do # post :create, :article => invalid_attributes # end def assert_no_difference(expression, message = nil, &block) -- cgit v1.2.3 From 894cca5cc5dc3ad8a8285f7a3b8e16e70484d9cd Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Fri, 1 Jul 2011 10:05:45 -0400 Subject: general formatting cleanup, and clarify that passing true as third option for benchmarking will stop output OTHER THAN the timing output itself --- activesupport/lib/active_support/benchmarkable.rb | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'activesupport') diff --git a/activesupport/lib/active_support/benchmarkable.rb b/activesupport/lib/active_support/benchmarkable.rb index e303eaa5ce..cc94041a1d 100644 --- a/activesupport/lib/active_support/benchmarkable.rb +++ b/activesupport/lib/active_support/benchmarkable.rb @@ -3,28 +3,28 @@ require 'active_support/core_ext/hash/keys' module ActiveSupport module Benchmarkable - # Allows you to measure the execution time of a block - # in a template and records the result to the log. Wrap this block around - # expensive operations or possible bottlenecks to get a time reading - # for the operation. For example, let's say you thought your file - # processing method was taking too long; you could wrap it in a benchmark block. + # Allows you to measure the execution time of a block in a template and records the result to + # the log. Wrap this block around expensive operations or possible bottlenecks to get a time + # reading for the operation. For example, let's say you thought your file processing method + # was taking too long; you could wrap it in a benchmark block. # # <% benchmark "Process data files" do %> # <%= expensive_files_operation %> # <% end %> # - # That would add something like "Process data files (345.2ms)" to the log, - # which you can then use to compare timings when optimizing your code. + # That would add something like "Process data files (345.2ms)" to the log, which you can then + # use to compare timings when optimizing your code. # - # You may give an optional logger level as the :level option. - # (:debug, :info, :warn, :error); the default value is :info. + # You may give an optional logger level (:debug, :info, :warn, :error) as the :level option. + # The default logger level value is :info. # # <% benchmark "Low-level files", :level => :debug do %> # <%= lowlevel_files_operation %> # <% end %> # - # Finally, you can pass true as the third argument to silence all log activity - # inside the block. This is great for boiling down a noisy block to just a single statement: + # Finally, you can pass true as the third argument to silence all log activity (other than the + # timing information) from inside the block. This is great for boiling down a noisy block to + # just a single statement that produces one log line: # # <% benchmark "Process data files", :level => :info, :silence => true do %> # <%= expensive_and_chatty_files_operation %> -- cgit v1.2.3 From 7896ac35c06be7ccc3372ec0db638b54c963f842 Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Fri, 1 Jul 2011 10:18:23 -0400 Subject: general grammar cleanup of cache docs --- activesupport/lib/active_support/cache.rb | 50 ++++++++++++++++--------------- 1 file changed, 26 insertions(+), 24 deletions(-) (limited to 'activesupport') diff --git a/activesupport/lib/active_support/cache.rb b/activesupport/lib/active_support/cache.rb index 10c457bb1d..2eeace963e 100644 --- a/activesupport/lib/active_support/cache.rb +++ b/activesupport/lib/active_support/cache.rb @@ -116,31 +116,32 @@ module ActiveSupport # cache.read("city") # => "Duckburgh" # # Keys are always translated into Strings and are case sensitive. When an - # object is specified as a key, its +cache_key+ method will be called if it - # is defined. Otherwise, the +to_param+ method will be called. Hashes and - # Arrays can be used as keys. The elements will be delimited by slashes - # and Hashes elements will be sorted by key so they are consistent. + # object is specified as a key and has a +cache_key+ method defined, this + # method will will be called to define the key. Otherwise, the +to_param+ + # method will be called. Hashes and Arrays can also be used as keys. The + # elements will be delimited by slashes, and the elements within a Hash + # will be sorted by key so they are consistent. # # cache.read("city") == cache.read(:city) # => true # # Nil values can be cached. # - # If your cache is on a shared infrastructure, you can define a namespace for - # your cache entries. If a namespace is defined, it will be prefixed on to every - # key. The namespace can be either a static value or a Proc. If it is a Proc, it - # will be invoked when each key is evaluated so that you can use application logic - # to invalidate keys. + # If your cache is on a shared infrastructure, you can define a namespace + # for your cache entries. If a namespace is defined, it will be prefixed on + # to every key. The namespace can be either a static value or a Proc. If it + # is a Proc, it will be invoked when each key is evaluated so that you can + # use application logic to invalidate keys. # # cache.namespace = lambda { @last_mod_time } # Set the namespace to a variable # @last_mod_time = Time.now # Invalidate the entire cache by changing namespace # # - # Caches can also store values in a compressed format to save space and reduce - # time spent sending data. Since there is some overhead, values must be large - # enough to warrant compression. To turn on compression either pass - # :compress => true in the initializer or to +fetch+ or +write+. - # To specify the threshold at which to compress values, set - # :compress_threshold. The default threshold is 32K. + # Caches can also store values in a compressed format to save space and + # reduce time spent sending data. Since there is overhead, values must be + # large enough to warrant compression. To turn on compression either pass + # :compress => true in the initializer or as an option to +fetch+ + # or +write+. To specify the threshold at which to compress values, set the + # :compress_threshold option. The default threshold is 32K. class Store cattr_accessor :logger, :instance_writer => true @@ -180,11 +181,11 @@ module ActiveSupport # Fetches data from the cache, using the given key. If there is data in # the cache with the given key, then that data is returned. # - # If there is no such data in the cache (a cache miss occurred), - # then nil will be returned. However, if a block has been passed, then - # that block will be run in the event of a cache miss. The return value - # of the block will be written to the cache under the given cache key, - # and that return value will be returned. + # If there is no such data in the cache (a cache miss), then nil will be + # returned. However, if a block has been passed, that block will be run + # in the event of a cache miss. The return value of the block will be + # written to the cache under the given cache key, and that return value + # will be returned. # # cache.write("today", "Monday") # cache.fetch("today") # => "Monday" @@ -205,10 +206,11 @@ module ActiveSupport # in a compressed format. # # - # Setting :expires_in will set an expiration time on the cache. All caches - # support auto expiring content after a specified number of seconds. This value can - # be specified as an option to the construction in which call all entries will be - # affected. Or it can be supplied to the +fetch+ or +write+ method for just one entry. + # Setting :expires_in will set an expiration time on the cache. + # All caches support auto-expiring content after a specified number of + # seconds. This value can be specified as an option to the constructor + # (in which case all entries will be affected), or it can be supplied to + # the +fetch+ or +write+ method to effect just one entry. # # cache = ActiveSupport::Cache::MemoryStore.new(:expires_in => 5.minutes) # cache.write(key, value, :expires_in => 1.minute) # Set a lower value for one entry -- cgit v1.2.3 From caab9f4e95bff87c3208084271d70583bc31930e Mon Sep 17 00:00:00 2001 From: Vijay Dev Date: Sun, 3 Jul 2011 18:15:47 +0530 Subject: document meta methods --- .../lib/active_support/core_ext/string/output_safety.rb | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'activesupport') diff --git a/activesupport/lib/active_support/core_ext/string/output_safety.rb b/activesupport/lib/active_support/core_ext/string/output_safety.rb index a19b5c95c7..07cb2187e3 100644 --- a/activesupport/lib/active_support/core_ext/string/output_safety.rb +++ b/activesupport/lib/active_support/core_ext/string/output_safety.rb @@ -137,14 +137,14 @@ module ActiveSupport #:nodoc: UNSAFE_STRING_METHODS.each do |unsafe_method| class_eval <<-EOT, __FILE__, __LINE__ - def #{unsafe_method}(*args, &block) - to_str.#{unsafe_method}(*args, &block) - end - - def #{unsafe_method}!(*args) - @dirty = true - super - end + def #{unsafe_method}(*args, &block) # def gsub(*args, &block) + to_str.#{unsafe_method}(*args, &block) # to_str.gsub(*args, &block) + end # end + + def #{unsafe_method}!(*args) # def gsub!(*args) + @dirty = true # @dirty = true + super # super + end # end EOT end -- cgit v1.2.3 From 254a1e57d79143f21af74e1aa289ba546b3be821 Mon Sep 17 00:00:00 2001 From: Vijay Dev Date: Tue, 5 Jul 2011 00:10:59 +0530 Subject: minor edit in 7896ac3 --- activesupport/lib/active_support/cache.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'activesupport') diff --git a/activesupport/lib/active_support/cache.rb b/activesupport/lib/active_support/cache.rb index 2eeace963e..85692428e3 100644 --- a/activesupport/lib/active_support/cache.rb +++ b/activesupport/lib/active_support/cache.rb @@ -117,7 +117,7 @@ module ActiveSupport # # Keys are always translated into Strings and are case sensitive. When an # object is specified as a key and has a +cache_key+ method defined, this - # method will will be called to define the key. Otherwise, the +to_param+ + # method will be called to define the key. Otherwise, the +to_param+ # method will be called. Hashes and Arrays can also be used as keys. The # elements will be delimited by slashes, and the elements within a Hash # will be sorted by key so they are consistent. -- cgit v1.2.3