aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib
diff options
context:
space:
mode:
authorPratik Naik <pratiknaik@gmail.com>2008-05-15 21:54:46 +0100
committerPratik Naik <pratiknaik@gmail.com>2008-05-15 21:54:46 +0100
commit879493c35fd8d9e12e5cf3e56cd67ff07c3345c5 (patch)
tree9615859e1d9a52f71da444b0b7359817bb6acc50 /activesupport/lib
parentd6ecce66f4e125531875006eea8022b73fe135b5 (diff)
parentfc02eabf296d6edb74a95174c7322293a54c9492 (diff)
downloadrails-879493c35fd8d9e12e5cf3e56cd67ff07c3345c5.tar.gz
rails-879493c35fd8d9e12e5cf3e56cd67ff07c3345c5.tar.bz2
rails-879493c35fd8d9e12e5cf3e56cd67ff07c3345c5.zip
Merge commit 'mainstream/master'
Conflicts: actionmailer/lib/action_mailer/base.rb
Diffstat (limited to 'activesupport/lib')
-rw-r--r--activesupport/lib/active_support.rb1
-rw-r--r--activesupport/lib/active_support/core_ext/class/inheritable_attributes.rb2
-rw-r--r--activesupport/lib/active_support/deprecation.rb13
-rw-r--r--activesupport/lib/active_support/ordered_hash.rb43
-rw-r--r--activesupport/lib/active_support/ordered_options.rb44
-rw-r--r--activesupport/lib/active_support/time_with_zone.rb2
-rw-r--r--activesupport/lib/active_support/values/time_zone.rb9
-rw-r--r--activesupport/lib/active_support/version.rb2
8 files changed, 51 insertions, 65 deletions
diff --git a/activesupport/lib/active_support.rb b/activesupport/lib/active_support.rb
index 4d2f873a8d..e4cb145c98 100644
--- a/activesupport/lib/active_support.rb
+++ b/activesupport/lib/active_support.rb
@@ -39,6 +39,7 @@ require 'active_support/cache'
require 'active_support/dependencies'
require 'active_support/deprecation'
+require 'active_support/ordered_hash'
require 'active_support/ordered_options'
require 'active_support/option_merger'
diff --git a/activesupport/lib/active_support/core_ext/class/inheritable_attributes.rb b/activesupport/lib/active_support/core_ext/class/inheritable_attributes.rb
index 371d074d34..8724a492bf 100644
--- a/activesupport/lib/active_support/core_ext/class/inheritable_attributes.rb
+++ b/activesupport/lib/active_support/core_ext/class/inheritable_attributes.rb
@@ -128,7 +128,7 @@ class Class # :nodoc:
new_inheritable_attributes = EMPTY_INHERITABLE_ATTRIBUTES
else
new_inheritable_attributes = inheritable_attributes.inject({}) do |memo, (key, value)|
- memo.update(key => (value.dup rescue value))
+ memo.update(key => value.duplicable? ? value.dup : value)
end
end
diff --git a/activesupport/lib/active_support/deprecation.rb b/activesupport/lib/active_support/deprecation.rb
index 7613652c71..6aa379b550 100644
--- a/activesupport/lib/active_support/deprecation.rb
+++ b/activesupport/lib/active_support/deprecation.rb
@@ -176,19 +176,6 @@ module ActiveSupport
end
end
- class DeprecatedInstanceVariable < Delegator #:nodoc:
- def initialize(value, method)
- super(value)
- @method = method
- @value = value
- end
-
- def __getobj__
- ActiveSupport::Deprecation.warn("Instance variable @#{@method} is deprecated! Call instance method #{@method} instead.")
- @value
- end
- end
-
end
end
diff --git a/activesupport/lib/active_support/ordered_hash.rb b/activesupport/lib/active_support/ordered_hash.rb
new file mode 100644
index 0000000000..6993621ef9
--- /dev/null
+++ b/activesupport/lib/active_support/ordered_hash.rb
@@ -0,0 +1,43 @@
+# OrderedHash is namespaced to prevent conflicts with other implementations
+module ActiveSupport
+ # Hash is ordered in Ruby 1.9!
+ if RUBY_VERSION >= '1.9'
+ OrderedHash = ::Hash
+ else
+ class OrderedHash < Array #:nodoc:
+ def []=(key, value)
+ if pair = assoc(key)
+ pair.pop
+ pair << value
+ else
+ self << [key, value]
+ end
+ end
+
+ def [](key)
+ pair = assoc(key)
+ pair ? pair.last : nil
+ end
+
+ def delete(key)
+ pair = assoc(key)
+ pair ? array_index = index(pair) : nil
+ array_index ? delete_at(array_index).last : nil
+ end
+
+ def keys
+ collect { |key, value| key }
+ end
+
+ def values
+ collect { |key, value| value }
+ end
+
+ def to_hash
+ returning({}) do |hash|
+ each { |array| hash[array[0]] = array[1] }
+ end
+ end
+ end
+ end
+end
diff --git a/activesupport/lib/active_support/ordered_options.rb b/activesupport/lib/active_support/ordered_options.rb
index 3172f62f0d..306376e9ae 100644
--- a/activesupport/lib/active_support/ordered_options.rb
+++ b/activesupport/lib/active_support/ordered_options.rb
@@ -1,47 +1,3 @@
-# OrderedHash is namespaced to prevent conflicts with other implementations
-module ActiveSupport
- # Hash is ordered in Ruby 1.9!
- if RUBY_VERSION >= '1.9'
- OrderedHash = ::Hash
- else
- class OrderedHash < Array #:nodoc:
- def []=(key, value)
- if pair = assoc(key)
- pair.pop
- pair << value
- else
- self << [key, value]
- end
- end
-
- def [](key)
- pair = assoc(key)
- pair ? pair.last : nil
- end
-
- def delete(key)
- pair = assoc(key)
- pair ? array_index = index(pair) : nil
- array_index ? delete_at(array_index).last : nil
- end
-
- def keys
- collect { |key, value| key }
- end
-
- def values
- collect { |key, value| value }
- end
-
- def to_hash
- returning({}) do |hash|
- each { |array| hash[array[0]] = array[1] }
- end
- end
- end
- end
-end
-
class OrderedOptions < ActiveSupport::OrderedHash #:nodoc:
def []=(key, value)
super(key.to_sym, value)
diff --git a/activesupport/lib/active_support/time_with_zone.rb b/activesupport/lib/active_support/time_with_zone.rb
index 21ddcaad48..48606dbcff 100644
--- a/activesupport/lib/active_support/time_with_zone.rb
+++ b/activesupport/lib/active_support/time_with_zone.rb
@@ -78,7 +78,7 @@ module ActiveSupport
def to_json(options = nil)
if ActiveSupport.use_standard_json_time_format
- utc.xmlschema.inspect
+ xmlschema.inspect
else
%("#{time.strftime("%Y/%m/%d %H:%M:%S")} #{formatted_offset(false)}")
end
diff --git a/activesupport/lib/active_support/values/time_zone.rb b/activesupport/lib/active_support/values/time_zone.rb
index 0fa99135e2..f522b64108 100644
--- a/activesupport/lib/active_support/values/time_zone.rb
+++ b/activesupport/lib/active_support/values/time_zone.rb
@@ -325,6 +325,9 @@ class TimeZone
ZONES.sort!
ZONES.freeze
ZONES_MAP.freeze
+
+ US_ZONES = ZONES.find_all { |z| z.name =~ /US|Arizona|Indiana|Hawaii|Alaska/ }
+ US_ZONES.freeze
end
class << self
@@ -361,14 +364,10 @@ class TimeZone
end
end
- # A regular expression that matches the names of all time zones in
- # the USA.
- US_ZONES = /US|Arizona|Indiana|Hawaii|Alaska/.freeze
-
# A convenience method for returning a collection of TimeZone objects
# for time zones in the USA.
def us_zones
- all.find_all { |z| z.name =~ US_ZONES }
+ US_ZONES
end
end
end
diff --git a/activesupport/lib/active_support/version.rb b/activesupport/lib/active_support/version.rb
index 83fbaec62c..f3d141cf72 100644
--- a/activesupport/lib/active_support/version.rb
+++ b/activesupport/lib/active_support/version.rb
@@ -2,7 +2,7 @@ module ActiveSupport
module VERSION #:nodoc:
MAJOR = 2
MINOR = 0
- TINY = 2
+ TINY = 991
STRING = [MAJOR, MINOR, TINY].join('.')
end