aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport
diff options
context:
space:
mode:
authorPratik Naik <pratiknaik@gmail.com>2008-07-16 13:00:36 +0100
committerPratik Naik <pratiknaik@gmail.com>2008-07-16 13:01:23 +0100
commit0432d151647f2178ddee79979827d552447c251f (patch)
tree7c772cd260eb051cd7b80cf91468555f03db9e11 /activesupport
parentf7d08acd5e0650658383e3d3f86d6ff5b49e9030 (diff)
downloadrails-0432d151647f2178ddee79979827d552447c251f.tar.gz
rails-0432d151647f2178ddee79979827d552447c251f.tar.bz2
rails-0432d151647f2178ddee79979827d552447c251f.zip
Merge with docrails.
Diffstat (limited to 'activesupport')
-rw-r--r--activesupport/lib/active_support/core_ext/bigdecimal/conversions.rb2
-rw-r--r--activesupport/lib/active_support/core_ext/hash/except.rb2
-rw-r--r--activesupport/lib/active_support/core_ext/hash/reverse_merge.rb17
-rw-r--r--activesupport/lib/active_support/core_ext/string/inflections.rb4
-rw-r--r--activesupport/lib/active_support/core_ext/time/calculations.rb2
-rw-r--r--activesupport/lib/active_support/json.rb2
-rw-r--r--activesupport/lib/active_support/json/encoders/date.rb11
-rw-r--r--activesupport/lib/active_support/json/encoders/date_time.rb11
-rw-r--r--activesupport/lib/active_support/json/encoders/time.rb13
-rw-r--r--activesupport/lib/active_support/time_with_zone.rb14
-rw-r--r--activesupport/lib/active_support/vendor/builder-2.1.2/builder/xmlevents.rb2
-rw-r--r--activesupport/lib/active_support/vendor/memcache-client-1.5.0/memcache.rb4
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.9/tzinfo/data_timezone.rb2
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.9/tzinfo/data_timezone_info.rb2
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.9/tzinfo/linked_timezone.rb2
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.9/tzinfo/timezone.rb2
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.9/tzinfo/timezone_transition_info.rb2
-rw-r--r--activesupport/lib/active_support/vendor/xml-simple-1.0.11/xmlsimple.rb6
18 files changed, 70 insertions, 30 deletions
diff --git a/activesupport/lib/active_support/core_ext/bigdecimal/conversions.rb b/activesupport/lib/active_support/core_ext/bigdecimal/conversions.rb
index d2b01b1b8d..94c7c779f7 100644
--- a/activesupport/lib/active_support/core_ext/bigdecimal/conversions.rb
+++ b/activesupport/lib/active_support/core_ext/bigdecimal/conversions.rb
@@ -21,7 +21,7 @@ module ActiveSupport #:nodoc:
# This emits the number without any scientific notation.
# I prefer it to using self.to_f.to_s, which would lose precision.
#
- # Note that YAML allows that when reconsituting floats
+ # Note that YAML allows that when reconstituting floats
# to native types, some precision may get lost.
# There is no full precision real YAML tag that I am aware of.
str = self.to_s
diff --git a/activesupport/lib/active_support/core_ext/hash/except.rb b/activesupport/lib/active_support/core_ext/hash/except.rb
index bc97fa35a6..f26d01553d 100644
--- a/activesupport/lib/active_support/core_ext/hash/except.rb
+++ b/activesupport/lib/active_support/core_ext/hash/except.rb
@@ -13,7 +13,7 @@ module ActiveSupport #:nodoc:
clone.except!(*keys)
end
- # Replaces the hash without only the given keys.
+ # Replaces the hash without the given keys.
def except!(*keys)
keys.map! { |key| convert_key(key) } if respond_to?(:convert_key)
keys.each { |key| delete(key) }
diff --git a/activesupport/lib/active_support/core_ext/hash/reverse_merge.rb b/activesupport/lib/active_support/core_ext/hash/reverse_merge.rb
index 7af10846e7..546e261cc9 100644
--- a/activesupport/lib/active_support/core_ext/hash/reverse_merge.rb
+++ b/activesupport/lib/active_support/core_ext/hash/reverse_merge.rb
@@ -1,21 +1,28 @@
module ActiveSupport #:nodoc:
module CoreExtensions #:nodoc:
module Hash #:nodoc:
- # Allows for reverse merging where its the keys in the calling hash that wins over those in the <tt>other_hash</tt>.
- # This is particularly useful for initializing an incoming option hash with default values:
+ # Allows for reverse merging two hashes where the keys in the calling hash take precedence over those
+ # in the <tt>other_hash</tt>. This is particularly useful for initializing an option hash with default values:
#
# def setup(options = {})
# options.reverse_merge! :size => 25, :velocity => 10
# end
#
- # The default <tt>:size</tt> and <tt>:velocity</tt> is only set if the +options+ passed in doesn't already have those keys set.
+ # Using <tt>merge</tt>, the above example would look as follows:
+ #
+ # def setup(options = {})
+ # { :size => 25, :velocity => 10 }.merge(options)
+ # end
+ #
+ # The default <tt>:size</tt> and <tt>:velocity</tt> are only set if the +options+ hash passed in doesn't already
+ # have the respective key.
module ReverseMerge
- # Performs the opposite of merge, with the keys and values from the first hash taking precedence over the second.
+ # Performs the opposite of <tt>merge</tt>, with the keys and values from the first hash taking precedence over the second.
def reverse_merge(other_hash)
other_hash.merge(self)
end
- # Performs the opposite of merge, with the keys and values from the first hash taking precedence over the second.
+ # Performs the opposite of <tt>merge</tt>, with the keys and values from the first hash taking precedence over the second.
# Modifies the receiver in place.
def reverse_merge!(other_hash)
replace(reverse_merge(other_hash))
diff --git a/activesupport/lib/active_support/core_ext/string/inflections.rb b/activesupport/lib/active_support/core_ext/string/inflections.rb
index a009d7c085..3bbad7dad8 100644
--- a/activesupport/lib/active_support/core_ext/string/inflections.rb
+++ b/activesupport/lib/active_support/core_ext/string/inflections.rb
@@ -24,8 +24,8 @@ module ActiveSupport #:nodoc:
#
# "posts".singularize # => "post"
# "octopi".singularize # => "octopus"
- # "sheep".singluarize # => "sheep"
- # "word".singluarize # => "word"
+ # "sheep".singularize # => "sheep"
+ # "word".singularize # => "word"
# "the blue mailmen".singularize # => "the blue mailman"
# "CamelOctopi".singularize # => "CamelOctopus"
def singularize
diff --git a/activesupport/lib/active_support/core_ext/time/calculations.rb b/activesupport/lib/active_support/core_ext/time/calculations.rb
index 2cce782676..cd234c9b89 100644
--- a/activesupport/lib/active_support/core_ext/time/calculations.rb
+++ b/activesupport/lib/active_support/core_ext/time/calculations.rb
@@ -261,7 +261,7 @@ module ActiveSupport #:nodoc:
# Layers additional behavior on Time#<=> so that DateTime and ActiveSupport::TimeWithZone instances
# can be chronologically compared with a Time
def compare_with_coercion(other)
- # if other is an ActiveSupport::TimeWithZone, coerce a Time instance from it so we can do <=> comparision
+ # if other is an ActiveSupport::TimeWithZone, coerce a Time instance from it so we can do <=> comparison
other = other.comparable_time if other.respond_to?(:comparable_time)
if other.acts_like?(:date)
# other is a Date/DateTime, so coerce self #to_datetime and hand off to DateTime#<=>
diff --git a/activesupport/lib/active_support/json.rb b/activesupport/lib/active_support/json.rb
index 54a7becd0f..2bdb4a7b11 100644
--- a/activesupport/lib/active_support/json.rb
+++ b/activesupport/lib/active_support/json.rb
@@ -1,5 +1,5 @@
module ActiveSupport
- # If true, use ISO 8601 format for dates and times. Otherwise, fall back to the Active Support legacy format.
+ # If true, use ISO 8601 format for dates and times. Otherwise, fall back to the Active Support legacy format.
mattr_accessor :use_standard_json_time_format
class << self
diff --git a/activesupport/lib/active_support/json/encoders/date.rb b/activesupport/lib/active_support/json/encoders/date.rb
index cb9419d29d..1fc99c466f 100644
--- a/activesupport/lib/active_support/json/encoders/date.rb
+++ b/activesupport/lib/active_support/json/encoders/date.rb
@@ -1,7 +1,14 @@
class Date
- # Returns a JSON string representing the date.
+ # Returns a JSON string representing the date. If ActiveSupport.use_standard_json_time_format is set to true, the
+ # ISO 8601 format is used.
#
- # ==== Example:
+ # ==== Examples:
+ #
+ # # With ActiveSupport.use_standard_json_time_format = true
+ # Date.new(2005,2,1).to_json
+ # # => "2005-02-01"
+ #
+ # # With ActiveSupport.use_standard_json_time_format = false
# Date.new(2005,2,1).to_json
# # => "2005/02/01"
def to_json(options = nil)
diff --git a/activesupport/lib/active_support/json/encoders/date_time.rb b/activesupport/lib/active_support/json/encoders/date_time.rb
index a4a5efbfb1..e259930033 100644
--- a/activesupport/lib/active_support/json/encoders/date_time.rb
+++ b/activesupport/lib/active_support/json/encoders/date_time.rb
@@ -1,7 +1,14 @@
class DateTime
- # Returns a JSON string representing the datetime.
+ # Returns a JSON string representing the datetime. If ActiveSupport.use_standard_json_time_format is set to true, the
+ # ISO 8601 format is used.
#
- # ==== Example:
+ # ==== Examples:
+ #
+ # # With ActiveSupport.use_standard_json_time_format = true
+ # DateTime.civil(2005,2,1,15,15,10).to_json
+ # # => "2005-02-01T15:15:10+00:00"
+ #
+ # # With ActiveSupport.use_standard_json_time_format = false
# DateTime.civil(2005,2,1,15,15,10).to_json
# # => "2005/02/01 15:15:10 +0000"
def to_json(options = nil)
diff --git a/activesupport/lib/active_support/json/encoders/time.rb b/activesupport/lib/active_support/json/encoders/time.rb
index 57ed3c9e31..09fc614889 100644
--- a/activesupport/lib/active_support/json/encoders/time.rb
+++ b/activesupport/lib/active_support/json/encoders/time.rb
@@ -1,9 +1,16 @@
class Time
- # Returns a JSON string representing the time.
+ # Returns a JSON string representing the time. If ActiveSupport.use_standard_json_time_format is set to true, the
+ # ISO 8601 format is used.
#
- # ==== Example:
+ # ==== Examples:
+ #
+ # # With ActiveSupport.use_standard_json_time_format = true
+ # Time.utc(2005,2,1,15,15,10).to_json
+ # # => "2005-02-01T15:15:10Z"
+ #
+ # # With ActiveSupport.use_standard_json_time_format = false
# Time.utc(2005,2,1,15,15,10).to_json
- # # => 2005/02/01 15:15:10 +0000"
+ # # => "2005/02/01 15:15:10 +0000"
def to_json(options = nil)
if ActiveSupport.use_standard_json_time_format
xmlschema.inspect
diff --git a/activesupport/lib/active_support/time_with_zone.rb b/activesupport/lib/active_support/time_with_zone.rb
index e85bfe9b2e..4866fa0dc8 100644
--- a/activesupport/lib/active_support/time_with_zone.rb
+++ b/activesupport/lib/active_support/time_with_zone.rb
@@ -102,7 +102,19 @@ module ActiveSupport
"#{time.strftime("%Y-%m-%dT%H:%M:%S")}#{formatted_offset(true, 'Z')}"
end
alias_method :iso8601, :xmlschema
-
+
+ # Returns a JSON string representing the TimeWithZone. If ActiveSupport.use_standard_json_time_format is set to
+ # true, the ISO 8601 format is used.
+ #
+ # ==== Examples:
+ #
+ # # With ActiveSupport.use_standard_json_time_format = true
+ # Time.utc(2005,2,1,15,15,10).in_time_zone.to_json
+ # # => "2005-02-01T15:15:10Z"
+ #
+ # # With ActiveSupport.use_standard_json_time_format = false
+ # Time.utc(2005,2,1,15,15,10).in_time_zone.to_json
+ # # => "2005/02/01 15:15:10 +0000"
def to_json(options = nil)
if ActiveSupport.use_standard_json_time_format
xmlschema.inspect
diff --git a/activesupport/lib/active_support/vendor/builder-2.1.2/builder/xmlevents.rb b/activesupport/lib/active_support/vendor/builder-2.1.2/builder/xmlevents.rb
index 91fcd21e13..b373e4da3c 100644
--- a/activesupport/lib/active_support/vendor/builder-2.1.2/builder/xmlevents.rb
+++ b/activesupport/lib/active_support/vendor/builder-2.1.2/builder/xmlevents.rb
@@ -20,7 +20,7 @@ module Builder
# markup.
#
# Usage:
- # xe = Builder::XmlEvents.new(hander)
+ # xe = Builder::XmlEvents.new(handler)
# xe.title("HI") # Sends start_tag/end_tag/text messages to the handler.
#
# Indentation may also be selected by providing value for the
diff --git a/activesupport/lib/active_support/vendor/memcache-client-1.5.0/memcache.rb b/activesupport/lib/active_support/vendor/memcache-client-1.5.0/memcache.rb
index dda7f2c30e..30113201a6 100644
--- a/activesupport/lib/active_support/vendor/memcache-client-1.5.0/memcache.rb
+++ b/activesupport/lib/active_support/vendor/memcache-client-1.5.0/memcache.rb
@@ -119,7 +119,7 @@ class MemCache
# Valid options for +opts+ are:
#
# [:namespace] Prepends this value to all keys added or retrieved.
- # [:readonly] Raises an exeception on cache writes when true.
+ # [:readonly] Raises an exception on cache writes when true.
# [:multithread] Wraps cache access in a Mutex for thread safety.
#
# Other options are ignored.
@@ -207,7 +207,7 @@ class MemCache
end
##
- # Deceremets the value for +key+ by +amount+ and returns the new value.
+ # Decrements the value for +key+ by +amount+ and returns the new value.
# +key+ must already exist. If +key+ is not an integer, it is assumed to be
# 0. +key+ can not be decremented below 0.
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.9/tzinfo/data_timezone.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.9/tzinfo/data_timezone.rb
index 5eccbdf0db..2510e90b5b 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.9/tzinfo/data_timezone.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.9/tzinfo/data_timezone.rb
@@ -38,7 +38,7 @@ module TZInfo
# Returns the set of TimezonePeriod instances that are valid for the given
# local time as an array. If you just want a single period, use
- # period_for_local instead and specify how abiguities should be resolved.
+ # period_for_local instead and specify how ambiguities should be resolved.
# Raises PeriodNotFound if no periods are found for the given time.
def periods_for_local(local)
info.periods_for_local(local)
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.9/tzinfo/data_timezone_info.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.9/tzinfo/data_timezone_info.rb
index a45d94554b..8829ba9cc8 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.9/tzinfo/data_timezone_info.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.9/tzinfo/data_timezone_info.rb
@@ -66,7 +66,7 @@ module TZInfo
# ArgumentError will be raised if a transition is added out of order.
# offset_id refers to an id defined with offset. ArgumentError will be
# raised if the offset_id cannot be found. numerator_or_time and
- # denomiator specify the time the transition occurs as. See
+ # denominator specify the time the transition occurs as. See
# TimezoneTransitionInfo for more detail about specifying times.
def transition(year, month, offset_id, numerator_or_time, denominator = nil)
offset = @offsets[offset_id]
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.9/tzinfo/linked_timezone.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.9/tzinfo/linked_timezone.rb
index f8ec4fca87..c757485b84 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.9/tzinfo/linked_timezone.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.9/tzinfo/linked_timezone.rb
@@ -36,7 +36,7 @@ module TZInfo
# Returns the set of TimezonePeriod instances that are valid for the given
# local time as an array. If you just want a single period, use
- # period_for_local instead and specify how abiguities should be resolved.
+ # period_for_local instead and specify how ambiguities should be resolved.
# Raises PeriodNotFound if no periods are found for the given time.
def periods_for_local(local)
@linked_timezone.periods_for_local(local)
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.9/tzinfo/timezone.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.9/tzinfo/timezone.rb
index f87fb6fb70..eeaa772d0f 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.9/tzinfo/timezone.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.9/tzinfo/timezone.rb
@@ -121,7 +121,7 @@ module TZInfo
TimezoneProxy.new(identifier)
end
- # If identifier is nil calls super(), otherwise calls get. An identfier
+ # If identifier is nil calls super(), otherwise calls get. An identifier
# should always be passed in when called externally.
def self.new(identifier = nil)
if identifier
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.9/tzinfo/timezone_transition_info.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.9/tzinfo/timezone_transition_info.rb
index 3fecb24f0d..781764f0b0 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.9/tzinfo/timezone_transition_info.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.9/tzinfo/timezone_transition_info.rb
@@ -37,7 +37,7 @@ module TZInfo
attr_reader :numerator_or_time
protected :numerator_or_time
- # Either the denominotor of the DateTime if the transition time is defined
+ # Either the denominator of the DateTime if the transition time is defined
# as a DateTime, otherwise nil.
attr_reader :denominator
protected :denominator
diff --git a/activesupport/lib/active_support/vendor/xml-simple-1.0.11/xmlsimple.rb b/activesupport/lib/active_support/vendor/xml-simple-1.0.11/xmlsimple.rb
index 0de24c0eff..ec6dab513f 100644
--- a/activesupport/lib/active_support/vendor/xml-simple-1.0.11/xmlsimple.rb
+++ b/activesupport/lib/active_support/vendor/xml-simple-1.0.11/xmlsimple.rb
@@ -121,7 +121,7 @@ class XmlSimple
# Create a "global" cache.
@@cache = Cache.new
- # Creates and intializes a new XmlSimple object.
+ # Creates and initializes a new XmlSimple object.
#
# defaults::
# Default values for options.
@@ -497,7 +497,7 @@ class XmlSimple
}
end
- # Fold Hases containing a single anonymous Array up into just the Array.
+ # Fold Hashes containing a single anonymous Array up into just the Array.
if count == 1
anonymoustag = @options['anonymoustag']
if result.has_key?(anonymoustag) && result[anonymoustag].instance_of?(Array)
@@ -907,7 +907,7 @@ class XmlSimple
# Thanks to Norbert Gawor for a bugfix.
#
# value::
- # Value to be checked for emptyness.
+ # Value to be checked for emptiness.
def empty(value)
case value
when Hash