aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support
diff options
context:
space:
mode:
authorPratik Naik <pratiknaik@gmail.com>2009-11-17 22:47:23 +0000
committerPratik Naik <pratiknaik@gmail.com>2009-11-17 22:47:23 +0000
commit5446d5cb05b50a9a3f317ded774be438e0eff909 (patch)
tree6b0b87efe3e95783763208215a3159fb63217a6d /activesupport/lib/active_support
parent9754debb9a72f9385950e5282f3642b995ab76d8 (diff)
parentf8877d4b2a2a6f68770b376f0b1391a6295f62f2 (diff)
downloadrails-5446d5cb05b50a9a3f317ded774be438e0eff909.tar.gz
rails-5446d5cb05b50a9a3f317ded774be438e0eff909.tar.bz2
rails-5446d5cb05b50a9a3f317ded774be438e0eff909.zip
Merge remote branch 'mainstream/master'
Conflicts: activesupport/lib/active_support/core_ext/hash/conversions.rb
Diffstat (limited to 'activesupport/lib/active_support')
-rw-r--r--activesupport/lib/active_support/autoload.rb7
-rw-r--r--activesupport/lib/active_support/benchmarkable.rb59
-rw-r--r--activesupport/lib/active_support/buffered_logger.rb1
-rw-r--r--activesupport/lib/active_support/cache.rb39
-rw-r--r--activesupport/lib/active_support/cache/mem_cache_store.rb16
-rw-r--r--activesupport/lib/active_support/callbacks.rb620
-rw-r--r--activesupport/lib/active_support/concern.rb16
-rw-r--r--activesupport/lib/active_support/concurrent_hash.rb27
-rw-r--r--activesupport/lib/active_support/configurable.rb35
-rw-r--r--activesupport/lib/active_support/core_ext/array/conversions.rb16
-rw-r--r--activesupport/lib/active_support/core_ext/array/wrap.rb13
-rw-r--r--activesupport/lib/active_support/core_ext/boolean.rb1
-rw-r--r--activesupport/lib/active_support/core_ext/boolean/conversions.rb11
-rw-r--r--activesupport/lib/active_support/core_ext/class/delegating_attributes.rb60
-rw-r--r--activesupport/lib/active_support/core_ext/class/inheritable_attributes.rb29
-rw-r--r--activesupport/lib/active_support/core_ext/date.rb7
-rw-r--r--activesupport/lib/active_support/core_ext/date/calculations.rb1
-rw-r--r--activesupport/lib/active_support/core_ext/date/conversions.rb2
-rw-r--r--activesupport/lib/active_support/core_ext/date_time.rb5
-rw-r--r--activesupport/lib/active_support/core_ext/date_time/calculations.rb2
-rw-r--r--activesupport/lib/active_support/core_ext/enumerable.rb9
-rw-r--r--activesupport/lib/active_support/core_ext/hash/conversions.rb20
-rw-r--r--activesupport/lib/active_support/core_ext/hash/slice.rb6
-rw-r--r--activesupport/lib/active_support/core_ext/integer.rb2
-rw-r--r--activesupport/lib/active_support/core_ext/integer/even_odd.rb16
-rw-r--r--activesupport/lib/active_support/core_ext/integer/multiple.rb6
-rw-r--r--activesupport/lib/active_support/core_ext/kernel/debugger.rb1
-rw-r--r--activesupport/lib/active_support/core_ext/name_error.rb4
-rw-r--r--activesupport/lib/active_support/core_ext/nil.rb1
-rw-r--r--activesupport/lib/active_support/core_ext/nil/conversions.rb5
-rw-r--r--activesupport/lib/active_support/core_ext/object/conversions.rb18
-rw-r--r--activesupport/lib/active_support/core_ext/object/duplicable.rb8
-rw-r--r--activesupport/lib/active_support/core_ext/object/extending.rb27
-rw-r--r--activesupport/lib/active_support/core_ext/object/instance_variables.rb7
-rw-r--r--activesupport/lib/active_support/core_ext/object/misc.rb1
-rw-r--r--activesupport/lib/active_support/core_ext/object/tap.rb16
-rw-r--r--activesupport/lib/active_support/core_ext/object/to_param.rb47
-rw-r--r--activesupport/lib/active_support/core_ext/object/to_query.rb27
-rw-r--r--activesupport/lib/active_support/core_ext/regexp.rb22
-rw-r--r--activesupport/lib/active_support/core_ext/string.rb1
-rw-r--r--activesupport/lib/active_support/core_ext/string/access.rb2
-rw-r--r--activesupport/lib/active_support/core_ext/string/bytesize.rb5
-rw-r--r--activesupport/lib/active_support/core_ext/string/interpolation.rb1
-rw-r--r--activesupport/lib/active_support/core_ext/string/iterators.rb13
-rw-r--r--activesupport/lib/active_support/core_ext/string/starts_ends_with.rb14
-rw-r--r--activesupport/lib/active_support/core_ext/symbol.rb1
-rw-r--r--activesupport/lib/active_support/core_ext/symbol/to_proc.rb14
-rw-r--r--activesupport/lib/active_support/core_ext/time.rb10
-rw-r--r--activesupport/lib/active_support/core_ext/uri.rb3
-rw-r--r--activesupport/lib/active_support/dependencies.rb2
-rw-r--r--activesupport/lib/active_support/dependency_module.rb17
-rw-r--r--activesupport/lib/active_support/deprecated_callbacks.rb284
-rw-r--r--activesupport/lib/active_support/deprecation/behaviors.rb8
-rw-r--r--activesupport/lib/active_support/inflector.rb411
-rw-r--r--activesupport/lib/active_support/inflector/inflections.rb211
-rw-r--r--activesupport/lib/active_support/inflector/methods.rb139
-rw-r--r--activesupport/lib/active_support/inflector/transliterate.rb61
-rw-r--r--activesupport/lib/active_support/json/backends/jsongem.rb21
-rw-r--r--activesupport/lib/active_support/json/encoding.rb5
-rw-r--r--activesupport/lib/active_support/memoizable.rb13
-rw-r--r--activesupport/lib/active_support/message_verifier.rb2
-rw-r--r--activesupport/lib/active_support/multibyte.rb11
-rw-r--r--activesupport/lib/active_support/multibyte/chars.rb41
-rw-r--r--activesupport/lib/active_support/multibyte/utils.rb13
-rw-r--r--activesupport/lib/active_support/new_callbacks.rb563
-rw-r--r--activesupport/lib/active_support/notifications.rb189
-rw-r--r--activesupport/lib/active_support/orchestra.rb103
-rw-r--r--activesupport/lib/active_support/ordered_hash.rb7
-rw-r--r--activesupport/lib/active_support/rescuable.rb10
-rw-r--r--activesupport/lib/active_support/ruby/shim.rb6
-rw-r--r--activesupport/lib/active_support/testing/isolation.rb2
-rw-r--r--activesupport/lib/active_support/testing/setup_and_teardown.rb10
-rw-r--r--activesupport/lib/active_support/time.rb26
-rw-r--r--activesupport/lib/active_support/time_with_zone.rb7
-rw-r--r--activesupport/lib/active_support/values/time_zone.rb6
-rw-r--r--activesupport/lib/active_support/vendor.rb9
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Argentina/Buenos_Aires.rb166
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Karachi.rb32
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/data_timezone.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/data_timezone.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/data_timezone_info.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/data_timezone_info.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Africa/Algiers.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Africa/Algiers.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Africa/Cairo.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Africa/Cairo.rb)84
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Africa/Casablanca.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Africa/Casablanca.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Africa/Harare.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Africa/Harare.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Africa/Johannesburg.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Africa/Johannesburg.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Africa/Monrovia.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Africa/Monrovia.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Africa/Nairobi.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Africa/Nairobi.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/Argentina/Buenos_Aires.rb84
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/Argentina/San_Juan.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Argentina/San_Juan.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/Bogota.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Bogota.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/Caracas.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Caracas.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/Chicago.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Chicago.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/Chihuahua.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Chihuahua.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/Denver.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Denver.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/Godthab.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Godthab.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/Guatemala.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Guatemala.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/Halifax.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Halifax.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/Indiana/Indianapolis.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Indiana/Indianapolis.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/Juneau.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Juneau.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/La_Paz.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/La_Paz.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/Lima.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Lima.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/Los_Angeles.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Los_Angeles.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/Mazatlan.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Mazatlan.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/Mexico_City.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Mexico_City.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/Monterrey.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Monterrey.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/New_York.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/New_York.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/Phoenix.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Phoenix.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/Regina.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Regina.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/Santiago.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Santiago.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/Sao_Paulo.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Sao_Paulo.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/St_Johns.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/St_Johns.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/Tijuana.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Tijuana.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Almaty.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Almaty.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Baghdad.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Baghdad.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Baku.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Baku.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Bangkok.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Bangkok.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Chongqing.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Chongqing.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Colombo.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Colombo.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Dhaka.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Dhaka.rb)2
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Hong_Kong.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Hong_Kong.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Irkutsk.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Irkutsk.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Jakarta.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Jakarta.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Jerusalem.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Jerusalem.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Kabul.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Kabul.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Kamchatka.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Kamchatka.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Karachi.rb114
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Kathmandu.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Kathmandu.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Kolkata.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Kolkata.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Krasnoyarsk.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Krasnoyarsk.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Kuala_Lumpur.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Kuala_Lumpur.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Kuwait.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Kuwait.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Magadan.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Magadan.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Muscat.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Muscat.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Novosibirsk.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Novosibirsk.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Rangoon.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Rangoon.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Riyadh.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Riyadh.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Seoul.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Seoul.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Shanghai.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Shanghai.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Singapore.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Singapore.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Taipei.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Taipei.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Tashkent.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Tashkent.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Tbilisi.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Tbilisi.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Tehran.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Tehran.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Tokyo.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Tokyo.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Ulaanbaatar.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Ulaanbaatar.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Urumqi.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Urumqi.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Vladivostok.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Vladivostok.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Yakutsk.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Yakutsk.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Yekaterinburg.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Yekaterinburg.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Yerevan.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Yerevan.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Atlantic/Azores.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Atlantic/Azores.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Atlantic/Cape_Verde.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Atlantic/Cape_Verde.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Atlantic/South_Georgia.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Atlantic/South_Georgia.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Australia/Adelaide.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Australia/Adelaide.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Australia/Brisbane.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Australia/Brisbane.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Australia/Darwin.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Australia/Darwin.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Australia/Hobart.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Australia/Hobart.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Australia/Melbourne.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Australia/Melbourne.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Australia/Perth.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Australia/Perth.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Australia/Sydney.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Australia/Sydney.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Etc/UTC.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Etc/UTC.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Amsterdam.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Amsterdam.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Athens.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Athens.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Belgrade.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Belgrade.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Berlin.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Berlin.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Bratislava.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Bratislava.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Brussels.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Brussels.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Bucharest.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Bucharest.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Budapest.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Budapest.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Copenhagen.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Copenhagen.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Dublin.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Dublin.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Helsinki.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Helsinki.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Istanbul.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Istanbul.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Kiev.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Kiev.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Lisbon.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Lisbon.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Ljubljana.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Ljubljana.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/London.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/London.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Madrid.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Madrid.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Minsk.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Minsk.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Moscow.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Moscow.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Paris.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Paris.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Prague.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Prague.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Riga.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Riga.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Rome.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Rome.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Sarajevo.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Sarajevo.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Skopje.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Skopje.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Sofia.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Sofia.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Stockholm.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Stockholm.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Tallinn.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Tallinn.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Vienna.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Vienna.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Vilnius.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Vilnius.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Warsaw.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Warsaw.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Zagreb.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Zagreb.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Pacific/Auckland.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Pacific/Auckland.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Pacific/Fiji.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Pacific/Fiji.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Pacific/Guam.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Pacific/Guam.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Pacific/Honolulu.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Pacific/Honolulu.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Pacific/Majuro.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Pacific/Majuro.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Pacific/Midway.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Pacific/Midway.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Pacific/Noumea.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Pacific/Noumea.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Pacific/Pago_Pago.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Pacific/Pago_Pago.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Pacific/Port_Moresby.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Pacific/Port_Moresby.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Pacific/Tongatapu.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Pacific/Tongatapu.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/info_timezone.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/info_timezone.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/linked_timezone.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/linked_timezone.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/linked_timezone_info.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/linked_timezone_info.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/offset_rationals.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/offset_rationals.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/ruby_core_support.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/ruby_core_support.rb)110
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/time_or_datetime.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/time_or_datetime.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/timezone.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/timezone.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/timezone_definition.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/timezone_definition.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/timezone_info.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/timezone_info.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/timezone_offset_info.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/timezone_offset_info.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/timezone_period.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/timezone_period.rb)0
-rw-r--r--activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/timezone_transition_info.rb (renamed from activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/timezone_transition_info.rb)0
-rw-r--r--activesupport/lib/active_support/whiny_nil.rb10
-rw-r--r--activesupport/lib/active_support/xml_mini/libxml.rb13
218 files changed, 2068 insertions, 1998 deletions
diff --git a/activesupport/lib/active_support/autoload.rb b/activesupport/lib/active_support/autoload.rb
index 423d5448c3..63f7338a68 100644
--- a/activesupport/lib/active_support/autoload.rb
+++ b/activesupport/lib/active_support/autoload.rb
@@ -2,12 +2,14 @@ module ActiveSupport
autoload :BacktraceCleaner, 'active_support/backtrace_cleaner'
autoload :Base64, 'active_support/base64'
autoload :BasicObject, 'active_support/basic_object'
+ autoload :Benchmarkable, 'active_support/benchmarkable'
autoload :BufferedLogger, 'active_support/buffered_logger'
autoload :Cache, 'active_support/cache'
autoload :Callbacks, 'active_support/callbacks'
autoload :Concern, 'active_support/concern'
- autoload :ConcurrentHash, 'active_support/concurrent_hash'
+ autoload :Configurable, 'active_support/configurable'
autoload :DependencyModule, 'active_support/dependency_module'
+ autoload :DeprecatedCallbacks, 'active_support/deprecated_callbacks'
autoload :Deprecation, 'active_support/deprecation'
autoload :Gzip, 'active_support/gzip'
autoload :Inflector, 'active_support/inflector'
@@ -15,11 +17,10 @@ module ActiveSupport
autoload :MessageEncryptor, 'active_support/message_encryptor'
autoload :MessageVerifier, 'active_support/message_verifier'
autoload :Multibyte, 'active_support/multibyte'
- autoload :NewCallbacks, 'active_support/new_callbacks'
autoload :OptionMerger, 'active_support/option_merger'
- autoload :Orchestra, 'active_support/orchestra'
autoload :OrderedHash, 'active_support/ordered_hash'
autoload :OrderedOptions, 'active_support/ordered_options'
+ autoload :Notifications, 'active_support/notifications'
autoload :Rescuable, 'active_support/rescuable'
autoload :SecureRandom, 'active_support/secure_random'
autoload :StringInquirer, 'active_support/string_inquirer'
diff --git a/activesupport/lib/active_support/benchmarkable.rb b/activesupport/lib/active_support/benchmarkable.rb
new file mode 100644
index 0000000000..6a41aab166
--- /dev/null
+++ b/activesupport/lib/active_support/benchmarkable.rb
@@ -0,0 +1,59 @@
+require 'active_support/core_ext/benchmark'
+
+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.
+ #
+ # <% 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.
+ #
+ # You may give an optional logger level as the :level option.
+ # (:debug, :info, :warn, :error); the default 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:
+ #
+ # <% benchmark "Process data files", :level => :info, :silence => true do %>
+ # <%= expensive_and_chatty_files_operation %>
+ # <% end %>
+ def benchmark(message = "Benchmarking", options = {})
+ if logger
+ if options.is_a?(Symbol)
+ ActiveSupport::Deprecation.warn("use benchmark('#{message}', :level => :#{options}) instead", caller)
+ options = { :level => options, :silence => false }
+ else
+ options.assert_valid_keys(:level, :silence)
+ options[:level] ||= :info
+ end
+
+ result = nil
+ ms = Benchmark.ms { result = options[:silence] ? logger.silence { yield } : yield }
+ logger.send(options[:level], '%s (%.1fms)' % [ message, ms ])
+ result
+ else
+ yield
+ end
+ end
+
+ # Silence the logger during the execution of the block.
+ #
+ def silence
+ old_logger_level, logger.level = logger.level, ::Logger::ERROR if logger
+ yield
+ ensure
+ logger.level = old_logger_level if logger
+ end
+ end
+end
diff --git a/activesupport/lib/active_support/buffered_logger.rb b/activesupport/lib/active_support/buffered_logger.rb
index dfce507b33..29c3843d16 100644
--- a/activesupport/lib/active_support/buffered_logger.rb
+++ b/activesupport/lib/active_support/buffered_logger.rb
@@ -53,7 +53,6 @@ module ActiveSupport
FileUtils.mkdir_p(File.dirname(log))
@log = open(log, (File::WRONLY | File::APPEND | File::CREAT))
@log.sync = true
- @log.write("# Logfile created on %s" % [Time.now.to_s])
end
end
diff --git a/activesupport/lib/active_support/cache.rb b/activesupport/lib/active_support/cache.rb
index a415686020..f2d957f154 100644
--- a/activesupport/lib/active_support/cache.rb
+++ b/activesupport/lib/active_support/cache.rb
@@ -1,13 +1,9 @@
require 'benchmark'
+require 'active_support/core_ext/array/wrap'
require 'active_support/core_ext/benchmark'
require 'active_support/core_ext/exception'
require 'active_support/core_ext/class/attribute_accessors'
-
-%w(hash nil string time date date_time array big_decimal range object boolean).each do |library|
- require "active_support/core_ext/#{library}/conversions"
-end
-
-# require 'active_support/core_ext' # FIXME: pulling in all to_param extensions
+require 'active_support/core_ext/object/to_param'
module ActiveSupport
# See ActiveSupport::Cache::Store for documentation.
@@ -48,7 +44,7 @@ module ActiveSupport
# ActiveSupport::Cache.lookup_store(MyOwnCacheStore.new)
# # => returns MyOwnCacheStore.new
def self.lookup_store(*store_option)
- store, *parameters = *([ store_option ].flatten)
+ store, *parameters = *Array.wrap(store_option).flatten
case store
when Symbol
@@ -105,7 +101,7 @@ module ActiveSupport
# cache.write("city", "Duckburgh")
# cache.read("city") # => "Duckburgh"
class Store
- cattr_accessor :logger
+ cattr_accessor :logger, :instance_writter => false
attr_reader :silence
alias :silence? :silence
@@ -122,6 +118,15 @@ module ActiveSupport
@silence = previous_silence
end
+ # Set to true if cache stores should be instrumented. By default is false.
+ def self.instrument=(boolean)
+ Thread.current[:instrument_cache_store] = boolean
+ end
+
+ def self.instrument
+ Thread.current[:instrument_cache_store] || false
+ end
+
# 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.
#
@@ -219,7 +224,6 @@ module ActiveSupport
end
def increment(key, amount = 1)
- log("incrementing", key, amount)
if num = read(key)
write(key, num + amount)
else
@@ -228,7 +232,6 @@ module ActiveSupport
end
def decrement(key, amount = 1)
- log("decrementing", key, amount)
if num = read(key)
write(key, num - amount)
else
@@ -244,16 +247,20 @@ module ActiveSupport
end
def instrument(operation, key, options, &block)
- payload = { :key => key }
- payload.merge!(options) if options.is_a?(Hash)
+ log(operation, key, options)
- event = ActiveSupport::Orchestra.instrument(:"cache_#{operation}", payload, &block)
- log("#{operation} (%.1fms)" % event.duration, key, options)
- event.result
+ if self.class.instrument
+ payload = { :key => key }
+ payload.merge!(options) if options.is_a?(Hash)
+ ActiveSupport::Notifications.instrument(:"cache_#{operation}", payload, &block)
+ else
+ yield
+ end
end
def log(operation, key, options)
- logger.debug("Cache #{operation}: #{key}#{options ? " (#{options.inspect})" : ""}") if logger && !silence?
+ return unless logger && !silence?
+ logger.debug("Cache #{operation}: #{key}#{options ? " (#{options.inspect})" : ""}")
end
end
end
diff --git a/activesupport/lib/active_support/cache/mem_cache_store.rb b/activesupport/lib/active_support/cache/mem_cache_store.rb
index 516af99ce9..1b6b820ca4 100644
--- a/activesupport/lib/active_support/cache/mem_cache_store.rb
+++ b/activesupport/lib/active_support/cache/mem_cache_store.rb
@@ -38,6 +38,11 @@ module ActiveSupport
#
# If no addresses are specified, then MemCacheStore will connect to
# localhost port 11211 (the default memcached port).
+ #
+ # Instead of addresses one can pass in a MemCache-like object. For example:
+ #
+ # require 'memcached' # gem install memcached; uses C bindings to libmemcached
+ # ActiveSupport::Cache::MemCacheStore.new(Memcached::Rails.new("localhost:11211"))
def initialize(*addresses)
if addresses.first.respond_to?(:get)
@data = addresses.first
@@ -103,17 +108,20 @@ module ActiveSupport
end
def increment(key, amount = 1) # :nodoc:
- log("incrementing", key, amount)
+ response = instrument(:increment, key, :amount => amount) do
+ @data.incr(key, amount)
+ end
- response = @data.incr(key, amount)
response == Response::NOT_FOUND ? nil : response
rescue MemCache::MemCacheError
nil
end
def decrement(key, amount = 1) # :nodoc:
- log("decrement", key, amount)
- response = @data.decr(key, amount)
+ response = instrument(:decrement, key, :amount => amount) do
+ @data.decr(key, amount)
+ end
+
response == Response::NOT_FOUND ? nil : response
rescue MemCache::MemCacheError
nil
diff --git a/activesupport/lib/active_support/callbacks.rb b/activesupport/lib/active_support/callbacks.rb
index 238d1b6804..67e9b0103f 100644
--- a/activesupport/lib/active_support/callbacks.rb
+++ b/activesupport/lib/active_support/callbacks.rb
@@ -1,4 +1,6 @@
-require 'active_support/core_ext/array/extract_options'
+require 'active_support/core_ext/array/wrap'
+require 'active_support/core_ext/class/inheritable_attributes'
+require 'active_support/core_ext/kernel/reporting'
module ActiveSupport
# Callbacks are hooks into the lifecycle of an object that allow you to trigger logic
@@ -10,23 +12,23 @@ module ActiveSupport
# class Storage
# include ActiveSupport::Callbacks
#
- # define_callbacks :before_save, :after_save
+ # define_callbacks :save
# end
#
# class ConfigStorage < Storage
- # before_save :saving_message
+ # set_callback :save, :before, :saving_message
# def saving_message
# puts "saving..."
# end
#
- # after_save do |object|
+ # set_callback :save, :after do |object|
# puts "saved"
# end
#
# def save
- # run_callbacks(:before_save)
- # puts "- save"
- # run_callbacks(:after_save)
+ # run_callbacks :save do
+ # puts "- save"
+ # end
# end
# end
#
@@ -44,28 +46,28 @@ module ActiveSupport
# class Storage
# include ActiveSupport::Callbacks
#
- # define_callbacks :before_save, :after_save
+ # define_callbacks :save
#
- # before_save :prepare
+ # set_callback :save, :before, :prepare
# def prepare
# puts "preparing save"
# end
# end
#
# class ConfigStorage < Storage
- # before_save :saving_message
+ # set_callback :save, :before, :saving_message
# def saving_message
# puts "saving..."
# end
#
- # after_save do |object|
+ # set_callback :save, :after do |object|
# puts "saved"
# end
#
# def save
- # run_callbacks(:before_save)
- # puts "- save"
- # run_callbacks(:after_save)
+ # run_callbacks :save do
+ # puts "- save"
+ # end
# end
# end
#
@@ -77,205 +79,483 @@ module ActiveSupport
# saving...
# - save
# saved
+ #
module Callbacks
- class CallbackChain < Array
- def self.build(kind, *methods, &block)
- methods, options = extract_options(*methods, &block)
- methods.map! { |method| Callback.new(kind, method, options) }
- new(methods)
+ extend Concern
+
+ def run_callbacks(kind, *args, &block)
+ send("_run_#{kind}_callbacks", *args, &block)
+ end
+
+ class Callback
+ @@_callback_sequence = 0
+
+ attr_accessor :chain, :filter, :kind, :options, :per_key, :klass
+
+ def initialize(chain, filter, kind, options, klass)
+ @chain, @kind, @klass = chain, kind, klass
+ normalize_options!(options)
+
+ @per_key = options.delete(:per_key)
+ @raw_filter, @options = filter, options
+ @filter = _compile_filter(filter)
+ @compiled_options = _compile_options(options)
+ @callback_id = next_id
+
+ _compile_per_key_options
end
- def run(object, options = {}, &terminator)
- enumerator = options[:enumerator] || :each
+ def clone(chain, klass)
+ obj = super()
+ obj.chain = chain
+ obj.klass = klass
+ obj.per_key = @per_key.dup
+ obj.options = @options.dup
+ obj.per_key[:if] = @per_key[:if].dup
+ obj.per_key[:unless] = @per_key[:unless].dup
+ obj.options[:if] = @options[:if].dup
+ obj.options[:unless] = @options[:unless].dup
+ obj
+ end
- unless block_given?
- send(enumerator) { |callback| callback.call(object) }
- else
- send(enumerator) do |callback|
- result = callback.call(object)
- break result if terminator.call(result, object)
+ def normalize_options!(options)
+ options[:if] = Array.wrap(options[:if])
+ options[:unless] = Array.wrap(options[:unless])
+
+ options[:per_key] ||= {}
+ options[:per_key][:if] = Array.wrap(options[:per_key][:if])
+ options[:per_key][:unless] = Array.wrap(options[:per_key][:unless])
+ end
+
+ def name
+ chain.name
+ end
+
+ def next_id
+ @@_callback_sequence += 1
+ end
+
+ def matches?(_kind, _filter)
+ @kind == _kind && @filter == _filter
+ end
+
+ def _update_filter(filter_options, new_options)
+ filter_options[:if].push(new_options[:unless]) if new_options.key?(:unless)
+ filter_options[:unless].push(new_options[:if]) if new_options.key?(:if)
+ end
+
+ def recompile!(_options, _per_key)
+ _update_filter(self.options, _options)
+ _update_filter(self.per_key, _per_key)
+
+ @callback_id = next_id
+ @filter = _compile_filter(@raw_filter)
+ @compiled_options = _compile_options(@options)
+ _compile_per_key_options
+ end
+
+ def _compile_per_key_options
+ key_options = _compile_options(@per_key)
+
+ @klass.class_eval <<-RUBY_EVAL, __FILE__, __LINE__ + 1
+ def _one_time_conditions_valid_#{@callback_id}?
+ true #{key_options[0]}
end
- end
+ RUBY_EVAL
end
- # TODO: Decompose into more Array like behavior
- def replace_or_append!(chain)
- if index = index(chain)
- self[index] = chain
- else
- self << chain
+ # This will supply contents for before and around filters, and no
+ # contents for after filters (for the forward pass).
+ def start(key=nil, object=nil)
+ return if key && !object.send("_one_time_conditions_valid_#{@callback_id}?")
+
+ # options[0] is the compiled form of supplied conditions
+ # options[1] is the "end" for the conditional
+ #
+ if @kind == :before || @kind == :around
+ if @kind == :before
+ # if condition # before_save :filter_name, :if => :condition
+ # filter_name
+ # end
+ filter = <<-RUBY_EVAL
+ unless halted
+ result = #{@filter}
+ halted = (#{chain.config[:terminator]})
+ end
+ RUBY_EVAL
+
+ [@compiled_options[0], filter, @compiled_options[1]].compact.join("\n")
+ else
+ # Compile around filters with conditions into proxy methods
+ # that contain the conditions.
+ #
+ # For `around_save :filter_name, :if => :condition':
+ #
+ # def _conditional_callback_save_17
+ # if condition
+ # filter_name do
+ # yield self
+ # end
+ # else
+ # yield self
+ # end
+ # end
+ #
+ name = "_conditional_callback_#{@kind}_#{next_id}"
+ txt, line = <<-RUBY_EVAL, __LINE__ + 1
+ def #{name}(halted)
+ #{@compiled_options[0] || "if true"} && !halted
+ #{@filter} do
+ yield self
+ end
+ else
+ yield self
+ end
+ end
+ RUBY_EVAL
+ @klass.class_eval(txt, __FILE__, line)
+ "#{name}(halted) do"
+ end
end
- self
end
- def find(callback, &block)
- select { |c| c == callback && (!block_given? || yield(c)) }.first
- end
+ # This will supply contents for around and after filters, but not
+ # before filters (for the backward pass).
+ def end(key=nil, object=nil)
+ return if key && !object.send("_one_time_conditions_valid_#{@callback_id}?")
- def delete(callback)
- super(callback.is_a?(Callback) ? callback : find(callback))
+ if @kind == :around || @kind == :after
+ # if condition # after_save :filter_name, :if => :condition
+ # filter_name
+ # end
+ if @kind == :after
+ [@compiled_options[0], @filter, @compiled_options[1]].compact.join("\n")
+ else
+ "end"
+ end
+ end
end
private
- def self.extract_options(*methods, &block)
- methods.flatten!
- options = methods.extract_options!
- methods << block if block_given?
- return methods, options
- end
- def extract_options(*methods, &block)
- self.class.extract_options(*methods, &block)
+ # Options support the same options as filters themselves (and support
+ # symbols, string, procs, and objects), so compile a conditional
+ # expression based on the options
+ def _compile_options(options)
+ return [] if options[:if].empty? && options[:unless].empty?
+
+ conditions = []
+
+ unless options[:if].empty?
+ conditions << Array.wrap(_compile_filter(options[:if]))
end
- end
- class Callback
- attr_reader :kind, :method, :identifier, :options
+ unless options[:unless].empty?
+ conditions << Array.wrap(_compile_filter(options[:unless])).map {|f| "!#{f}"}
+ end
- def initialize(kind, method, options = {})
- @kind = kind
- @method = method
- @identifier = options[:identifier]
- @options = options
+ ["if #{conditions.flatten.join(" && ")}", "end"]
end
- def ==(other)
- case other
- when Callback
- (self.identifier && self.identifier == other.identifier) || self.method == other.method
+ # Filters support:
+ #
+ # Arrays:: Used in conditions. This is used to specify
+ # multiple conditions. Used internally to
+ # merge conditions from skip_* filters
+ # Symbols:: A method to call
+ # Strings:: Some content to evaluate
+ # Procs:: A proc to call with the object
+ # Objects:: An object with a before_foo method on it to call
+ #
+ # All of these objects are compiled into methods and handled
+ # the same after this point:
+ #
+ # Arrays:: Merged together into a single filter
+ # Symbols:: Already methods
+ # Strings:: class_eval'ed into methods
+ # Procs:: define_method'ed into methods
+ # Objects::
+ # a method is created that calls the before_foo method
+ # on the object.
+ #
+ def _compile_filter(filter)
+ method_name = "_callback_#{@kind}_#{next_id}"
+ case filter
+ when Array
+ filter.map {|f| _compile_filter(f)}
+ when Symbol
+ filter
+ when String
+ "(#{filter})"
+ when Proc
+ @klass.send(:define_method, method_name, &filter)
+ return method_name if filter.arity <= 0
+
+ method_name << (filter.arity == 1 ? "(self)" : " self, Proc.new ")
else
- (self.identifier && self.identifier == other) || self.method == other
+ @klass.send(:define_method, "#{method_name}_object") { filter }
+
+ _normalize_legacy_filter(kind, filter)
+ scopes = Array.wrap(chain.config[:scope])
+ method_to_call = scopes.map{ |s| s.is_a?(Symbol) ? send(s) : s }.join("_")
+
+ @klass.class_eval <<-RUBY_EVAL, __FILE__, __LINE__ + 1
+ def #{method_name}(&blk)
+ #{method_name}_object.send(:#{method_to_call}, self, &blk)
+ end
+ RUBY_EVAL
+
+ method_name
end
end
- def eql?(other)
- self == other
+ def _normalize_legacy_filter(kind, filter)
+ if !filter.respond_to?(kind) && filter.respond_to?(:filter)
+ filter.metaclass.class_eval(
+ "def #{kind}(context, &block) filter(context, &block) end",
+ __FILE__, __LINE__ - 1)
+ elsif filter.respond_to?(:before) && filter.respond_to?(:after) && kind == :around
+ def filter.around(context)
+ should_continue = before(context)
+ yield if should_continue
+ after(context)
+ end
+ end
end
+ end
+
+ # An Array with a compile method
+ class CallbackChain < Array
+ attr_reader :name, :config
- def dup
- self.class.new(@kind, @method, @options.dup)
+ def initialize(name, config)
+ @name = name
+ @config = {
+ :terminator => "false",
+ :rescuable => false,
+ :scope => [ :kind ]
+ }.merge(config)
end
- def hash
- if @identifier
- @identifier.hash
- else
- @method.hash
+ def compile(key=nil, object=nil)
+ method = []
+ method << "value = nil"
+ method << "halted = false"
+
+ each do |callback|
+ method << callback.start(key, object)
+ end
+
+ if config[:rescuable]
+ method << "rescued_error = nil"
+ method << "begin"
+ end
+
+ method << "value = yield if block_given? && !halted"
+
+ if config[:rescuable]
+ method << "rescue Exception => e"
+ method << "rescued_error = e"
+ method << "end"
+ end
+
+ reverse_each do |callback|
+ method << callback.end(key, object)
end
+
+ method << "raise rescued_error if rescued_error" if config[:rescuable]
+ method << "halted ? false : (block_given? ? value : true)"
+ method.compact.join("\n")
end
- def call(*args, &block)
- evaluate_method(method, *args, &block) if should_run_callback?(*args)
- rescue LocalJumpError
- raise ArgumentError,
- "Cannot yield from a Proc type filter. The Proc must take two " +
- "arguments and execute #call on the second argument."
+ def clone(klass)
+ chain = CallbackChain.new(@name, @config.dup)
+ callbacks = map { |c| c.clone(chain, klass) }
+ chain.push(*callbacks)
end
+ end
- private
- def evaluate_method(method, *args, &block)
- case method
- when Symbol
- object = args.shift
- object.send(method, *args, &block)
- when String
- eval(method, args.first.instance_eval { binding })
- when Proc, Method
- method.call(*args, &block)
- else
- if method.respond_to?(kind)
- method.send(kind, *args, &block)
- else
- raise ArgumentError,
- "Callbacks must be a symbol denoting the method to call, a string to be evaluated, " +
- "a block to be invoked, or an object responding to the callback method."
+ module ClassMethods
+ # Make the run_callbacks :save method. The generated method takes
+ # a block that it'll yield to. It'll call the before and around filters
+ # in order, yield the block, and then run the after filters.
+ #
+ # run_callbacks :save do
+ # save
+ # end
+ #
+ # The run_callbacks :save method can optionally take a key, which
+ # will be used to compile an optimized callback method for each
+ # key. See #define_callbacks for more information.
+ #
+ def __define_runner(symbol) #:nodoc:
+ body = send("_#{symbol}_callbacks").compile(nil)
+
+ body, line = <<-RUBY_EVAL, __LINE__
+ def _run_#{symbol}_callbacks(key = nil, &blk)
+ if key
+ name = "_run__\#{self.class.name.hash.abs}__#{symbol}__\#{key.hash.abs}__callbacks"
+
+ unless respond_to?(name)
+ self.class.__create_keyed_callback(name, :#{symbol}, self, &blk)
end
+
+ send(name, &blk)
+ else
+ #{body}
+ end
end
+ private :_run_#{symbol}_callbacks
+ RUBY_EVAL
+
+ silence_warnings do
+ undef_method "_run_#{symbol}_callbacks" if method_defined?("_run_#{symbol}_callbacks")
+ class_eval body, __FILE__, line
end
+ end
- def should_run_callback?(*args)
- [options[:if]].flatten.compact.all? { |a| evaluate_method(a, *args) } &&
- ![options[:unless]].flatten.compact.any? { |a| evaluate_method(a, *args) }
+ # This is called the first time a callback is called with a particular
+ # key. It creates a new callback method for the key, calculating
+ # which callbacks can be omitted because of per_key conditions.
+ #
+ def __create_keyed_callback(name, kind, object, &blk) #:nodoc:
+ @_keyed_callbacks ||= {}
+ @_keyed_callbacks[name] ||= begin
+ str = send("_#{kind}_callbacks").compile(name, object)
+ class_eval "def #{name}() #{str} end", __FILE__, __LINE__
+ true
end
- end
+ end
- def self.included(base)
- base.extend ClassMethods
- end
+ # This is used internally to append, prepend and skip callbacks to the
+ # CallbackChain.
+ #
+ def __update_callbacks(name, filters = [], block = nil) #:nodoc:
+ type = [:before, :after, :around].include?(filters.first) ? filters.shift : :before
+ options = filters.last.is_a?(Hash) ? filters.pop : {}
+ filters.unshift(block) if block
- module ClassMethods
- def define_callbacks(*callbacks)
- callbacks.each do |callback|
- class_eval <<-"end_eval", __FILE__, __LINE__ + 1
- def self.#{callback}(*methods, &block) # def self.before_save(*methods, &block)
- callbacks = CallbackChain.build(:#{callback}, *methods, &block) # callbacks = CallbackChain.build(:before_save, *methods, &block)
- @#{callback}_callbacks ||= CallbackChain.new # @before_save_callbacks ||= CallbackChain.new
- @#{callback}_callbacks.concat callbacks # @before_save_callbacks.concat callbacks
- end # end
- #
- def self.#{callback}_callback_chain # def self.before_save_callback_chain
- @#{callback}_callbacks ||= CallbackChain.new # @before_save_callbacks ||= CallbackChain.new
- #
- if superclass.respond_to?(:#{callback}_callback_chain) # if superclass.respond_to?(:before_save_callback_chain)
- CallbackChain.new( # CallbackChain.new(
- superclass.#{callback}_callback_chain + # superclass.before_save_callback_chain +
- @#{callback}_callbacks # @before_save_callbacks
- ) # )
- else # else
- @#{callback}_callbacks # @before_save_callbacks
- end # end
- end # end
- end_eval
+ chain = send("_#{name}_callbacks")
+ yield chain, type, filters, options if block_given?
+
+ __define_runner(name)
+ end
+
+ # Set callbacks for a previously defined callback.
+ #
+ # Syntax:
+ # set_callback :save, :before, :before_meth
+ # set_callback :save, :after, :after_meth, :if => :condition
+ # set_callback :save, :around, lambda { |r| stuff; yield; stuff }
+ #
+ # Use skip_callback to skip any defined one.
+ #
+ # When creating or skipping callbacks, you can specify conditions that
+ # are always the same for a given key. For instance, in ActionPack,
+ # we convert :only and :except conditions into per-key conditions.
+ #
+ # before_filter :authenticate, :except => "index"
+ # becomes
+ # dispatch_callback :before, :authenticate, :per_key => {:unless => proc {|c| c.action_name == "index"}}
+ #
+ # Per-Key conditions are evaluated only once per use of a given key.
+ # In the case of the above example, you would do:
+ #
+ # run_callbacks(:dispatch, action_name) { ... dispatch stuff ... }
+ #
+ # In that case, each action_name would get its own compiled callback
+ # method that took into consideration the per_key conditions. This
+ # is a speed improvement for ActionPack.
+ #
+ def set_callback(name, *filters, &block)
+ __update_callbacks(name, filters, block) do |chain, type, filters, options|
+ filters.map! do |filter|
+ chain.delete_if {|c| c.matches?(type, filter) }
+ Callback.new(chain, filter, type, options.dup, self)
+ end
+
+ options[:prepend] ? chain.unshift(*filters) : chain.push(*filters)
end
end
- end
- # Runs all the callbacks defined for the given options.
- #
- # If a block is given it will be called after each callback receiving as arguments:
- #
- # * the result from the callback
- # * the object which has the callback
- #
- # If the result from the block evaluates to +true+, the callback chain is stopped.
- #
- # Example:
- # class Storage
- # include ActiveSupport::Callbacks
- #
- # define_callbacks :before_save, :after_save
- # end
- #
- # class ConfigStorage < Storage
- # before_save :pass
- # before_save :pass
- # before_save :stop
- # before_save :pass
- #
- # def pass
- # puts "pass"
- # end
- #
- # def stop
- # puts "stop"
- # return false
- # end
- #
- # def save
- # result = run_callbacks(:before_save) { |result, object| result == false }
- # puts "- save" if result
- # end
- # end
- #
- # config = ConfigStorage.new
- # config.save
- #
- # Output:
- # pass
- # pass
- # stop
- def run_callbacks(kind, options = {}, &block)
- self.class.send("#{kind}_callback_chain").run(self, options, &block)
+ # Skip a previously defined callback for a given type.
+ #
+ def skip_callback(name, *filters, &block)
+ __update_callbacks(name, filters, block) do |chain, type, filters, options|
+ chain = send("_#{name}_callbacks=", chain.clone(self))
+
+ filters.each do |filter|
+ filter = chain.find {|c| c.matches?(type, filter) }
+
+ if filter && options.any?
+ filter.recompile!(options, options[:per_key] || {})
+ else
+ chain.delete(filter)
+ end
+ end
+ end
+ end
+
+ # Reset callbacks for a given type.
+ #
+ def reset_callbacks(symbol)
+ send("_#{symbol}_callbacks").clear
+ __define_runner(symbol)
+ end
+
+ # Define callbacks types.
+ #
+ # ==== Example
+ #
+ # define_callbacks :validate
+ #
+ # ==== Options
+ #
+ # * <tt>:terminator</tt> - Indicates when a before filter is considered
+ # to be halted.
+ #
+ # define_callbacks :validate, :terminator => "result == false"
+ #
+ # In the example above, if any before validate callbacks returns false,
+ # other callbacks are not executed. Defaults to "false".
+ #
+ # * <tt>:rescuable</tt> - By default, after filters are not executed if
+ # the given block or an before_filter raises an error. Supply :rescuable => true
+ # to change this behavior.
+ #
+ # * <tt>:scope</tt> - Show which methods should be executed when a class
+ # is giben as callback:
+ #
+ # define_callbacks :filters, :scope => [ :kind ]
+ #
+ # When a class is given:
+ #
+ # before_filter MyFilter
+ #
+ # It will call the type of the filter in the given class, which in this
+ # case, is "before".
+ #
+ # If, for instance, you supply the given scope:
+ #
+ # define_callbacks :validate, :scope => [ :kind, :name ]
+ #
+ # It will call "#{kind}_#{name}" in the given class. So "before_validate"
+ # will be called in the class below:
+ #
+ # before_validate MyValidation
+ #
+ # Defaults to :kind.
+ #
+ def define_callbacks(*symbols)
+ config = symbols.last.is_a?(Hash) ? symbols.pop : {}
+ symbols.each do |symbol|
+ extlib_inheritable_accessor("_#{symbol}_callbacks") do
+ CallbackChain.new(symbol, config)
+ end
+
+ __define_runner(symbol)
+ end
+ end
end
end
end
diff --git a/activesupport/lib/active_support/concern.rb b/activesupport/lib/active_support/concern.rb
index dcf1e8152f..eb31f7cad4 100644
--- a/activesupport/lib/active_support/concern.rb
+++ b/activesupport/lib/active_support/concern.rb
@@ -1,11 +1,17 @@
-require 'active_support/dependency_module'
-
module ActiveSupport
module Concern
- include DependencyModule
+ def self.extended(base)
+ base.instance_variable_set("@_dependencies", [])
+ end
def append_features(base)
- if super
+ if base.instance_variable_defined?("@_dependencies")
+ base.instance_variable_get("@_dependencies") << self
+ return false
+ else
+ return false if base < self
+ @_dependencies.each { |dep| base.send(:include, dep) }
+ super
base.extend const_get("ClassMethods") if const_defined?("ClassMethods")
base.send :include, const_get("InstanceMethods") if const_defined?("InstanceMethods")
base.class_eval(&@_included_block) if instance_variable_defined?("@_included_block")
@@ -19,7 +25,5 @@ module ActiveSupport
super
end
end
-
- alias_method :include, :depends_on
end
end
diff --git a/activesupport/lib/active_support/concurrent_hash.rb b/activesupport/lib/active_support/concurrent_hash.rb
deleted file mode 100644
index 40224765a7..0000000000
--- a/activesupport/lib/active_support/concurrent_hash.rb
+++ /dev/null
@@ -1,27 +0,0 @@
-module ActiveSupport
- class ConcurrentHash
- def initialize(hash = {})
- @backup_cache = hash.dup
- @frozen_cache = hash.dup.freeze
- @mutex = Mutex.new
- end
-
- def []=(k,v)
- @mutex.synchronize { @backup_cache[k] = v }
- @frozen_cache = @backup_cache.dup.freeze
- v
- end
-
- def [](k)
- if @frozen_cache.key?(k)
- @frozen_cache[k]
- else
- @mutex.synchronize { @backup_cache[k] }
- end
- end
-
- def empty?
- @backup_cache.empty?
- end
- end
-end
diff --git a/activesupport/lib/active_support/configurable.rb b/activesupport/lib/active_support/configurable.rb
new file mode 100644
index 0000000000..890f465ce1
--- /dev/null
+++ b/activesupport/lib/active_support/configurable.rb
@@ -0,0 +1,35 @@
+require "active_support/concern"
+
+module ActiveSupport
+ module Configurable
+ extend ActiveSupport::Concern
+
+ module ClassMethods
+ def get_config
+ module_parts = name.split("::")
+ modules = [Object]
+ module_parts.each {|name| modules.push modules.last.const_get(name) }
+ modules.reverse_each do |mod|
+ return mod.const_get(:DEFAULT_CONFIG) if const_defined?(:DEFAULT_CONFIG)
+ end
+ {}
+ end
+
+ def config
+ self.config = get_config unless @config
+ @config
+ end
+
+ def config=(hash)
+ @config = ActiveSupport::OrderedOptions.new
+ hash.each do |key, value|
+ @config[key] = value
+ end
+ end
+ end
+
+ def config
+ self.class.config
+ end
+ end
+end \ No newline at end of file
diff --git a/activesupport/lib/active_support/core_ext/array/conversions.rb b/activesupport/lib/active_support/core_ext/array/conversions.rb
index c53cf3f530..db140225e8 100644
--- a/activesupport/lib/active_support/core_ext/array/conversions.rb
+++ b/activesupport/lib/active_support/core_ext/array/conversions.rb
@@ -40,22 +40,6 @@ class Array
end
end
-
- # Calls <tt>to_param</tt> on all its elements and joins the result with
- # slashes. This is used by <tt>url_for</tt> in Action Pack.
- def to_param
- collect { |e| e.to_param }.join '/'
- end
-
- # Converts an array into a string suitable for use as a URL query string,
- # using the given +key+ as the param name.
- #
- # ['Rails', 'coding'].to_query('hobbies') # => "hobbies%5B%5D=Rails&hobbies%5B%5D=coding"
- def to_query(key)
- prefix = "#{key}[]"
- collect { |value| value.to_query(prefix) }.join '&'
- end
-
# Converts a collection of elements into a formatted string by calling
# <tt>to_s</tt> on all elements and joining them:
#
diff --git a/activesupport/lib/active_support/core_ext/array/wrap.rb b/activesupport/lib/active_support/core_ext/array/wrap.rb
index 0eb93a0ded..e211bdeeca 100644
--- a/activesupport/lib/active_support/core_ext/array/wrap.rb
+++ b/activesupport/lib/active_support/core_ext/array/wrap.rb
@@ -11,17 +11,12 @@ class Array
# Array("foo\nbar") # => ["foo\n", "bar"], in Ruby 1.8
# Array.wrap("foo\nbar") # => ["foo\nbar"]
def self.wrap(object)
- case object
- when nil
+ if object.nil?
[]
- when self
- object
+ elsif object.respond_to?(:to_ary)
+ object.to_ary
else
- if object.respond_to?(:to_ary)
- object.to_ary
- else
- [object]
- end
+ [object]
end
end
end
diff --git a/activesupport/lib/active_support/core_ext/boolean.rb b/activesupport/lib/active_support/core_ext/boolean.rb
deleted file mode 100644
index be834288f2..0000000000
--- a/activesupport/lib/active_support/core_ext/boolean.rb
+++ /dev/null
@@ -1 +0,0 @@
-require 'active_support/core_ext/boolean/conversions' \ No newline at end of file
diff --git a/activesupport/lib/active_support/core_ext/boolean/conversions.rb b/activesupport/lib/active_support/core_ext/boolean/conversions.rb
deleted file mode 100644
index 534ebb7118..0000000000
--- a/activesupport/lib/active_support/core_ext/boolean/conversions.rb
+++ /dev/null
@@ -1,11 +0,0 @@
-class TrueClass
- def to_param
- self
- end
-end
-
-class FalseClass
- def to_param
- self
- end
-end
diff --git a/activesupport/lib/active_support/core_ext/class/delegating_attributes.rb b/activesupport/lib/active_support/core_ext/class/delegating_attributes.rb
index 6c67df7f50..301c09fc73 100644
--- a/activesupport/lib/active_support/core_ext/class/delegating_attributes.rb
+++ b/activesupport/lib/active_support/core_ext/class/delegating_attributes.rb
@@ -1,39 +1,57 @@
require 'active_support/core_ext/object/blank'
+require 'active_support/core_ext/object/duplicable'
+require 'active_support/core_ext/array/extract_options'
class Class
def superclass_delegating_reader(*names)
- class_name_to_stop_searching_on = superclass.name.blank? ? "Object" : superclass.name
+ class_to_stop_searching_on = superclass.name.blank? ? "Object" : superclass.name
+ options = names.extract_options!
+
names.each do |name|
- class_eval(<<-EOS, __FILE__, __LINE__ + 1)
- def self.#{name} # def self.only_reader
- if defined?(@#{name}) # if defined?(@only_reader)
- @#{name} # @only_reader
- elsif superclass < #{class_name_to_stop_searching_on} && # elsif superclass < Object &&
- superclass.respond_to?(:#{name}) # superclass.respond_to?(:only_reader)
- superclass.#{name} # superclass.only_reader
- end # end
- end # end
- def #{name} # def only_reader
- self.class.#{name} # self.class.only_reader
- end # end
- def self.#{name}? # def self.only_reader?
- !!#{name} # !!only_reader
- end # end
- def #{name}? # def only_reader?
- !!#{name} # !!only_reader
- end # end
+ # def self.only_reader
+ # if defined?(@only_reader)
+ # @only_reader
+ # elsif superclass < Object && superclass.respond_to?(:only_reader)
+ # superclass.only_reader
+ # end
+ # end
+ class_eval <<-EOS, __FILE__, __LINE__ + 1
+ def self.#{name}
+ if defined?(@#{name})
+ @#{name}
+ elsif superclass < #{class_to_stop_searching_on} && superclass.respond_to?(:#{name})
+ superclass.#{name}
+ end
+ end
EOS
+
+ unless options[:instance_reader] == false
+ class_eval <<-EOS, __FILE__, __LINE__ + 1
+ def #{name} # def only_reader
+ self.class.#{name} # self.class.only_reader
+ end # end
+ def self.#{name}? # def self.only_reader?
+ !!#{name} # !!only_reader
+ end # end
+ def #{name}? # def only_reader?
+ !!#{name} # !!only_reader
+ end # end
+ EOS
+ end
end
end
def superclass_delegating_writer(*names, &block)
+ options = names.extract_options!
+
names.each do |name|
- class_eval(<<-EOS, __FILE__, __LINE__ + 1)
+ class_eval <<-EOS, __FILE__, __LINE__ + 1
def self.#{name}=(value) # def self.property=(value)
@#{name} = value # @property = value
end # end
EOS
- self.send("#{name}=", yield) if block_given?
+
+ self.send(:"#{name}=", yield) if block_given?
end
end
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 8bac2dff19..e4d22516c1 100644
--- a/activesupport/lib/active_support/core_ext/class/inheritable_attributes.rb
+++ b/activesupport/lib/active_support/core_ext/class/inheritable_attributes.rb
@@ -1,4 +1,5 @@
require 'active_support/core_ext/object/duplicable'
+require 'active_support/core_ext/array/extract_options'
# Retain for backward compatibility. Methods are now included in Class.
module ClassInheritableAttributes # :nodoc:
@@ -10,16 +11,19 @@ end
# children, which is unlike the regular class-level attributes that are shared across the entire hierarchy.
class Class # :nodoc:
def class_inheritable_reader(*syms)
+ options = syms.extract_options!
syms.each do |sym|
next if sym.is_a?(Hash)
class_eval(<<-EOS, __FILE__, __LINE__ + 1)
- def self.#{sym} # def self.after_add
- read_inheritable_attribute(:#{sym}) # read_inheritable_attribute(:after_add)
- end # end
-
- def #{sym} # def after_add
- self.class.#{sym} # self.class.after_add
- end # end
+ def self.#{sym} # def self.after_add
+ read_inheritable_attribute(:#{sym}) # read_inheritable_attribute(:after_add)
+ end # end
+ #
+ #{" #
+ def #{sym} # def after_add
+ self.class.#{sym} # self.class.after_add
+ end # end
+ " unless options[:instance_reader] == false } # # the reader above is generated unless options[:instance_reader] == false
EOS
end
end
@@ -156,7 +160,7 @@ class Class
# moving on). In particular, this makes the return value of this function
# less useful.
def extlib_inheritable_reader(*ivars)
- instance_reader = ivars.pop[:reader] if ivars.last.is_a?(Hash)
+ options = ivars.extract_options!
ivars.each do |ivar|
self.class_eval <<-RUBY, __FILE__, __LINE__ + 1
@@ -164,10 +168,10 @@ class Class
return @#{ivar} if self.object_id == #{self.object_id} || defined?(@#{ivar})
ivar = superclass.#{ivar}
return nil if ivar.nil? && !#{self}.instance_variable_defined?("@#{ivar}")
- @#{ivar} = ivar && !ivar.is_a?(Module) && !ivar.is_a?(Numeric) && !ivar.is_a?(TrueClass) && !ivar.is_a?(FalseClass) ? ivar.dup : ivar
+ @#{ivar} = ivar.duplicable? ? ivar.dup : ivar
end
RUBY
- unless instance_reader == false
+ unless options[:instance_reader] == false
self.class_eval <<-RUBY, __FILE__, __LINE__ + 1
def #{ivar}
self.class.#{ivar}
@@ -190,14 +194,15 @@ class Class
# @todo We need a style for class_eval <<-HEREDOC. I'd like to make it
# class_eval(<<-RUBY, __FILE__, __LINE__), but we should codify it somewhere.
def extlib_inheritable_writer(*ivars)
- instance_writer = ivars.pop[:writer] if ivars.last.is_a?(Hash)
+ options = ivars.extract_options!
+
ivars.each do |ivar|
self.class_eval <<-RUBY, __FILE__, __LINE__ + 1
def self.#{ivar}=(obj)
@#{ivar} = obj
end
RUBY
- unless instance_writer == false
+ unless options[:instance_writer] == false
self.class_eval <<-RUBY, __FILE__, __LINE__ + 1
def #{ivar}=(obj) self.class.#{ivar} = obj end
RUBY
diff --git a/activesupport/lib/active_support/core_ext/date.rb b/activesupport/lib/active_support/core_ext/date.rb
deleted file mode 100644
index 6672129076..0000000000
--- a/activesupport/lib/active_support/core_ext/date.rb
+++ /dev/null
@@ -1,7 +0,0 @@
-require 'date'
-
-require 'active_support/core_ext/date/acts_like'
-require 'active_support/core_ext/date/freeze'
-
-require 'active_support/core_ext/date/calculations'
-require 'active_support/core_ext/date/conversions'
diff --git a/activesupport/lib/active_support/core_ext/date/calculations.rb b/activesupport/lib/active_support/core_ext/date/calculations.rb
index ce3bebc25a..3dd61334d0 100644
--- a/activesupport/lib/active_support/core_ext/date/calculations.rb
+++ b/activesupport/lib/active_support/core_ext/date/calculations.rb
@@ -1,4 +1,5 @@
require 'active_support/duration'
+require 'active_support/core_ext/time/zones'
class Date
class << self
diff --git a/activesupport/lib/active_support/core_ext/date/conversions.rb b/activesupport/lib/active_support/core_ext/date/conversions.rb
index 54facf4430..f6c870035b 100644
--- a/activesupport/lib/active_support/core_ext/date/conversions.rb
+++ b/activesupport/lib/active_support/core_ext/date/conversions.rb
@@ -1,6 +1,4 @@
require 'active_support/inflector'
-require 'active_support/core_ext/time/conversions'
-require 'active_support/core_ext/date_time/conversions'
class Date
DATE_FORMATS = {
diff --git a/activesupport/lib/active_support/core_ext/date_time.rb b/activesupport/lib/active_support/core_ext/date_time.rb
deleted file mode 100644
index 004fd0ad29..0000000000
--- a/activesupport/lib/active_support/core_ext/date_time.rb
+++ /dev/null
@@ -1,5 +0,0 @@
-require 'active_support/core_ext/time'
-require 'active_support/core_ext/date_time/acts_like'
-require 'active_support/core_ext/date_time/calculations'
-require 'active_support/core_ext/date_time/conversions'
-require 'active_support/core_ext/date_time/zones'
diff --git a/activesupport/lib/active_support/core_ext/date_time/calculations.rb b/activesupport/lib/active_support/core_ext/date_time/calculations.rb
index 41cf020f94..e93abfa4a3 100644
--- a/activesupport/lib/active_support/core_ext/date_time/calculations.rb
+++ b/activesupport/lib/active_support/core_ext/date_time/calculations.rb
@@ -1,4 +1,4 @@
-require 'rational'
+require 'rational' unless RUBY_VERSION >= '1.9.2'
class DateTime
class << self
diff --git a/activesupport/lib/active_support/core_ext/enumerable.rb b/activesupport/lib/active_support/core_ext/enumerable.rb
index 15a303cf04..b11c916f61 100644
--- a/activesupport/lib/active_support/core_ext/enumerable.rb
+++ b/activesupport/lib/active_support/core_ext/enumerable.rb
@@ -101,15 +101,6 @@ module Enumerable
size = block_given? ? select(&block).size : self.size
size > 1
end
-
- # Returns true if none of the elements match the given block.
- #
- # success = responses.none? {|r| r.status / 100 == 5 }
- #
- # This is a builtin method in Ruby 1.8.7 and later.
- def none?(&block)
- !any?(&block)
- end unless [].respond_to?(:none?)
end
class Range #:nodoc:
diff --git a/activesupport/lib/active_support/core_ext/hash/conversions.rb b/activesupport/lib/active_support/core_ext/hash/conversions.rb
index aa686ec2eb..c6b6dc1e5e 100644
--- a/activesupport/lib/active_support/core_ext/hash/conversions.rb
+++ b/activesupport/lib/active_support/core_ext/hash/conversions.rb
@@ -1,6 +1,5 @@
require 'active_support/time'
-require 'active_support/core_ext/object/conversions'
-require 'active_support/core_ext/array/conversions'
+require 'active_support/core_ext/array/wrap'
require 'active_support/core_ext/hash/reverse_merge'
class Hash
@@ -68,21 +67,6 @@ class Hash
)
end
- # Converts a hash into a string suitable for use as a URL query string. An optional <tt>namespace</tt> can be
- # passed to enclose the param names (see example below).
- #
- # ==== Examples
- # { :name => 'David', :nationality => 'Danish' }.to_query # => "name=David&nationality=Danish"
- #
- # { :name => 'David', :nationality => 'Danish' }.to_query('user') # => "user%5Bname%5D=David&user%5Bnationality%5D=Danish"
- def to_query(namespace = nil)
- collect do |key, value|
- value.to_query(namespace ? "#{namespace}[#{key}]" : key)
- end.sort * '&'
- end
-
- alias_method :to_param, :to_query
-
# Returns a string containing an XML representation of its receiver:
#
# {"foo" => 1, "bar" => 2}.to_xml
@@ -203,7 +187,7 @@ class Hash
case value.class.to_s
when 'Hash'
if value['type'] == 'array'
- child_key, entries = value.detect { |k,v| k != 'type' } # child_key is throwaway
+ child_key, entries = Array.wrap(value.detect { |k,v| k != 'type' }) # child_key is throwaway
if entries.nil? || (c = value['__content__'] && c.blank?)
[]
else
diff --git a/activesupport/lib/active_support/core_ext/hash/slice.rb b/activesupport/lib/active_support/core_ext/hash/slice.rb
index 7aa394d7bf..e4a864c20f 100644
--- a/activesupport/lib/active_support/core_ext/hash/slice.rb
+++ b/activesupport/lib/active_support/core_ext/hash/slice.rb
@@ -29,4 +29,10 @@ class Hash
replace(hash)
omit
end
+
+ def extract!(*keys)
+ result = {}
+ keys.each {|key| result[key] = delete(key) }
+ result
+ end
end
diff --git a/activesupport/lib/active_support/core_ext/integer.rb b/activesupport/lib/active_support/core_ext/integer.rb
index 7ba018ed7f..a44a1b4c74 100644
--- a/activesupport/lib/active_support/core_ext/integer.rb
+++ b/activesupport/lib/active_support/core_ext/integer.rb
@@ -1,3 +1,3 @@
-require 'active_support/core_ext/integer/even_odd'
+require 'active_support/core_ext/integer/multiple'
require 'active_support/core_ext/integer/inflections'
require 'active_support/core_ext/integer/time'
diff --git a/activesupport/lib/active_support/core_ext/integer/even_odd.rb b/activesupport/lib/active_support/core_ext/integer/even_odd.rb
deleted file mode 100644
index 8f9a97b44c..0000000000
--- a/activesupport/lib/active_support/core_ext/integer/even_odd.rb
+++ /dev/null
@@ -1,16 +0,0 @@
-class Integer
- # Check whether the integer is evenly divisible by the argument.
- def multiple_of?(number)
- self % number == 0
- end
-
- # Is the integer a multiple of 2?
- def even?
- multiple_of? 2
- end unless method_defined?(:even?)
-
- # Is the integer not a multiple of 2?
- def odd?
- !even?
- end unless method_defined?(:odd?)
-end
diff --git a/activesupport/lib/active_support/core_ext/integer/multiple.rb b/activesupport/lib/active_support/core_ext/integer/multiple.rb
new file mode 100644
index 0000000000..40bea54c67
--- /dev/null
+++ b/activesupport/lib/active_support/core_ext/integer/multiple.rb
@@ -0,0 +1,6 @@
+class Integer
+ # Check whether the integer is evenly divisible by the argument.
+ def multiple_of?(number)
+ self % number == 0
+ end
+end
diff --git a/activesupport/lib/active_support/core_ext/kernel/debugger.rb b/activesupport/lib/active_support/core_ext/kernel/debugger.rb
index 0813a51383..59e03e3df7 100644
--- a/activesupport/lib/active_support/core_ext/kernel/debugger.rb
+++ b/activesupport/lib/active_support/core_ext/kernel/debugger.rb
@@ -7,6 +7,7 @@ module Kernel
end
end
+ undef :breakpoint if respond_to?(:breakpoint)
def breakpoint
message = "\n***** The 'breakpoint' command has been renamed 'debugger' -- please change *****\n"
defined?(Rails) ? Rails.logger.info(message) : $stderr.puts(message)
diff --git a/activesupport/lib/active_support/core_ext/name_error.rb b/activesupport/lib/active_support/core_ext/name_error.rb
index cd165626c8..e1ebd4f91c 100644
--- a/activesupport/lib/active_support/core_ext/name_error.rb
+++ b/activesupport/lib/active_support/core_ext/name_error.rb
@@ -1,7 +1,9 @@
class NameError
# Extract the name of the missing constant from the exception message.
def missing_name
- $1 if /((::)?([A-Z]\w*)(::[A-Z]\w*)*)$/ =~ message
+ if /undefined local variable or method/ !~ message
+ $1 if /((::)?([A-Z]\w*)(::[A-Z]\w*)*)$/ =~ message
+ end
end
# Was this exception raised because the given name was missing?
diff --git a/activesupport/lib/active_support/core_ext/nil.rb b/activesupport/lib/active_support/core_ext/nil.rb
deleted file mode 100644
index e9f63c4802..0000000000
--- a/activesupport/lib/active_support/core_ext/nil.rb
+++ /dev/null
@@ -1 +0,0 @@
-require 'active_support/core_ext/nil/conversions' \ No newline at end of file
diff --git a/activesupport/lib/active_support/core_ext/nil/conversions.rb b/activesupport/lib/active_support/core_ext/nil/conversions.rb
deleted file mode 100644
index 6ceb500a2a..0000000000
--- a/activesupport/lib/active_support/core_ext/nil/conversions.rb
+++ /dev/null
@@ -1,5 +0,0 @@
-class NilClass
- def to_param
- self
- end
-end
diff --git a/activesupport/lib/active_support/core_ext/object/conversions.rb b/activesupport/lib/active_support/core_ext/object/conversions.rb
index 638f0decc1..540f7aadb0 100644
--- a/activesupport/lib/active_support/core_ext/object/conversions.rb
+++ b/activesupport/lib/active_support/core_ext/object/conversions.rb
@@ -1,18 +1,4 @@
+require 'active_support/core_ext/object/to_param'
+require 'active_support/core_ext/object/to_query'
require 'active_support/core_ext/array/conversions'
require 'active_support/core_ext/hash/conversions'
-
-class Object
- # Alias of <tt>to_s</tt>.
- def to_param
- to_s
- end
-
- # Converts an object into a string suitable for use as a URL query string, using the given <tt>key</tt> as the
- # param name.
- #
- # Note: This method is defined as a default implementation for all Objects for Hash#to_query to work.
- def to_query(key)
- require 'cgi' unless defined?(CGI) && defined?(CGI::escape)
- "#{CGI.escape(key.to_s)}=#{CGI.escape(to_param.to_s)}"
- end
-end
diff --git a/activesupport/lib/active_support/core_ext/object/duplicable.rb b/activesupport/lib/active_support/core_ext/object/duplicable.rb
index 1722726ca2..a2d4d50076 100644
--- a/activesupport/lib/active_support/core_ext/object/duplicable.rb
+++ b/activesupport/lib/active_support/core_ext/object/duplicable.rb
@@ -1,6 +1,6 @@
class Object
# Can you safely .dup this object?
- # False for nil, false, true, symbols, numbers, and class objects; true otherwise.
+ # False for nil, false, true, symbols, numbers, class and module objects; true otherwise.
def duplicable?
true
end
@@ -41,3 +41,9 @@ class Class #:nodoc:
false
end
end
+
+class Module #:nodoc:
+ def duplicable?
+ false
+ end
+end
diff --git a/activesupport/lib/active_support/core_ext/object/extending.rb b/activesupport/lib/active_support/core_ext/object/extending.rb
index bbf6f8563b..0cc74c8298 100644
--- a/activesupport/lib/active_support/core_ext/object/extending.rb
+++ b/activesupport/lib/active_support/core_ext/object/extending.rb
@@ -50,31 +50,4 @@ class Object
def extend_with_included_modules_from(object) #:nodoc:
object.extended_by.each { |mod| extend mod }
end
-
- unless defined? instance_exec # 1.9
- module InstanceExecMethods #:nodoc:
- end
- include InstanceExecMethods
-
- # Evaluate the block with the given arguments within the context of
- # this object, so self is set to the method receiver.
- #
- # From Mauricio's http://eigenclass.org/hiki/bounded+space+instance_exec
- def instance_exec(*args, &block)
- begin
- old_critical, Thread.critical = Thread.critical, true
- n = 0
- n += 1 while respond_to?(method_name = "__instance_exec#{n}")
- InstanceExecMethods.module_eval { define_method(method_name, &block) }
- ensure
- Thread.critical = old_critical
- end
-
- begin
- send(method_name, *args)
- ensure
- InstanceExecMethods.module_eval { remove_method(method_name) } rescue nil
- end
- end
- end
end
diff --git a/activesupport/lib/active_support/core_ext/object/instance_variables.rb b/activesupport/lib/active_support/core_ext/object/instance_variables.rb
index 4ecaab3bbb..866317b17a 100644
--- a/activesupport/lib/active_support/core_ext/object/instance_variables.rb
+++ b/activesupport/lib/active_support/core_ext/object/instance_variables.rb
@@ -1,11 +1,4 @@
class Object
- # Available in 1.8.6 and later.
- unless respond_to?(:instance_variable_defined?)
- def instance_variable_defined?(variable)
- instance_variables.include?(variable.to_s)
- end
- end
-
# Returns a hash that maps instance variable names without "@" to their
# corresponding values. Keys are strings both in Ruby 1.8 and 1.9.
#
diff --git a/activesupport/lib/active_support/core_ext/object/misc.rb b/activesupport/lib/active_support/core_ext/object/misc.rb
index 80011dfbed..3e3af03cc5 100644
--- a/activesupport/lib/active_support/core_ext/object/misc.rb
+++ b/activesupport/lib/active_support/core_ext/object/misc.rb
@@ -1,3 +1,2 @@
require 'active_support/core_ext/object/returning'
-require 'active_support/core_ext/object/tap'
require 'active_support/core_ext/object/with_options'
diff --git a/activesupport/lib/active_support/core_ext/object/tap.rb b/activesupport/lib/active_support/core_ext/object/tap.rb
deleted file mode 100644
index db7e715e2d..0000000000
--- a/activesupport/lib/active_support/core_ext/object/tap.rb
+++ /dev/null
@@ -1,16 +0,0 @@
-class Object
- # Yields <code>x</code> to the block, and then returns <code>x</code>.
- # The primary purpose of this method is to "tap into" a method chain,
- # in order to perform operations on intermediate results within the chain.
- #
- # (1..10).tap { |x| puts "original: #{x.inspect}" }.to_a.
- # tap { |x| puts "array: #{x.inspect}" }.
- # select { |x| x%2 == 0 }.
- # tap { |x| puts "evens: #{x.inspect}" }.
- # map { |x| x*x }.
- # tap { |x| puts "squares: #{x.inspect}" }
- def tap
- yield self
- self
- end unless Object.respond_to?(:tap)
-end
diff --git a/activesupport/lib/active_support/core_ext/object/to_param.rb b/activesupport/lib/active_support/core_ext/object/to_param.rb
new file mode 100644
index 0000000000..a5e2260791
--- /dev/null
+++ b/activesupport/lib/active_support/core_ext/object/to_param.rb
@@ -0,0 +1,47 @@
+class Object
+ # Alias of <tt>to_s</tt>.
+ def to_param
+ to_s
+ end
+end
+
+class NilClass
+ def to_param
+ self
+ end
+end
+
+class TrueClass
+ def to_param
+ self
+ end
+end
+
+class FalseClass
+ def to_param
+ self
+ end
+end
+
+class Array
+ # Calls <tt>to_param</tt> on all its elements and joins the result with
+ # slashes. This is used by <tt>url_for</tt> in Action Pack.
+ def to_param
+ collect { |e| e.to_param }.join '/'
+ end
+end
+
+class Hash
+ # Converts a hash into a string suitable for use as a URL query string. An optional <tt>namespace</tt> can be
+ # passed to enclose the param names (see example below).
+ #
+ # ==== Examples
+ # { :name => 'David', :nationality => 'Danish' }.to_query # => "name=David&nationality=Danish"
+ #
+ # { :name => 'David', :nationality => 'Danish' }.to_query('user') # => "user%5Bname%5D=David&user%5Bnationality%5D=Danish"
+ def to_param(namespace = nil)
+ collect do |key, value|
+ value.to_query(namespace ? "#{namespace}[#{key}]" : key)
+ end.sort * '&'
+ end
+end
diff --git a/activesupport/lib/active_support/core_ext/object/to_query.rb b/activesupport/lib/active_support/core_ext/object/to_query.rb
new file mode 100644
index 0000000000..3f1540f685
--- /dev/null
+++ b/activesupport/lib/active_support/core_ext/object/to_query.rb
@@ -0,0 +1,27 @@
+require 'active_support/core_ext/object/to_param'
+
+class Object
+ # Converts an object into a string suitable for use as a URL query string, using the given <tt>key</tt> as the
+ # param name.
+ #
+ # Note: This method is defined as a default implementation for all Objects for Hash#to_query to work.
+ def to_query(key)
+ require 'cgi' unless defined?(CGI) && defined?(CGI::escape)
+ "#{CGI.escape(key.to_s)}=#{CGI.escape(to_param.to_s)}"
+ end
+end
+
+class Array
+ # Converts an array into a string suitable for use as a URL query string,
+ # using the given +key+ as the param name.
+ #
+ # ['Rails', 'coding'].to_query('hobbies') # => "hobbies%5B%5D=Rails&hobbies%5B%5D=coding"
+ def to_query(key)
+ prefix = "#{key}[]"
+ collect { |value| value.to_query(prefix) }.join '&'
+ end
+end
+
+class Hash
+ alias_method :to_query, :to_param
+end
diff --git a/activesupport/lib/active_support/core_ext/regexp.rb b/activesupport/lib/active_support/core_ext/regexp.rb
index 95d06ee6ee..784145f5fb 100644
--- a/activesupport/lib/active_support/core_ext/regexp.rb
+++ b/activesupport/lib/active_support/core_ext/regexp.rb
@@ -1,27 +1,5 @@
class Regexp #:nodoc:
- def number_of_captures
- Regexp.new("|#{source}").match('').captures.length
- end
-
def multiline?
options & MULTILINE == MULTILINE
end
-
- class << self
- def optionalize(pattern)
- return pattern if pattern == ""
-
- case unoptionalize(pattern)
- when /\A(.|\(.*\))\Z/ then "#{pattern}?"
- else "(?:#{pattern})?"
- end
- end
-
- def unoptionalize(pattern)
- [/\A\(\?:(.*)\)\?\Z/, /\A(.|\(.*\))\?\Z/].each do |regexp|
- return $1 if regexp =~ pattern
- end
- return pattern
- end
- end
end
diff --git a/activesupport/lib/active_support/core_ext/string.rb b/activesupport/lib/active_support/core_ext/string.rb
index 6c52f12712..0365b6af1c 100644
--- a/activesupport/lib/active_support/core_ext/string.rb
+++ b/activesupport/lib/active_support/core_ext/string.rb
@@ -4,7 +4,6 @@ require 'active_support/core_ext/string/multibyte'
require 'active_support/core_ext/string/starts_ends_with'
require 'active_support/core_ext/string/inflections'
require 'active_support/core_ext/string/access'
-require 'active_support/core_ext/string/iterators'
require 'active_support/core_ext/string/xchar'
require 'active_support/core_ext/string/behavior'
require 'active_support/core_ext/string/interpolation'
diff --git a/activesupport/lib/active_support/core_ext/string/access.rb b/activesupport/lib/active_support/core_ext/string/access.rb
index bf11d16365..64bc8f6cea 100644
--- a/activesupport/lib/active_support/core_ext/string/access.rb
+++ b/activesupport/lib/active_support/core_ext/string/access.rb
@@ -1,3 +1,5 @@
+require "active_support/multibyte"
+
class String
unless '1.9'.respond_to?(:force_encoding)
# Returns the character at the +position+ treating the string as an array (where 0 is the first character).
diff --git a/activesupport/lib/active_support/core_ext/string/bytesize.rb b/activesupport/lib/active_support/core_ext/string/bytesize.rb
deleted file mode 100644
index ed051b921e..0000000000
--- a/activesupport/lib/active_support/core_ext/string/bytesize.rb
+++ /dev/null
@@ -1,5 +0,0 @@
-unless '1.9'.respond_to?(:bytesize)
- class String
- alias :bytesize :size
- end
-end
diff --git a/activesupport/lib/active_support/core_ext/string/interpolation.rb b/activesupport/lib/active_support/core_ext/string/interpolation.rb
index d9159b690a..41a061c1a4 100644
--- a/activesupport/lib/active_support/core_ext/string/interpolation.rb
+++ b/activesupport/lib/active_support/core_ext/string/interpolation.rb
@@ -6,7 +6,6 @@
=end
if RUBY_VERSION < '1.9'
- require 'active_support/core_ext/string/bytesize'
# KeyError is raised by String#% when the string contains a named placeholder
# that is not contained in the given arguments hash. Ruby 1.9 includes and
diff --git a/activesupport/lib/active_support/core_ext/string/iterators.rb b/activesupport/lib/active_support/core_ext/string/iterators.rb
deleted file mode 100644
index 2f8aa84024..0000000000
--- a/activesupport/lib/active_support/core_ext/string/iterators.rb
+++ /dev/null
@@ -1,13 +0,0 @@
-unless '1.9'.respond_to?(:each_char)
- class String
- # Yields a single-character string for each character in the string.
- # When $KCODE = 'UTF8', multi-byte characters are yielded appropriately.
- def each_char
- require 'strscan' unless defined? ::StringScanner
- scanner, char = ::StringScanner.new(self), /./mu
- while c = scanner.scan(char)
- yield c
- end
- end
- end
-end
diff --git a/activesupport/lib/active_support/core_ext/string/starts_ends_with.rb b/activesupport/lib/active_support/core_ext/string/starts_ends_with.rb
index f65bb8f75b..641acf62d0 100644
--- a/activesupport/lib/active_support/core_ext/string/starts_ends_with.rb
+++ b/activesupport/lib/active_support/core_ext/string/starts_ends_with.rb
@@ -1,18 +1,4 @@
class String
- unless '1.8.7 and up'.respond_to?(:start_with?)
- # Does the string start with the specified +prefix+?
- def start_with?(prefix)
- prefix = prefix.to_s
- self[0, prefix.length] == prefix
- end
-
- # Does the string end with the specified +suffix+?
- def end_with?(suffix)
- suffix = suffix.to_s
- self[-suffix.length, suffix.length] == suffix
- end
- end
-
alias_method :starts_with?, :start_with?
alias_method :ends_with?, :end_with?
end
diff --git a/activesupport/lib/active_support/core_ext/symbol.rb b/activesupport/lib/active_support/core_ext/symbol.rb
deleted file mode 100644
index c103cd9dcf..0000000000
--- a/activesupport/lib/active_support/core_ext/symbol.rb
+++ /dev/null
@@ -1 +0,0 @@
-require 'active_support/core_ext/symbol/to_proc'
diff --git a/activesupport/lib/active_support/core_ext/symbol/to_proc.rb b/activesupport/lib/active_support/core_ext/symbol/to_proc.rb
deleted file mode 100644
index 520369452b..0000000000
--- a/activesupport/lib/active_support/core_ext/symbol/to_proc.rb
+++ /dev/null
@@ -1,14 +0,0 @@
-class Symbol
- # Turns the symbol into a simple proc, which is especially useful for enumerations. Examples:
- #
- # # The same as people.collect { |p| p.name }
- # people.collect(&:name)
- #
- # # The same as people.select { |p| p.manager? }.collect { |p| p.salary }
- # people.select(&:manager?).collect(&:salary)
- #
- # This is a builtin method in Ruby 1.8.7 and later.
- def to_proc
- Proc.new { |*args| args.shift.__send__(self, *args) }
- end unless :to_proc.respond_to?(:to_proc)
-end
diff --git a/activesupport/lib/active_support/core_ext/time.rb b/activesupport/lib/active_support/core_ext/time.rb
deleted file mode 100644
index b28f7f1a32..0000000000
--- a/activesupport/lib/active_support/core_ext/time.rb
+++ /dev/null
@@ -1,10 +0,0 @@
-require 'date'
-require 'time'
-
-require 'active_support/core_ext/time/publicize_conversion_methods'
-require 'active_support/core_ext/time/marshal_with_utc_flag'
-
-require 'active_support/core_ext/time/acts_like'
-require 'active_support/core_ext/time/calculations'
-require 'active_support/core_ext/time/conversions'
-require 'active_support/core_ext/time/zones'
diff --git a/activesupport/lib/active_support/core_ext/uri.rb b/activesupport/lib/active_support/core_ext/uri.rb
index 9a1c61d99b..ca1be8b7e9 100644
--- a/activesupport/lib/active_support/core_ext/uri.rb
+++ b/activesupport/lib/active_support/core_ext/uri.rb
@@ -4,7 +4,8 @@ if RUBY_VERSION >= '1.9'
str = "\xE6\x97\xA5\xE6\x9C\xAC\xE8\xAA\x9E" # Ni-ho-nn-go in UTF-8, means Japanese.
str.force_encoding(Encoding::UTF_8) if str.respond_to?(:force_encoding)
- unless str == URI.unescape(URI.escape(str))
+ parser = URI::Parser.new
+ unless str == parser.unescape(parser.escape(str))
URI::Parser.class_eval do
remove_method :unescape
def unescape(str, escaped = @regexp[:ESCAPED])
diff --git a/activesupport/lib/active_support/dependencies.rb b/activesupport/lib/active_support/dependencies.rb
index 7f6f012721..e858bcdc80 100644
--- a/activesupport/lib/active_support/dependencies.rb
+++ b/activesupport/lib/active_support/dependencies.rb
@@ -339,7 +339,7 @@ module ActiveSupport #:nodoc:
next
end
[ nesting_camel ]
- end.flatten.compact.uniq
+ end.compact.flatten.compact.uniq
end
# Search for a file in load_paths matching the provided suffix.
diff --git a/activesupport/lib/active_support/dependency_module.rb b/activesupport/lib/active_support/dependency_module.rb
deleted file mode 100644
index 6847c0f86a..0000000000
--- a/activesupport/lib/active_support/dependency_module.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-module ActiveSupport
- module DependencyModule
- def append_features(base)
- return false if base < self
- (@_dependencies ||= []).each { |dep| base.send(:include, dep) }
- super
- end
-
- def depends_on(*mods)
- mods.each do |mod|
- next if self < mod
- @_dependencies ||= []
- @_dependencies << mod
- end
- end
- end
-end
diff --git a/activesupport/lib/active_support/deprecated_callbacks.rb b/activesupport/lib/active_support/deprecated_callbacks.rb
new file mode 100644
index 0000000000..f56fef0b6d
--- /dev/null
+++ b/activesupport/lib/active_support/deprecated_callbacks.rb
@@ -0,0 +1,284 @@
+require 'active_support/core_ext/array/extract_options'
+require 'active_support/core_ext/array/wrap'
+
+module ActiveSupport
+ # Callbacks are hooks into the lifecycle of an object that allow you to trigger logic
+ # before or after an alteration of the object state.
+ #
+ # Mixing in this module allows you to define callbacks in your class.
+ #
+ # Example:
+ # class Storage
+ # include ActiveSupport::DeprecatedCallbacks
+ #
+ # define_callbacks :before_save, :after_save
+ # end
+ #
+ # class ConfigStorage < Storage
+ # before_save :saving_message
+ # def saving_message
+ # puts "saving..."
+ # end
+ #
+ # after_save do |object|
+ # puts "saved"
+ # end
+ #
+ # def save
+ # run_callbacks(:before_save)
+ # puts "- save"
+ # run_callbacks(:after_save)
+ # end
+ # end
+ #
+ # config = ConfigStorage.new
+ # config.save
+ #
+ # Output:
+ # saving...
+ # - save
+ # saved
+ #
+ # Callbacks from parent classes are inherited.
+ #
+ # Example:
+ # class Storage
+ # include ActiveSupport::DeprecatedCallbacks
+ #
+ # define_callbacks :before_save, :after_save
+ #
+ # before_save :prepare
+ # def prepare
+ # puts "preparing save"
+ # end
+ # end
+ #
+ # class ConfigStorage < Storage
+ # before_save :saving_message
+ # def saving_message
+ # puts "saving..."
+ # end
+ #
+ # after_save do |object|
+ # puts "saved"
+ # end
+ #
+ # def save
+ # run_callbacks(:before_save)
+ # puts "- save"
+ # run_callbacks(:after_save)
+ # end
+ # end
+ #
+ # config = ConfigStorage.new
+ # config.save
+ #
+ # Output:
+ # preparing save
+ # saving...
+ # - save
+ # saved
+ module DeprecatedCallbacks
+ class CallbackChain < Array
+ def self.build(kind, *methods, &block)
+ methods, options = extract_options(*methods, &block)
+ methods.map! { |method| Callback.new(kind, method, options) }
+ new(methods)
+ end
+
+ def run(object, options = {}, &terminator)
+ enumerator = options[:enumerator] || :each
+
+ unless block_given?
+ send(enumerator) { |callback| callback.call(object) }
+ else
+ send(enumerator) do |callback|
+ result = callback.call(object)
+ break result if terminator.call(result, object)
+ end
+ end
+ end
+
+ # TODO: Decompose into more Array like behavior
+ def replace_or_append!(chain)
+ if index = index(chain)
+ self[index] = chain
+ else
+ self << chain
+ end
+ self
+ end
+
+ def find(callback, &block)
+ select { |c| c == callback && (!block_given? || yield(c)) }.first
+ end
+
+ def delete(callback)
+ super(callback.is_a?(Callback) ? callback : find(callback))
+ end
+
+ private
+ def self.extract_options(*methods, &block)
+ methods.flatten!
+ options = methods.extract_options!
+ methods << block if block_given?
+ return methods, options
+ end
+
+ def extract_options(*methods, &block)
+ self.class.extract_options(*methods, &block)
+ end
+ end
+
+ class Callback
+ attr_reader :kind, :method, :identifier, :options
+
+ def initialize(kind, method, options = {})
+ @kind = kind
+ @method = method
+ @identifier = options[:identifier]
+ @options = options
+ end
+
+ def ==(other)
+ case other
+ when Callback
+ (self.identifier && self.identifier == other.identifier) || self.method == other.method
+ else
+ (self.identifier && self.identifier == other) || self.method == other
+ end
+ end
+
+ def eql?(other)
+ self == other
+ end
+
+ def dup
+ self.class.new(@kind, @method, @options.dup)
+ end
+
+ def hash
+ if @identifier
+ @identifier.hash
+ else
+ @method.hash
+ end
+ end
+
+ def call(*args, &block)
+ evaluate_method(method, *args, &block) if should_run_callback?(*args)
+ rescue LocalJumpError
+ raise ArgumentError,
+ "Cannot yield from a Proc type filter. The Proc must take two " +
+ "arguments and execute #call on the second argument."
+ end
+
+ private
+ def evaluate_method(method, *args, &block)
+ case method
+ when Symbol
+ object = args.shift
+ object.send(method, *args, &block)
+ when String
+ eval(method, args.first.instance_eval { binding })
+ when Proc, Method
+ method.call(*args, &block)
+ else
+ if method.respond_to?(kind)
+ method.send(kind, *args, &block)
+ else
+ raise ArgumentError,
+ "Callbacks must be a symbol denoting the method to call, a string to be evaluated, " +
+ "a block to be invoked, or an object responding to the callback method."
+ end
+ end
+ end
+
+ def should_run_callback?(*args)
+ Array.wrap(options[:if]).flatten.compact.all? { |a| evaluate_method(a, *args) } &&
+ !Array.wrap(options[:unless]).flatten.compact.any? { |a| evaluate_method(a, *args) }
+ end
+ end
+
+ def self.included(base)
+ base.extend ClassMethods
+ end
+
+ module ClassMethods
+ def define_callbacks(*callbacks)
+ ActiveSupport::Deprecation.warn('ActiveSupport::DeprecatedCallbacks has been deprecated in favor of ActiveSupport::Callbacks', caller)
+
+ callbacks.each do |callback|
+ class_eval <<-"end_eval", __FILE__, __LINE__ + 1
+ def self.#{callback}(*methods, &block) # def self.before_save(*methods, &block)
+ callbacks = CallbackChain.build(:#{callback}, *methods, &block) # callbacks = CallbackChain.build(:before_save, *methods, &block)
+ @#{callback}_callbacks ||= CallbackChain.new # @before_save_callbacks ||= CallbackChain.new
+ @#{callback}_callbacks.concat callbacks # @before_save_callbacks.concat callbacks
+ end # end
+ #
+ def self.#{callback}_callback_chain # def self.before_save_callback_chain
+ @#{callback}_callbacks ||= CallbackChain.new # @before_save_callbacks ||= CallbackChain.new
+ #
+ if superclass.respond_to?(:#{callback}_callback_chain) # if superclass.respond_to?(:before_save_callback_chain)
+ CallbackChain.new( # CallbackChain.new(
+ superclass.#{callback}_callback_chain + # superclass.before_save_callback_chain +
+ @#{callback}_callbacks # @before_save_callbacks
+ ) # )
+ else # else
+ @#{callback}_callbacks # @before_save_callbacks
+ end # end
+ end # end
+ end_eval
+ end
+ end
+ end
+
+ # Runs all the callbacks defined for the given options.
+ #
+ # If a block is given it will be called after each callback receiving as arguments:
+ #
+ # * the result from the callback
+ # * the object which has the callback
+ #
+ # If the result from the block evaluates to +true+, the callback chain is stopped.
+ #
+ # Example:
+ # class Storage
+ # include ActiveSupport::DeprecatedCallbacks
+ #
+ # define_callbacks :before_save, :after_save
+ # end
+ #
+ # class ConfigStorage < Storage
+ # before_save :pass
+ # before_save :pass
+ # before_save :stop
+ # before_save :pass
+ #
+ # def pass
+ # puts "pass"
+ # end
+ #
+ # def stop
+ # puts "stop"
+ # return false
+ # end
+ #
+ # def save
+ # result = run_callbacks(:before_save) { |result, object| result == false }
+ # puts "- save" if result
+ # end
+ # end
+ #
+ # config = ConfigStorage.new
+ # config.save
+ #
+ # Output:
+ # pass
+ # pass
+ # stop
+ def run_callbacks(kind, options = {}, &block)
+ self.class.send("#{kind}_callback_chain").run(self, options, &block)
+ end
+ end
+end
diff --git a/activesupport/lib/active_support/deprecation/behaviors.rb b/activesupport/lib/active_support/deprecation/behaviors.rb
index c531a1aa58..ca23d45666 100644
--- a/activesupport/lib/active_support/deprecation/behaviors.rb
+++ b/activesupport/lib/active_support/deprecation/behaviors.rb
@@ -23,7 +23,13 @@ module ActiveSupport
$stderr.puts callstack.join("\n ") if debug
},
'development' => Proc.new { |message, callstack|
- logger = defined?(Rails) ? Rails.logger : Logger.new($stderr)
+ logger =
+ if defined?(Rails) && Rails.logger
+ Rails.logger
+ else
+ require 'logger'
+ Logger.new($stderr)
+ end
logger.warn message
logger.debug callstack.join("\n ") if debug
}
diff --git a/activesupport/lib/active_support/inflector.rb b/activesupport/lib/active_support/inflector.rb
index 67aea2782f..215a60eba7 100644
--- a/activesupport/lib/active_support/inflector.rb
+++ b/activesupport/lib/active_support/inflector.rb
@@ -1,410 +1,7 @@
-# encoding: utf-8
-require 'iconv'
-require 'active_support/core_ext/object/blank'
-require 'active_support/core_ext/string/access'
-require 'active_support/core_ext/string/multibyte'
-
-module ActiveSupport
- # The Inflector transforms words from singular to plural, class names to table names, modularized class names to ones without,
- # and class names to foreign keys. The default inflections for pluralization, singularization, and uncountable words are kept
- # in inflections.rb.
- #
- # The Rails core team has stated patches for the inflections library will not be accepted
- # in order to avoid breaking legacy applications which may be relying on errant inflections.
- # If you discover an incorrect inflection and require it for your application, you'll need
- # to correct it yourself (explained below).
- module Inflector
- extend self
-
- # A singleton instance of this class is yielded by Inflector.inflections, which can then be used to specify additional
- # inflection rules. Examples:
- #
- # ActiveSupport::Inflector.inflections do |inflect|
- # inflect.plural /^(ox)$/i, '\1\2en'
- # inflect.singular /^(ox)en/i, '\1'
- #
- # inflect.irregular 'octopus', 'octopi'
- #
- # inflect.uncountable "equipment"
- # end
- #
- # New rules are added at the top. So in the example above, the irregular rule for octopus will now be the first of the
- # pluralization and singularization rules that is runs. This guarantees that your rules run before any of the rules that may
- # already have been loaded.
- class Inflections
- def self.instance
- @__instance__ ||= new
- end
-
- attr_reader :plurals, :singulars, :uncountables, :humans
-
- def initialize
- @plurals, @singulars, @uncountables, @humans = [], [], [], []
- end
-
- # Specifies a new pluralization rule and its replacement. The rule can either be a string or a regular expression.
- # The replacement should always be a string that may include references to the matched data from the rule.
- def plural(rule, replacement)
- @uncountables.delete(rule) if rule.is_a?(String)
- @uncountables.delete(replacement)
- @plurals.insert(0, [rule, replacement])
- end
-
- # Specifies a new singularization rule and its replacement. The rule can either be a string or a regular expression.
- # The replacement should always be a string that may include references to the matched data from the rule.
- def singular(rule, replacement)
- @uncountables.delete(rule) if rule.is_a?(String)
- @uncountables.delete(replacement)
- @singulars.insert(0, [rule, replacement])
- end
-
- # Specifies a new irregular that applies to both pluralization and singularization at the same time. This can only be used
- # for strings, not regular expressions. You simply pass the irregular in singular and plural form.
- #
- # Examples:
- # irregular 'octopus', 'octopi'
- # irregular 'person', 'people'
- def irregular(singular, plural)
- @uncountables.delete(singular)
- @uncountables.delete(plural)
- if singular[0,1].upcase == plural[0,1].upcase
- plural(Regexp.new("(#{singular[0,1]})#{singular[1..-1]}$", "i"), '\1' + plural[1..-1])
- plural(Regexp.new("(#{plural[0,1]})#{plural[1..-1]}$", "i"), '\1' + plural[1..-1])
- singular(Regexp.new("(#{plural[0,1]})#{plural[1..-1]}$", "i"), '\1' + singular[1..-1])
- else
- plural(Regexp.new("#{singular[0,1].upcase}(?i)#{singular[1..-1]}$"), plural[0,1].upcase + plural[1..-1])
- plural(Regexp.new("#{singular[0,1].downcase}(?i)#{singular[1..-1]}$"), plural[0,1].downcase + plural[1..-1])
- plural(Regexp.new("#{plural[0,1].upcase}(?i)#{plural[1..-1]}$"), plural[0,1].upcase + plural[1..-1])
- plural(Regexp.new("#{plural[0,1].downcase}(?i)#{plural[1..-1]}$"), plural[0,1].downcase + plural[1..-1])
- singular(Regexp.new("#{plural[0,1].upcase}(?i)#{plural[1..-1]}$"), singular[0,1].upcase + singular[1..-1])
- singular(Regexp.new("#{plural[0,1].downcase}(?i)#{plural[1..-1]}$"), singular[0,1].downcase + singular[1..-1])
- end
- end
-
- # Add uncountable words that shouldn't be attempted inflected.
- #
- # Examples:
- # uncountable "money"
- # uncountable "money", "information"
- # uncountable %w( money information rice )
- def uncountable(*words)
- (@uncountables << words).flatten!
- end
-
- # Specifies a humanized form of a string by a regular expression rule or by a string mapping.
- # When using a regular expression based replacement, the normal humanize formatting is called after the replacement.
- # When a string is used, the human form should be specified as desired (example: 'The name', not 'the_name')
- #
- # Examples:
- # human /_cnt$/i, '\1_count'
- # human "legacy_col_person_name", "Name"
- def human(rule, replacement)
- @humans.insert(0, [rule, replacement])
- end
-
- # Clears the loaded inflections within a given scope (default is <tt>:all</tt>).
- # Give the scope as a symbol of the inflection type, the options are: <tt>:plurals</tt>,
- # <tt>:singulars</tt>, <tt>:uncountables</tt>, <tt>:humans</tt>.
- #
- # Examples:
- # clear :all
- # clear :plurals
- def clear(scope = :all)
- case scope
- when :all
- @plurals, @singulars, @uncountables = [], [], []
- else
- instance_variable_set "@#{scope}", []
- end
- end
- end
-
- # Yields a singleton instance of Inflector::Inflections so you can specify additional
- # inflector rules.
- #
- # Example:
- # ActiveSupport::Inflector.inflections do |inflect|
- # inflect.uncountable "rails"
- # end
- def inflections
- if block_given?
- yield Inflections.instance
- else
- Inflections.instance
- end
- end
-
- # Returns the plural form of the word in the string.
- #
- # Examples:
- # "post".pluralize # => "posts"
- # "octopus".pluralize # => "octopi"
- # "sheep".pluralize # => "sheep"
- # "words".pluralize # => "words"
- # "CamelOctopus".pluralize # => "CamelOctopi"
- def pluralize(word)
- result = word.to_s.dup
-
- if word.empty? || inflections.uncountables.include?(result.downcase)
- result
- else
- inflections.plurals.each { |(rule, replacement)| break if result.gsub!(rule, replacement) }
- result
- end
- end
-
- # The reverse of +pluralize+, returns the singular form of a word in a string.
- #
- # Examples:
- # "posts".singularize # => "post"
- # "octopi".singularize # => "octopus"
- # "sheep".singularize # => "sheep"
- # "word".singularize # => "word"
- # "CamelOctopi".singularize # => "CamelOctopus"
- def singularize(word)
- result = word.to_s.dup
-
- if inflections.uncountables.include?(result.downcase)
- result
- else
- inflections.singulars.each { |(rule, replacement)| break if result.gsub!(rule, replacement) }
- result
- end
- end
-
- # By default, +camelize+ converts strings to UpperCamelCase. If the argument to +camelize+
- # is set to <tt>:lower</tt> then +camelize+ produces lowerCamelCase.
- #
- # +camelize+ will also convert '/' to '::' which is useful for converting paths to namespaces.
- #
- # Examples:
- # "active_record".camelize # => "ActiveRecord"
- # "active_record".camelize(:lower) # => "activeRecord"
- # "active_record/errors".camelize # => "ActiveRecord::Errors"
- # "active_record/errors".camelize(:lower) # => "activeRecord::Errors"
- def camelize(lower_case_and_underscored_word, first_letter_in_uppercase = true)
- if first_letter_in_uppercase
- lower_case_and_underscored_word.to_s.gsub(/\/(.?)/) { "::#{$1.upcase}" }.gsub(/(?:^|_)(.)/) { $1.upcase }
- else
- lower_case_and_underscored_word.to_s.first.downcase + camelize(lower_case_and_underscored_word)[1..-1]
- end
- end
-
- # Capitalizes all the words and replaces some characters in the string to create
- # a nicer looking title. +titleize+ is meant for creating pretty output. It is not
- # used in the Rails internals.
- #
- # +titleize+ is also aliased as as +titlecase+.
- #
- # Examples:
- # "man from the boondocks".titleize # => "Man From The Boondocks"
- # "x-men: the last stand".titleize # => "X Men: The Last Stand"
- def titleize(word)
- humanize(underscore(word)).gsub(/\b('?[a-z])/) { $1.capitalize }
- end
-
- # The reverse of +camelize+. Makes an underscored, lowercase form from the expression in the string.
- #
- # Changes '::' to '/' to convert namespaces to paths.
- #
- # Examples:
- # "ActiveRecord".underscore # => "active_record"
- # "ActiveRecord::Errors".underscore # => active_record/errors
- def underscore(camel_cased_word)
- camel_cased_word.to_s.gsub(/::/, '/').
- gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2').
- gsub(/([a-z\d])([A-Z])/,'\1_\2').
- tr("-", "_").
- downcase
- end
-
- # Replaces underscores with dashes in the string.
- #
- # Example:
- # "puni_puni" # => "puni-puni"
- def dasherize(underscored_word)
- underscored_word.gsub(/_/, '-')
- end
-
- # Capitalizes the first word and turns underscores into spaces and strips a
- # trailing "_id", if any. Like +titleize+, this is meant for creating pretty output.
- #
- # Examples:
- # "employee_salary" # => "Employee salary"
- # "author_id" # => "Author"
- def humanize(lower_case_and_underscored_word)
- result = lower_case_and_underscored_word.to_s.dup
-
- inflections.humans.each { |(rule, replacement)| break if result.gsub!(rule, replacement) }
- result.gsub(/_id$/, "").gsub(/_/, " ").capitalize
- end
-
- # Removes the module part from the expression in the string.
- #
- # Examples:
- # "ActiveRecord::CoreExtensions::String::Inflections".demodulize # => "Inflections"
- # "Inflections".demodulize # => "Inflections"
- def demodulize(class_name_in_module)
- class_name_in_module.to_s.gsub(/^.*::/, '')
- end
-
- # Replaces special characters in a string so that it may be used as part of a 'pretty' URL.
- #
- # ==== Examples
- #
- # class Person
- # def to_param
- # "#{id}-#{name.parameterize}"
- # end
- # end
- #
- # @person = Person.find(1)
- # # => #<Person id: 1, name: "Donald E. Knuth">
- #
- # <%= link_to(@person.name, person_path(@person)) %>
- # # => <a href="/person/1-donald-e-knuth">Donald E. Knuth</a>
- def parameterize(string, sep = '-')
- # replace accented chars with their ascii equivalents
- parameterized_string = transliterate(string)
- # Turn unwanted chars into the separator
- parameterized_string.gsub!(/[^a-z0-9\-_\+]+/i, sep)
- unless sep.blank?
- re_sep = Regexp.escape(sep)
- # No more than one of the separator in a row.
- parameterized_string.gsub!(/#{re_sep}{2,}/, sep)
- # Remove leading/trailing separator.
- parameterized_string.gsub!(/^#{re_sep}|#{re_sep}$/i, '')
- end
- parameterized_string.downcase
- end
-
-
- # Replaces accented characters with their ascii equivalents.
- def transliterate(string)
- Iconv.iconv('ascii//ignore//translit', 'utf-8', string).to_s
- end
-
- if RUBY_VERSION >= '1.9'
- undef_method :transliterate
- def transliterate(string)
- warn "Ruby 1.9 doesn't support Unicode normalization yet"
- string.dup
- end
-
- # The iconv transliteration code doesn't function correctly
- # on some platforms, but it's very fast where it does function.
- elsif "foo" != (Inflector.transliterate("föö") rescue nil)
- undef_method :transliterate
- def transliterate(string)
- string.mb_chars.normalize(:kd). # Decompose accented characters
- gsub(/[^\x00-\x7F]+/, '') # Remove anything non-ASCII entirely (e.g. diacritics).
- end
- end
-
- # Create the name of a table like Rails does for models to table names. This method
- # uses the +pluralize+ method on the last word in the string.
- #
- # Examples
- # "RawScaledScorer".tableize # => "raw_scaled_scorers"
- # "egg_and_ham".tableize # => "egg_and_hams"
- # "fancyCategory".tableize # => "fancy_categories"
- def tableize(class_name)
- pluralize(underscore(class_name))
- end
-
- # Create a class name from a plural table name like Rails does for table names to models.
- # Note that this returns a string and not a Class. (To convert to an actual class
- # follow +classify+ with +constantize+.)
- #
- # Examples:
- # "egg_and_hams".classify # => "EggAndHam"
- # "posts".classify # => "Post"
- #
- # Singular names are not handled correctly:
- # "business".classify # => "Busines"
- def classify(table_name)
- # strip out any leading schema name
- camelize(singularize(table_name.to_s.sub(/.*\./, '')))
- end
-
- # Creates a foreign key name from a class name.
- # +separate_class_name_and_id_with_underscore+ sets whether
- # the method should put '_' between the name and 'id'.
- #
- # Examples:
- # "Message".foreign_key # => "message_id"
- # "Message".foreign_key(false) # => "messageid"
- # "Admin::Post".foreign_key # => "post_id"
- def foreign_key(class_name, separate_class_name_and_id_with_underscore = true)
- underscore(demodulize(class_name)) + (separate_class_name_and_id_with_underscore ? "_id" : "id")
- end
-
- # Ruby 1.9 introduces an inherit argument for Module#const_get and
- # #const_defined? and changes their default behavior.
- if Module.method(:const_get).arity == 1
- # Tries to find a constant with the name specified in the argument string:
- #
- # "Module".constantize # => Module
- # "Test::Unit".constantize # => Test::Unit
- #
- # The name is assumed to be the one of a top-level constant, no matter whether
- # it starts with "::" or not. No lexical context is taken into account:
- #
- # C = 'outside'
- # module M
- # C = 'inside'
- # C # => 'inside'
- # "C".constantize # => 'outside', same as ::C
- # end
- #
- # NameError is raised when the name is not in CamelCase or the constant is
- # unknown.
- def constantize(camel_cased_word)
- names = camel_cased_word.split('::')
- names.shift if names.empty? || names.first.empty?
-
- constant = Object
- names.each do |name|
- constant = constant.const_defined?(name) ? constant.const_get(name) : constant.const_missing(name)
- end
- constant
- end
- else
- def constantize(camel_cased_word) #:nodoc:
- names = camel_cased_word.split('::')
- names.shift if names.empty? || names.first.empty?
-
- constant = Object
- names.each do |name|
- constant = constant.const_get(name, false) || constant.const_missing(name)
- end
- constant
- end
- end
-
- # Turns a number into an ordinal string used to denote the position in an
- # ordered sequence such as 1st, 2nd, 3rd, 4th.
- #
- # Examples:
- # ordinalize(1) # => "1st"
- # ordinalize(2) # => "2nd"
- # ordinalize(1002) # => "1002nd"
- # ordinalize(1003) # => "1003rd"
- def ordinalize(number)
- if (11..13).include?(number.to_i % 100)
- "#{number}th"
- else
- case number.to_i % 10
- when 1; "#{number}st"
- when 2; "#{number}nd"
- when 3; "#{number}rd"
- else "#{number}th"
- end
- end
- end
- end
-end
-
# in case active_support/inflector is required without the rest of active_support
+require 'active_support/inflector/inflections'
+require 'active_support/inflector/transliterate'
+require 'active_support/inflector/methods'
+
require 'active_support/inflections'
require 'active_support/core_ext/string/inflections'
diff --git a/activesupport/lib/active_support/inflector/inflections.rb b/activesupport/lib/active_support/inflector/inflections.rb
new file mode 100644
index 0000000000..785e245ea4
--- /dev/null
+++ b/activesupport/lib/active_support/inflector/inflections.rb
@@ -0,0 +1,211 @@
+module ActiveSupport
+ module Inflector
+ # A singleton instance of this class is yielded by Inflector.inflections, which can then be used to specify additional
+ # inflection rules. Examples:
+ #
+ # ActiveSupport::Inflector.inflections do |inflect|
+ # inflect.plural /^(ox)$/i, '\1\2en'
+ # inflect.singular /^(ox)en/i, '\1'
+ #
+ # inflect.irregular 'octopus', 'octopi'
+ #
+ # inflect.uncountable "equipment"
+ # end
+ #
+ # New rules are added at the top. So in the example above, the irregular rule for octopus will now be the first of the
+ # pluralization and singularization rules that is runs. This guarantees that your rules run before any of the rules that may
+ # already have been loaded.
+ class Inflections
+ def self.instance
+ @__instance__ ||= new
+ end
+
+ attr_reader :plurals, :singulars, :uncountables, :humans
+
+ def initialize
+ @plurals, @singulars, @uncountables, @humans = [], [], [], []
+ end
+
+ # Specifies a new pluralization rule and its replacement. The rule can either be a string or a regular expression.
+ # The replacement should always be a string that may include references to the matched data from the rule.
+ def plural(rule, replacement)
+ @uncountables.delete(rule) if rule.is_a?(String)
+ @uncountables.delete(replacement)
+ @plurals.insert(0, [rule, replacement])
+ end
+
+ # Specifies a new singularization rule and its replacement. The rule can either be a string or a regular expression.
+ # The replacement should always be a string that may include references to the matched data from the rule.
+ def singular(rule, replacement)
+ @uncountables.delete(rule) if rule.is_a?(String)
+ @uncountables.delete(replacement)
+ @singulars.insert(0, [rule, replacement])
+ end
+
+ # Specifies a new irregular that applies to both pluralization and singularization at the same time. This can only be used
+ # for strings, not regular expressions. You simply pass the irregular in singular and plural form.
+ #
+ # Examples:
+ # irregular 'octopus', 'octopi'
+ # irregular 'person', 'people'
+ def irregular(singular, plural)
+ @uncountables.delete(singular)
+ @uncountables.delete(plural)
+ if singular[0,1].upcase == plural[0,1].upcase
+ plural(Regexp.new("(#{singular[0,1]})#{singular[1..-1]}$", "i"), '\1' + plural[1..-1])
+ plural(Regexp.new("(#{plural[0,1]})#{plural[1..-1]}$", "i"), '\1' + plural[1..-1])
+ singular(Regexp.new("(#{plural[0,1]})#{plural[1..-1]}$", "i"), '\1' + singular[1..-1])
+ else
+ plural(Regexp.new("#{singular[0,1].upcase}(?i)#{singular[1..-1]}$"), plural[0,1].upcase + plural[1..-1])
+ plural(Regexp.new("#{singular[0,1].downcase}(?i)#{singular[1..-1]}$"), plural[0,1].downcase + plural[1..-1])
+ plural(Regexp.new("#{plural[0,1].upcase}(?i)#{plural[1..-1]}$"), plural[0,1].upcase + plural[1..-1])
+ plural(Regexp.new("#{plural[0,1].downcase}(?i)#{plural[1..-1]}$"), plural[0,1].downcase + plural[1..-1])
+ singular(Regexp.new("#{plural[0,1].upcase}(?i)#{plural[1..-1]}$"), singular[0,1].upcase + singular[1..-1])
+ singular(Regexp.new("#{plural[0,1].downcase}(?i)#{plural[1..-1]}$"), singular[0,1].downcase + singular[1..-1])
+ end
+ end
+
+ # Add uncountable words that shouldn't be attempted inflected.
+ #
+ # Examples:
+ # uncountable "money"
+ # uncountable "money", "information"
+ # uncountable %w( money information rice )
+ def uncountable(*words)
+ (@uncountables << words).flatten!
+ end
+
+ # Specifies a humanized form of a string by a regular expression rule or by a string mapping.
+ # When using a regular expression based replacement, the normal humanize formatting is called after the replacement.
+ # When a string is used, the human form should be specified as desired (example: 'The name', not 'the_name')
+ #
+ # Examples:
+ # human /_cnt$/i, '\1_count'
+ # human "legacy_col_person_name", "Name"
+ def human(rule, replacement)
+ @humans.insert(0, [rule, replacement])
+ end
+
+ # Clears the loaded inflections within a given scope (default is <tt>:all</tt>).
+ # Give the scope as a symbol of the inflection type, the options are: <tt>:plurals</tt>,
+ # <tt>:singulars</tt>, <tt>:uncountables</tt>, <tt>:humans</tt>.
+ #
+ # Examples:
+ # clear :all
+ # clear :plurals
+ def clear(scope = :all)
+ case scope
+ when :all
+ @plurals, @singulars, @uncountables = [], [], []
+ else
+ instance_variable_set "@#{scope}", []
+ end
+ end
+ end
+
+ # Yields a singleton instance of Inflector::Inflections so you can specify additional
+ # inflector rules.
+ #
+ # Example:
+ # ActiveSupport::Inflector.inflections do |inflect|
+ # inflect.uncountable "rails"
+ # end
+ def inflections
+ if block_given?
+ yield Inflections.instance
+ else
+ Inflections.instance
+ end
+ end
+
+ # Returns the plural form of the word in the string.
+ #
+ # Examples:
+ # "post".pluralize # => "posts"
+ # "octopus".pluralize # => "octopi"
+ # "sheep".pluralize # => "sheep"
+ # "words".pluralize # => "words"
+ # "CamelOctopus".pluralize # => "CamelOctopi"
+ def pluralize(word)
+ result = word.to_s.dup
+
+ if word.empty? || inflections.uncountables.include?(result.downcase)
+ result
+ else
+ inflections.plurals.each { |(rule, replacement)| break if result.gsub!(rule, replacement) }
+ result
+ end
+ end
+
+ # The reverse of +pluralize+, returns the singular form of a word in a string.
+ #
+ # Examples:
+ # "posts".singularize # => "post"
+ # "octopi".singularize # => "octopus"
+ # "sheep".singularize # => "sheep"
+ # "word".singularize # => "word"
+ # "CamelOctopi".singularize # => "CamelOctopus"
+ def singularize(word)
+ result = word.to_s.dup
+
+ if inflections.uncountables.include?(result.downcase)
+ result
+ else
+ inflections.singulars.each { |(rule, replacement)| break if result.gsub!(rule, replacement) }
+ result
+ end
+ end
+
+ # Capitalizes the first word and turns underscores into spaces and strips a
+ # trailing "_id", if any. Like +titleize+, this is meant for creating pretty output.
+ #
+ # Examples:
+ # "employee_salary" # => "Employee salary"
+ # "author_id" # => "Author"
+ def humanize(lower_case_and_underscored_word)
+ result = lower_case_and_underscored_word.to_s.dup
+
+ inflections.humans.each { |(rule, replacement)| break if result.gsub!(rule, replacement) }
+ result.gsub(/_id$/, "").gsub(/_/, " ").capitalize
+ end
+
+ # Capitalizes all the words and replaces some characters in the string to create
+ # a nicer looking title. +titleize+ is meant for creating pretty output. It is not
+ # used in the Rails internals.
+ #
+ # +titleize+ is also aliased as as +titlecase+.
+ #
+ # Examples:
+ # "man from the boondocks".titleize # => "Man From The Boondocks"
+ # "x-men: the last stand".titleize # => "X Men: The Last Stand"
+ def titleize(word)
+ humanize(underscore(word)).gsub(/\b('?[a-z])/) { $1.capitalize }
+ end
+
+ # Create the name of a table like Rails does for models to table names. This method
+ # uses the +pluralize+ method on the last word in the string.
+ #
+ # Examples
+ # "RawScaledScorer".tableize # => "raw_scaled_scorers"
+ # "egg_and_ham".tableize # => "egg_and_hams"
+ # "fancyCategory".tableize # => "fancy_categories"
+ def tableize(class_name)
+ pluralize(underscore(class_name))
+ end
+
+ # Create a class name from a plural table name like Rails does for table names to models.
+ # Note that this returns a string and not a Class. (To convert to an actual class
+ # follow +classify+ with +constantize+.)
+ #
+ # Examples:
+ # "egg_and_hams".classify # => "EggAndHam"
+ # "posts".classify # => "Post"
+ #
+ # Singular names are not handled correctly:
+ # "business".classify # => "Busines"
+ def classify(table_name)
+ # strip out any leading schema name
+ camelize(singularize(table_name.to_s.sub(/.*\./, '')))
+ end
+ end
+end
diff --git a/activesupport/lib/active_support/inflector/methods.rb b/activesupport/lib/active_support/inflector/methods.rb
new file mode 100644
index 0000000000..41277893e3
--- /dev/null
+++ b/activesupport/lib/active_support/inflector/methods.rb
@@ -0,0 +1,139 @@
+module ActiveSupport
+ # The Inflector transforms words from singular to plural, class names to table names, modularized class names to ones without,
+ # and class names to foreign keys. The default inflections for pluralization, singularization, and uncountable words are kept
+ # in inflections.rb.
+ #
+ # The Rails core team has stated patches for the inflections library will not be accepted
+ # in order to avoid breaking legacy applications which may be relying on errant inflections.
+ # If you discover an incorrect inflection and require it for your application, you'll need
+ # to correct it yourself (explained below).
+ module Inflector
+ extend self
+
+ # By default, +camelize+ converts strings to UpperCamelCase. If the argument to +camelize+
+ # is set to <tt>:lower</tt> then +camelize+ produces lowerCamelCase.
+ #
+ # +camelize+ will also convert '/' to '::' which is useful for converting paths to namespaces.
+ #
+ # Examples:
+ # "active_record".camelize # => "ActiveRecord"
+ # "active_record".camelize(:lower) # => "activeRecord"
+ # "active_record/errors".camelize # => "ActiveRecord::Errors"
+ # "active_record/errors".camelize(:lower) # => "activeRecord::Errors"
+ def camelize(lower_case_and_underscored_word, first_letter_in_uppercase = true)
+ if first_letter_in_uppercase
+ lower_case_and_underscored_word.to_s.gsub(/\/(.?)/) { "::#{$1.upcase}" }.gsub(/(?:^|_)(.)/) { $1.upcase }
+ else
+ lower_case_and_underscored_word.to_s[0].chr.downcase + camelize(lower_case_and_underscored_word)[1..-1]
+ end
+ end
+
+ # The reverse of +camelize+. Makes an underscored, lowercase form from the expression in the string.
+ #
+ # Changes '::' to '/' to convert namespaces to paths.
+ #
+ # Examples:
+ # "ActiveRecord".underscore # => "active_record"
+ # "ActiveRecord::Errors".underscore # => active_record/errors
+ def underscore(camel_cased_word)
+ camel_cased_word.to_s.gsub(/::/, '/').
+ gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2').
+ gsub(/([a-z\d])([A-Z])/,'\1_\2').
+ tr("-", "_").
+ downcase
+ end
+
+ # Replaces underscores with dashes in the string.
+ #
+ # Example:
+ # "puni_puni" # => "puni-puni"
+ def dasherize(underscored_word)
+ underscored_word.gsub(/_/, '-')
+ end
+
+ # Removes the module part from the expression in the string.
+ #
+ # Examples:
+ # "ActiveRecord::CoreExtensions::String::Inflections".demodulize # => "Inflections"
+ # "Inflections".demodulize # => "Inflections"
+ def demodulize(class_name_in_module)
+ class_name_in_module.to_s.gsub(/^.*::/, '')
+ end
+
+ # Creates a foreign key name from a class name.
+ # +separate_class_name_and_id_with_underscore+ sets whether
+ # the method should put '_' between the name and 'id'.
+ #
+ # Examples:
+ # "Message".foreign_key # => "message_id"
+ # "Message".foreign_key(false) # => "messageid"
+ # "Admin::Post".foreign_key # => "post_id"
+ def foreign_key(class_name, separate_class_name_and_id_with_underscore = true)
+ underscore(demodulize(class_name)) + (separate_class_name_and_id_with_underscore ? "_id" : "id")
+ end
+
+ # Ruby 1.9 introduces an inherit argument for Module#const_get and
+ # #const_defined? and changes their default behavior.
+ if Module.method(:const_get).arity == 1
+ # Tries to find a constant with the name specified in the argument string:
+ #
+ # "Module".constantize # => Module
+ # "Test::Unit".constantize # => Test::Unit
+ #
+ # The name is assumed to be the one of a top-level constant, no matter whether
+ # it starts with "::" or not. No lexical context is taken into account:
+ #
+ # C = 'outside'
+ # module M
+ # C = 'inside'
+ # C # => 'inside'
+ # "C".constantize # => 'outside', same as ::C
+ # end
+ #
+ # NameError is raised when the name is not in CamelCase or the constant is
+ # unknown.
+ def constantize(camel_cased_word)
+ names = camel_cased_word.split('::')
+ names.shift if names.empty? || names.first.empty?
+
+ constant = Object
+ names.each do |name|
+ constant = constant.const_defined?(name) ? constant.const_get(name) : constant.const_missing(name)
+ end
+ constant
+ end
+ else
+ def constantize(camel_cased_word) #:nodoc:
+ names = camel_cased_word.split('::')
+ names.shift if names.empty? || names.first.empty?
+
+ constant = Object
+ names.each do |name|
+ constant = constant.const_get(name, false) || constant.const_missing(name)
+ end
+ constant
+ end
+ end
+
+ # Turns a number into an ordinal string used to denote the position in an
+ # ordered sequence such as 1st, 2nd, 3rd, 4th.
+ #
+ # Examples:
+ # ordinalize(1) # => "1st"
+ # ordinalize(2) # => "2nd"
+ # ordinalize(1002) # => "1002nd"
+ # ordinalize(1003) # => "1003rd"
+ def ordinalize(number)
+ if (11..13).include?(number.to_i % 100)
+ "#{number}th"
+ else
+ case number.to_i % 10
+ when 1; "#{number}st"
+ when 2; "#{number}nd"
+ when 3; "#{number}rd"
+ else "#{number}th"
+ end
+ end
+ end
+ end
+end \ No newline at end of file
diff --git a/activesupport/lib/active_support/inflector/transliterate.rb b/activesupport/lib/active_support/inflector/transliterate.rb
new file mode 100644
index 0000000000..30a9072ee1
--- /dev/null
+++ b/activesupport/lib/active_support/inflector/transliterate.rb
@@ -0,0 +1,61 @@
+# encoding: utf-8
+require 'iconv'
+require 'active_support/core_ext/string/multibyte'
+
+module ActiveSupport
+ module Inflector
+ extend self
+
+ # Replaces accented characters with their ascii equivalents.
+ def transliterate(string)
+ Iconv.iconv('ascii//ignore//translit', 'utf-8', string).to_s
+ end
+
+ if RUBY_VERSION >= '1.9'
+ undef_method :transliterate
+ def transliterate(string)
+ warn "Ruby 1.9 doesn't support Unicode normalization yet"
+ string.dup
+ end
+
+ # The iconv transliteration code doesn't function correctly
+ # on some platforms, but it's very fast where it does function.
+ elsif "foo" != (Inflector.transliterate("föö") rescue nil)
+ undef_method :transliterate
+ def transliterate(string)
+ string.mb_chars.normalize(:kd). # Decompose accented characters
+ gsub(/[^\x00-\x7F]+/, '') # Remove anything non-ASCII entirely (e.g. diacritics).
+ end
+ end
+
+ # Replaces special characters in a string so that it may be used as part of a 'pretty' URL.
+ #
+ # ==== Examples
+ #
+ # class Person
+ # def to_param
+ # "#{id}-#{name.parameterize}"
+ # end
+ # end
+ #
+ # @person = Person.find(1)
+ # # => #<Person id: 1, name: "Donald E. Knuth">
+ #
+ # <%= link_to(@person.name, person_path(@person)) %>
+ # # => <a href="/person/1-donald-e-knuth">Donald E. Knuth</a>
+ def parameterize(string, sep = '-')
+ # replace accented chars with their ascii equivalents
+ parameterized_string = transliterate(string)
+ # Turn unwanted chars into the separator
+ parameterized_string.gsub!(/[^a-z0-9\-_\+]+/i, sep)
+ unless sep.nil? || sep.empty?
+ re_sep = Regexp.escape(sep)
+ # No more than one of the separator in a row.
+ parameterized_string.gsub!(/#{re_sep}{2,}/, sep)
+ # Remove leading/trailing separator.
+ parameterized_string.gsub!(/^#{re_sep}|#{re_sep}$/i, '')
+ end
+ parameterized_string.downcase
+ end
+ end
+end \ No newline at end of file
diff --git a/activesupport/lib/active_support/json/backends/jsongem.rb b/activesupport/lib/active_support/json/backends/jsongem.rb
index c6c17a3c4e..cfe28d7bb9 100644
--- a/activesupport/lib/active_support/json/backends/jsongem.rb
+++ b/activesupport/lib/active_support/json/backends/jsongem.rb
@@ -23,15 +23,18 @@ module ActiveSupport
private
def convert_dates_from(data)
case data
- when DATE_REGEX
- DateTime.parse(data)
- when Array
- data.map! { |d| convert_dates_from(d) }
- when Hash
- data.each do |key, value|
- data[key] = convert_dates_from(value)
- end
- else data
+ when nil
+ nil
+ when DATE_REGEX
+ DateTime.parse(data)
+ when Array
+ data.map! { |d| convert_dates_from(d) }
+ when Hash
+ data.each do |key, value|
+ data[key] = convert_dates_from(value)
+ end
+ else
+ data
end
end
end
diff --git a/activesupport/lib/active_support/json/encoding.rb b/activesupport/lib/active_support/json/encoding.rb
index f440d6ce58..3c15056c41 100644
--- a/activesupport/lib/active_support/json/encoding.rb
+++ b/activesupport/lib/active_support/json/encoding.rb
@@ -6,10 +6,7 @@ require 'active_support/core_ext/module/delegation'
require 'active_support/core_ext/object/instance_variables'
require 'active_support/deprecation'
-require 'active_support/core_ext/date_time/conversions'
-require 'active_support/core_ext/time/conversions'
-require 'active_support/time_with_zone'
-require 'active_support/values/time_zone'
+require 'active_support/time'
# Hack to load json gem first so we can overwrite its to_json.
begin
diff --git a/activesupport/lib/active_support/memoizable.rb b/activesupport/lib/active_support/memoizable.rb
index b197fbc9bf..f810f53029 100644
--- a/activesupport/lib/active_support/memoizable.rb
+++ b/activesupport/lib/active_support/memoizable.rb
@@ -2,19 +2,6 @@ require 'active_support/core_ext/object/metaclass'
require 'active_support/core_ext/module/aliasing'
module ActiveSupport
- module SafelyMemoizable
- def safely_memoize(*symbols)
- symbols.each do |symbol|
- class_eval <<-RUBY, __FILE__, __LINE__ + 1
- def #{symbol}(*args)
- memoized = @_memoized_#{symbol} || ::ActiveSupport::ConcurrentHash.new
- memoized[args] ||= memoized_#{symbol}(*args)
- end
- RUBY
- end
- end
- end
-
module Memoizable
def self.memoized_ivar_for(symbol)
"@_memoized_#{symbol.to_s.sub(/\?\Z/, '_query').sub(/!\Z/, '_bang')}".to_sym
diff --git a/activesupport/lib/active_support/message_verifier.rb b/activesupport/lib/active_support/message_verifier.rb
index 282346b1a6..87e4b1ad33 100644
--- a/activesupport/lib/active_support/message_verifier.rb
+++ b/activesupport/lib/active_support/message_verifier.rb
@@ -1,5 +1,3 @@
-require 'active_support/core_ext/string/bytesize'
-
module ActiveSupport
# MessageVerifier makes it easy to generate and verify messages which are signed
# to prevent tampering.
diff --git a/activesupport/lib/active_support/multibyte.rb b/activesupport/lib/active_support/multibyte.rb
index 6f2016a409..7e6f7d754b 100644
--- a/activesupport/lib/active_support/multibyte.rb
+++ b/activesupport/lib/active_support/multibyte.rb
@@ -4,6 +4,12 @@ require 'active_support/core_ext/module/attribute_accessors'
module ActiveSupport #:nodoc:
module Multibyte
+ autoload :EncodingError, 'active_support/multibyte/exceptions'
+ autoload :Chars, 'active_support/multibyte/chars'
+ autoload :UnicodeDatabase, 'active_support/multibyte/unicode_database'
+ autoload :Codepoint, 'active_support/multibyte/unicode_database'
+ autoload :UCD, 'active_support/multibyte/unicode_database'
+
# A list of all available normalization forms. See http://www.unicode.org/reports/tr15/tr15-29.html for more
# information about normalization.
NORMALIZATION_FORMS = [:c, :kc, :d, :kd]
@@ -53,7 +59,4 @@ module ActiveSupport #:nodoc:
end
end
-require 'active_support/multibyte/chars'
-require 'active_support/multibyte/exceptions'
-require 'active_support/multibyte/unicode_database'
-require 'active_support/multibyte/utils'
+require 'active_support/multibyte/utils' \ No newline at end of file
diff --git a/activesupport/lib/active_support/multibyte/chars.rb b/activesupport/lib/active_support/multibyte/chars.rb
index 579ccc124d..c7225fec06 100644
--- a/activesupport/lib/active_support/multibyte/chars.rb
+++ b/activesupport/lib/active_support/multibyte/chars.rb
@@ -1,4 +1,5 @@
# encoding: utf-8
+require 'active_support/core_ext/string/access'
require 'active_support/core_ext/string/behavior'
module ActiveSupport #:nodoc:
@@ -197,7 +198,7 @@ module ActiveSupport #:nodoc:
# 'Café périferôl'.mb_chars.index('ô') #=> 12
# 'Café périferôl'.mb_chars.index(/\w/u) #=> 0
def index(needle, offset=0)
- wrapped_offset = self.first(offset).wrapped_string.length
+ wrapped_offset = first(offset).wrapped_string.length
index = @wrapped_string.index(needle, wrapped_offset)
index ? (self.class.u_unpack(@wrapped_string.slice(0...index)).size) : nil
end
@@ -211,7 +212,7 @@ module ActiveSupport #:nodoc:
# 'Café périferôl'.mb_chars.rindex(/\w/u) #=> 13
def rindex(needle, offset=nil)
offset ||= length
- wrapped_offset = self.first(offset).wrapped_string.length
+ wrapped_offset = first(offset).wrapped_string.length
index = @wrapped_string.rindex(needle, wrapped_offset)
index ? (self.class.u_unpack(@wrapped_string.slice(0...index)).size) : nil
end
@@ -321,7 +322,7 @@ module ActiveSupport #:nodoc:
# Example:
# 'Café'.mb_chars.reverse.to_s #=> 'éfaC'
def reverse
- chars(self.class.u_unpack(@wrapped_string).reverse.pack('U*'))
+ chars(self.class.g_unpack(@wrapped_string).reverse.flatten.pack('U*'))
end
# Implements Unicode-aware slice with codepoints. Slicing on one point returns the codepoints for that
@@ -363,6 +364,16 @@ module ActiveSupport #:nodoc:
slice
end
+ # Limit the byte size of the string to a number of bytes without breaking characters. Usable
+ # when the storage for a string is limited for some reason.
+ #
+ # Example:
+ # s = 'こんにちは'
+ # s.mb_chars.limit(7) #=> "こに"
+ def limit(limit)
+ slice(0...translate_offset(limit))
+ end
+
# Returns the codepoint of the first character in the string.
#
# Example:
@@ -651,24 +662,20 @@ module ActiveSupport #:nodoc:
end
protected
-
+
def translate_offset(byte_offset) #:nodoc:
return nil if byte_offset.nil?
return 0 if @wrapped_string == ''
- chunk = @wrapped_string[0..byte_offset]
+
+ if @wrapped_string.respond_to?(:force_encoding)
+ @wrapped_string = @wrapped_string.dup.force_encoding(Encoding::ASCII_8BIT)
+ end
+
begin
- begin
- chunk.unpack('U*').length - 1
- rescue ArgumentError => e
- chunk = @wrapped_string[0..(byte_offset+=1)]
- # Stop retrying at the end of the string
- raise e unless byte_offset < chunk.length
- # We damaged a character, retry
- retry
- end
- # Catch the ArgumentError so we can throw our own
- rescue ArgumentError
- raise EncodingError, 'malformed UTF-8 character'
+ @wrapped_string[0...byte_offset].unpack('U*').length
+ rescue ArgumentError => e
+ byte_offset -= 1
+ retry
end
end
diff --git a/activesupport/lib/active_support/multibyte/utils.rb b/activesupport/lib/active_support/multibyte/utils.rb
index 8e47763d39..b243df46d8 100644
--- a/activesupport/lib/active_support/multibyte/utils.rb
+++ b/activesupport/lib/active_support/multibyte/utils.rb
@@ -26,11 +26,11 @@ module ActiveSupport #:nodoc:
else
def self.verify(string)
if expression = valid_character
- for c in string.split(//)
- return false unless expression.match(c)
- end
+ # Splits the string on character boundaries, which are determined based on $KCODE.
+ string.split(//).all? { |c| expression.match(c) }
+ else
+ true
end
- true
end
end
@@ -49,9 +49,8 @@ module ActiveSupport #:nodoc:
else
def self.clean(string)
if expression = valid_character
- stripped = []; for c in string.split(//)
- stripped << c if expression.match(c)
- end; stripped.join
+ # Splits the string on character boundaries, which are determined based on $KCODE.
+ string.split(//).grep(expression).join
else
string
end
diff --git a/activesupport/lib/active_support/new_callbacks.rb b/activesupport/lib/active_support/new_callbacks.rb
deleted file mode 100644
index 2f0853d84a..0000000000
--- a/activesupport/lib/active_support/new_callbacks.rb
+++ /dev/null
@@ -1,563 +0,0 @@
-require 'active_support/core_ext/array/wrap'
-require 'active_support/core_ext/class/inheritable_attributes'
-require 'active_support/core_ext/kernel/reporting'
-
-module ActiveSupport
- # Callbacks are hooks into the lifecycle of an object that allow you to trigger logic
- # before or after an alteration of the object state.
- #
- # Mixing in this module allows you to define callbacks in your class.
- #
- # Example:
- # class Storage
- # include ActiveSupport::Callbacks
- #
- # define_callbacks :save
- # end
- #
- # class ConfigStorage < Storage
- # set_callback :save, :before, :saving_message
- # def saving_message
- # puts "saving..."
- # end
- #
- # set_callback :save, :after do |object|
- # puts "saved"
- # end
- #
- # def save
- # _run_set_callback :save,s do
- # puts "- save"
- # end
- # end
- # end
- #
- # config = ConfigStorage.new
- # config.save
- #
- # Output:
- # saving...
- # - save
- # saved
- #
- # Callbacks from parent classes are inherited.
- #
- # Example:
- # class Storage
- # include ActiveSupport::Callbacks
- #
- # define_callbacks :save
- #
- # set_callback :save, :before, :prepare
- # def prepare
- # puts "preparing save"
- # end
- # end
- #
- # class ConfigStorage < Storage
- # set_callback :save, :before, :saving_message
- # def saving_message
- # puts "saving..."
- # end
- #
- # set_callback :save, :after do |object|
- # puts "saved"
- # end
- #
- # def save
- # _run_set_callback :save,s do
- # puts "- save"
- # end
- # end
- # end
- #
- # config = ConfigStorage.new
- # config.save
- #
- # Output:
- # preparing save
- # saving...
- # - save
- # saved
- #
- module NewCallbacks
- def self.included(klass)
- klass.extend ClassMethods
- end
-
- def run_callbacks(kind, options = {}, &blk)
- send("_run_#{kind}_callbacks", &blk)
- end
-
- class Callback
- @@_callback_sequence = 0
-
- attr_accessor :chain, :filter, :kind, :options, :per_key, :klass
-
- def initialize(chain, filter, kind, options, klass)
- @chain, @kind, @klass = chain, kind, klass
- normalize_options!(options)
-
- @per_key = options.delete(:per_key)
- @raw_filter, @options = filter, options
- @filter = _compile_filter(filter)
- @compiled_options = _compile_options(options)
- @callback_id = next_id
-
- _compile_per_key_options
- end
-
- def clone(chain, klass)
- obj = super()
- obj.chain = chain
- obj.klass = klass
- obj.per_key = @per_key.dup
- obj.options = @options.dup
- obj.per_key[:if] = @per_key[:if].dup
- obj.per_key[:unless] = @per_key[:unless].dup
- obj.options[:if] = @options[:if].dup
- obj.options[:unless] = @options[:unless].dup
- obj
- end
-
- def normalize_options!(options)
- options[:if] = Array.wrap(options[:if])
- options[:unless] = Array.wrap(options[:unless])
-
- options[:per_key] ||= {}
- options[:per_key][:if] = Array.wrap(options[:per_key][:if])
- options[:per_key][:unless] = Array.wrap(options[:per_key][:unless])
- end
-
- def name
- chain.name
- end
-
- def next_id
- @@_callback_sequence += 1
- end
-
- def matches?(_kind, _filter)
- @kind == _kind && @filter == _filter
- end
-
- def _update_filter(filter_options, new_options)
- filter_options[:if].push(new_options[:unless]) if new_options.key?(:unless)
- filter_options[:unless].push(new_options[:if]) if new_options.key?(:if)
- end
-
- def recompile!(_options, _per_key)
- _update_filter(self.options, _options)
- _update_filter(self.per_key, _per_key)
-
- @callback_id = next_id
- @filter = _compile_filter(@raw_filter)
- @compiled_options = _compile_options(@options)
- _compile_per_key_options
- end
-
- def _compile_per_key_options
- key_options = _compile_options(@per_key)
-
- @klass.class_eval <<-RUBY_EVAL, __FILE__, __LINE__ + 1
- def _one_time_conditions_valid_#{@callback_id}?
- true #{key_options[0]}
- end
- RUBY_EVAL
- end
-
- # This will supply contents for before and around filters, and no
- # contents for after filters (for the forward pass).
- def start(key=nil, object=nil)
- return if key && !object.send("_one_time_conditions_valid_#{@callback_id}?")
-
- # options[0] is the compiled form of supplied conditions
- # options[1] is the "end" for the conditional
- #
- if @kind == :before || @kind == :around
- if @kind == :before
- # if condition # before_save :filter_name, :if => :condition
- # filter_name
- # end
- filter = <<-RUBY_EVAL
- unless halted
- result = #{@filter}
- halted = (#{chain.config[:terminator]})
- end
- RUBY_EVAL
-
- [@compiled_options[0], filter, @compiled_options[1]].compact.join("\n")
- else
- # Compile around filters with conditions into proxy methods
- # that contain the conditions.
- #
- # For `around_save :filter_name, :if => :condition':
- #
- # def _conditional_callback_save_17
- # if condition
- # filter_name do
- # yield self
- # end
- # else
- # yield self
- # end
- # end
- #
- name = "_conditional_callback_#{@kind}_#{next_id}"
- txt, line = <<-RUBY_EVAL, __LINE__ + 1
- def #{name}(halted)
- #{@compiled_options[0] || "if true"} && !halted
- #{@filter} do
- yield self
- end
- else
- yield self
- end
- end
- RUBY_EVAL
- @klass.class_eval(txt, __FILE__, line)
- "#{name}(halted) do"
- end
- end
- end
-
- # This will supply contents for around and after filters, but not
- # before filters (for the backward pass).
- def end(key=nil, object=nil)
- return if key && !object.send("_one_time_conditions_valid_#{@callback_id}?")
-
- if @kind == :around || @kind == :after
- # if condition # after_save :filter_name, :if => :condition
- # filter_name
- # end
- if @kind == :after
- [@compiled_options[0], @filter, @compiled_options[1]].compact.join("\n")
- else
- "end"
- end
- end
- end
-
- private
-
- # Options support the same options as filters themselves (and support
- # symbols, string, procs, and objects), so compile a conditional
- # expression based on the options
- def _compile_options(options)
- return [] if options[:if].empty? && options[:unless].empty?
-
- conditions = []
-
- unless options[:if].empty?
- conditions << Array.wrap(_compile_filter(options[:if]))
- end
-
- unless options[:unless].empty?
- conditions << Array.wrap(_compile_filter(options[:unless])).map {|f| "!#{f}"}
- end
-
- ["if #{conditions.flatten.join(" && ")}", "end"]
- end
-
- # Filters support:
- #
- # Arrays:: Used in conditions. This is used to specify
- # multiple conditions. Used internally to
- # merge conditions from skip_* filters
- # Symbols:: A method to call
- # Strings:: Some content to evaluate
- # Procs:: A proc to call with the object
- # Objects:: An object with a before_foo method on it to call
- #
- # All of these objects are compiled into methods and handled
- # the same after this point:
- #
- # Arrays:: Merged together into a single filter
- # Symbols:: Already methods
- # Strings:: class_eval'ed into methods
- # Procs:: define_method'ed into methods
- # Objects::
- # a method is created that calls the before_foo method
- # on the object.
- #
- def _compile_filter(filter)
- method_name = "_callback_#{@kind}_#{next_id}"
- case filter
- when Array
- filter.map {|f| _compile_filter(f)}
- when Symbol
- filter
- when String
- "(#{filter})"
- when Proc
- @klass.send(:define_method, method_name, &filter)
- return method_name if filter.arity <= 0
-
- method_name << (filter.arity == 1 ? "(self)" : " self, Proc.new ")
- else
- @klass.send(:define_method, "#{method_name}_object") { filter }
-
- _normalize_legacy_filter(kind, filter)
- scopes = Array.wrap(chain.config[:scope])
- method_to_call = scopes.map{ |s| s.is_a?(Symbol) ? send(s) : s }.join("_")
-
- @klass.class_eval <<-RUBY_EVAL, __FILE__, __LINE__ + 1
- def #{method_name}(&blk)
- #{method_name}_object.send(:#{method_to_call}, self, &blk)
- end
- RUBY_EVAL
-
- method_name
- end
- end
-
- def _normalize_legacy_filter(kind, filter)
- if !filter.respond_to?(kind) && filter.respond_to?(:filter)
- filter.metaclass.class_eval(
- "def #{kind}(context, &block) filter(context, &block) end",
- __FILE__, __LINE__ - 1)
- elsif filter.respond_to?(:before) && filter.respond_to?(:after) && kind == :around
- def filter.around(context)
- should_continue = before(context)
- yield if should_continue
- after(context)
- end
- end
- end
- end
-
- # An Array with a compile method
- class CallbackChain < Array
- attr_reader :name, :config
-
- def initialize(name, config)
- @name = name
- @config = {
- :terminator => "false",
- :rescuable => false,
- :scope => [ :kind ]
- }.merge(config)
- end
-
- def compile(key=nil, object=nil)
- method = []
- method << "value = nil"
- method << "halted = false"
-
- each do |callback|
- method << callback.start(key, object)
- end
-
- if config[:rescuable]
- method << "rescued_error = nil"
- method << "begin"
- end
-
- method << "value = yield if block_given? && !halted"
-
- if config[:rescuable]
- method << "rescue Exception => e"
- method << "rescued_error = e"
- method << "end"
- end
-
- reverse_each do |callback|
- method << callback.end(key, object)
- end
-
- method << "raise rescued_error if rescued_error" if config[:rescuable]
- method << "halted ? false : (block_given? ? value : true)"
- method.compact.join("\n")
- end
-
- def clone(klass)
- chain = CallbackChain.new(@name, @config.dup)
- callbacks = map { |c| c.clone(chain, klass) }
- chain.push(*callbacks)
- end
- end
-
- module ClassMethods
- # Make the _run_set_callback :save method. The generated method takes
- # a block that it'll yield to. It'll call the before and around filters
- # in order, yield the block, and then run the after filters.
- #
- # _run_set_callback :save do
- # save
- # end
- #
- # The _run_set_callback :save method can optionally take a key, which
- # will be used to compile an optimized callback method for each
- # key. See #define_callbacks for more information.
- #
- def __define_runner(symbol) #:nodoc:
- body = send("_#{symbol}_callbacks").compile(nil)
-
- body, line = <<-RUBY_EVAL, __LINE__
- def _run_#{symbol}_callbacks(key = nil, &blk)
- if key
- name = "_run__\#{self.class.name.hash.abs}__#{symbol}__\#{key.hash.abs}__callbacks"
-
- unless respond_to?(name)
- self.class.__create_keyed_callback(name, :#{symbol}, self, &blk)
- end
-
- send(name, &blk)
- else
- #{body}
- end
- end
- RUBY_EVAL
-
- silence_warnings do
- undef_method "_run_#{symbol}_callbacks" if method_defined?("_run_#{symbol}_callbacks")
- class_eval body, __FILE__, line
- end
- end
-
- # This is called the first time a callback is called with a particular
- # key. It creates a new callback method for the key, calculating
- # which callbacks can be omitted because of per_key conditions.
- #
- def __create_keyed_callback(name, kind, object, &blk) #:nodoc:
- @_keyed_callbacks ||= {}
- @_keyed_callbacks[name] ||= begin
- str = send("_#{kind}_callbacks").compile(name, object)
- class_eval "def #{name}() #{str} end", __FILE__, __LINE__
- true
- end
- end
-
- # This is used internally to append, prepend and skip callbacks to the
- # CallbackChain.
- #
- def __update_callbacks(name, filters = [], block = nil) #:nodoc:
- type = [:before, :after, :around].include?(filters.first) ? filters.shift : :before
- options = filters.last.is_a?(Hash) ? filters.pop : {}
- filters.unshift(block) if block
-
- chain = send("_#{name}_callbacks")
- yield chain, type, filters, options if block_given?
-
- __define_runner(name)
- end
-
- # Set callbacks for a previously defined callback.
- #
- # Syntax:
- # set_callback :save, :before, :before_meth
- # set_callback :save, :after, :after_meth, :if => :condition
- # set_callback :save, :around, lambda { |r| stuff; yield; stuff }
- #
- # It also updates the _run_<name>_callbacks method, which is the public
- # API to run the callbacks. Use skip_callback to skip any defined one.
- #
- # When creating or skipping callbacks, you can specify conditions that
- # are always the same for a given key. For instance, in ActionPack,
- # we convert :only and :except conditions into per-key conditions.
- #
- # before_filter :authenticate, :except => "index"
- # becomes
- # dispatch_callback :before, :authenticate, :per_key => {:unless => proc {|c| c.action_name == "index"}}
- #
- # Per-Key conditions are evaluated only once per use of a given key.
- # In the case of the above example, you would do:
- #
- # _run_dispatch_callbacks(action_name) { ... dispatch stuff ... }
- #
- # In that case, each action_name would get its own compiled callback
- # method that took into consideration the per_key conditions. This
- # is a speed improvement for ActionPack.
- #
- def set_callback(name, *filters, &block)
- __update_callbacks(name, filters, block) do |chain, type, filters, options|
- filters.map! do |filter|
- chain.delete_if {|c| c.matches?(type, filter) }
- Callback.new(chain, filter, type, options.dup, self)
- end
-
- options[:prepend] ? chain.unshift(*filters) : chain.push(*filters)
- end
- end
-
- # Skip a previously defined callback for a given type.
- #
- def skip_callback(name, *filters, &block)
- __update_callbacks(name, filters, block) do |chain, type, filters, options|
- chain = send("_#{name}_callbacks=", chain.clone(self))
-
- filters.each do |filter|
- filter = chain.find {|c| c.matches?(type, filter) }
-
- if filter && options.any?
- filter.recompile!(options, options[:per_key] || {})
- else
- chain.delete(filter)
- end
- end
- end
- end
-
- # Reset callbacks for a given type.
- #
- def reset_callbacks(symbol)
- send("_#{symbol}_callbacks").clear
- __define_runner(symbol)
- end
-
- # Define callbacks types.
- #
- # ==== Example
- #
- # define_callbacks :validate
- #
- # ==== Options
- #
- # * <tt>:terminator</tt> - Indicates when a before filter is considered
- # to be halted.
- #
- # define_callbacks :validate, :terminator => "result == false"
- #
- # In the example above, if any before validate callbacks returns false,
- # other callbacks are not executed. Defaults to "false".
- #
- # * <tt>:rescuable</tt> - By default, after filters are not executed if
- # the given block or an before_filter raises an error. Supply :rescuable => true
- # to change this behavior.
- #
- # * <tt>:scope</tt> - Show which methods should be executed when a class
- # is giben as callback:
- #
- # define_callbacks :filters, :scope => [ :kind ]
- #
- # When a class is given:
- #
- # before_filter MyFilter
- #
- # It will call the type of the filter in the given class, which in this
- # case, is "before".
- #
- # If, for instance, you supply the given scope:
- #
- # define_callbacks :validate, :scope => [ :kind, :name ]
- #
- # It will call "#{kind}_#{name}" in the given class. So "before_validate"
- # will be called in the class below:
- #
- # before_validate MyValidation
- #
- # Defaults to :kind.
- #
- def define_callbacks(*symbols)
- config = symbols.last.is_a?(Hash) ? symbols.pop : {}
- symbols.each do |symbol|
- extlib_inheritable_accessor("_#{symbol}_callbacks") do
- CallbackChain.new(symbol, config)
- end
-
- __define_runner(symbol)
- end
- end
- end
- end
-end
diff --git a/activesupport/lib/active_support/notifications.rb b/activesupport/lib/active_support/notifications.rb
new file mode 100644
index 0000000000..7a9f76b26a
--- /dev/null
+++ b/activesupport/lib/active_support/notifications.rb
@@ -0,0 +1,189 @@
+require 'thread'
+require 'active_support/core_ext/module/delegation'
+require 'active_support/core_ext/module/attribute_accessors'
+require 'active_support/secure_random'
+
+module ActiveSupport
+ # Notifications provides an instrumentation API for Ruby. To instrument an
+ # action in Ruby you just need to do:
+ #
+ # ActiveSupport::Notifications.instrument(:render, :extra => :information) do
+ # render :text => "Foo"
+ # end
+ #
+ # You can consume those events and the information they provide by registering
+ # a subscriber. For instance, let's store all instrumented events in an array:
+ #
+ # @events = []
+ #
+ # ActiveSupport::Notifications.subscribe do |*args|
+ # @events << ActiveSupport::Notifications::Event.new(*args)
+ # end
+ #
+ # ActiveSupport::Notifications.instrument(:render, :extra => :information) do
+ # render :text => "Foo"
+ # end
+ #
+ # event = @events.first
+ # event.name #=> :render
+ # event.duration #=> 10 (in miliseconds)
+ # event.result #=> "Foo"
+ # event.payload #=> { :extra => :information }
+ #
+ # When subscribing to Notifications, you can pass a pattern, to only consume
+ # events that match the pattern:
+ #
+ # ActiveSupport::Notifications.subscribe(/render/) do |event|
+ # @render_events << event
+ # end
+ #
+ # Notifications ships with a queue implementation that consumes and publish events
+ # to subscribers in a thread. You can use any queue implementation you want.
+ #
+ module Notifications
+ mattr_accessor :queue
+
+ class << self
+ delegate :instrument, :transaction_id, :transaction, :to => :instrumenter
+
+ def instrumenter
+ Thread.current[:notifications_instrumeter] ||= Instrumenter.new(publisher)
+ end
+
+ def publisher
+ @publisher ||= Publisher.new(queue)
+ end
+
+ def subscribe(pattern=nil, &block)
+ Subscriber.new(queue).bind(pattern).subscribe(&block)
+ end
+ end
+
+ class Instrumenter
+ def initialize(publisher)
+ @publisher = publisher
+ @id = random_id
+ end
+
+ def transaction
+ @id, old_id = random_id, @id
+ yield
+ ensure
+ @id = old_id
+ end
+
+ def transaction_id
+ @id
+ end
+
+ def instrument(name, payload={})
+ time = Time.now
+ result = yield if block_given?
+ ensure
+ @publisher.publish(name, time, Time.now, result, @id, payload)
+ end
+
+ private
+ def random_id
+ SecureRandom.hex(10)
+ end
+ end
+
+ class Publisher
+ def initialize(queue)
+ @queue = queue
+ end
+
+ def publish(*args)
+ @queue.publish(*args)
+ end
+ end
+
+ class Subscriber
+ def initialize(queue)
+ @queue = queue
+ end
+
+ def bind(pattern)
+ @pattern = pattern
+ self
+ end
+
+ def subscribe
+ @queue.subscribe(@pattern) do |*args|
+ yield(*args)
+ end
+ end
+ end
+
+ class Event
+ attr_reader :name, :time, :end, :transaction_id, :result, :payload
+
+ def initialize(name, start, ending, result, transaction_id, payload)
+ @name = name
+ @payload = payload.dup
+ @time = start
+ @transaction_id = transaction_id
+ @end = ending
+ @result = result
+ end
+
+ def duration
+ @duration ||= 1000.0 * (@end - @time)
+ end
+
+ def parent_of?(event)
+ start = (self.time - event.time) * 1000
+ start <= 0 && (start + duration >= event.duration)
+ end
+ end
+
+ # This is a default queue implementation that ships with Notifications. It
+ # consumes events in a thread and publish them to all registered subscribers.
+ #
+ class LittleFanout
+ def initialize
+ @listeners = []
+ end
+
+ def publish(*args)
+ @listeners.each { |l| l.publish(*args) }
+ end
+
+ def subscribe(pattern=nil, &block)
+ @listeners << Listener.new(pattern, &block)
+ end
+
+ def drained?
+ @listeners.all? &:drained?
+ end
+
+ class Listener
+ def initialize(pattern, &block)
+ @pattern = pattern
+ @subscriber = block
+ @queue = Queue.new
+ Thread.new { consume }
+ end
+
+ def publish(name, *args)
+ if !@pattern || @pattern === name.to_s
+ @queue << args.unshift(name)
+ end
+ end
+
+ def consume
+ while args = @queue.shift
+ @subscriber.call(*args)
+ end
+ end
+
+ def drained?
+ @queue.size.zero?
+ end
+ end
+ end
+ end
+
+ Notifications.queue = Notifications::LittleFanout.new
+end
diff --git a/activesupport/lib/active_support/orchestra.rb b/activesupport/lib/active_support/orchestra.rb
deleted file mode 100644
index efe30669d8..0000000000
--- a/activesupport/lib/active_support/orchestra.rb
+++ /dev/null
@@ -1,103 +0,0 @@
-require 'thread'
-
-module ActiveSupport
- # Orchestra provides an instrumentation API for Ruby. To instrument an action
- # in Ruby you just need to:
- #
- # ActiveSupport::Orchestra.instrument(:render, :extra => :information) do
- # render :text => "Foo"
- # end
- #
- # Those actions are consumed by listeners. A listener is anything that responds
- # to push. You can even register an array:
- #
- # @listener = []
- # ActiveSupport::Orchestra.register @listener
- #
- # ActiveSupport::Orchestra.instrument(:render, :extra => :information) do
- # render :text => "Foo"
- # end
- #
- # event #=> ActiveSupport::Orchestra::Event
- # event.name #=> :render
- # event.duration #=> 10 (in miliseconds)
- # event.result #=> "Foo"
- # event.payload #=> { :extra => :information }
- #
- # Orchestra ships with a default listener implementation which puts events in
- # a stream and consume them in a Thread. This implementation is thread safe
- # and is available at ActiveSupport::Orchestra::Listener.
- #
- module Orchestra
- @stacked_events = Hash.new { |h,k| h[k] = [] }
- @listeners = []
-
- def self.instrument(name, payload=nil)
- stack = @stacked_events[Thread.current.object_id]
- event = Event.new(name, stack.last, payload)
- stack << event
- event.result = yield
- event
- ensure
- event.finish!
- stack.delete(event)
- @listeners.each { |s| s.push(event) }
- end
-
- def self.register(listener)
- @listeners << listener
- end
-
- def self.unregister(listener)
- @listeners.delete(listener)
- end
-
- class Event
- attr_reader :name, :time, :duration, :parent, :thread_id, :payload
- attr_accessor :result
-
- def initialize(name, parent=nil, payload=nil)
- @name = name
- @time = Time.now
- @thread_id = Thread.current.object_id
- @parent = parent
- @payload = payload
- end
-
- def finish!
- @duration = 1000 * (Time.now.to_f - @time.to_f)
- end
- end
-
- class Listener
- attr_reader :mutex, :signaler, :thread
-
- def initialize
- @mutex, @signaler = Mutex.new, ConditionVariable.new
- @stream = []
- @thread = Thread.new do
- loop do
- (event = @stream.shift) ? consume(event) : wait
- end
- end
- end
-
- def wait
- @mutex.synchronize do
- @signaler.wait(@mutex)
- end
- end
-
- def push(event)
- @mutex.synchronize do
- @stream.push(event)
- @signaler.broadcast
- end
- end
-
- def consume(event)
- raise NotImplementedError
- end
- end
- end
-end
diff --git a/activesupport/lib/active_support/ordered_hash.rb b/activesupport/lib/active_support/ordered_hash.rb
index 4324e40cbb..b492648610 100644
--- a/activesupport/lib/active_support/ordered_hash.rb
+++ b/activesupport/lib/active_support/ordered_hash.rb
@@ -120,6 +120,13 @@ module ActiveSupport
dup.merge!(other_hash)
end
+ # When replacing with another hash, the initial order of our keys must come from the other hash -ordered or not.
+ def replace(other)
+ super
+ @keys = other.keys
+ self
+ end
+
def inspect
"#<OrderedHash #{super}>"
end
diff --git a/activesupport/lib/active_support/rescuable.rb b/activesupport/lib/active_support/rescuable.rb
index a7258c870a..f0119f5994 100644
--- a/activesupport/lib/active_support/rescuable.rb
+++ b/activesupport/lib/active_support/rescuable.rb
@@ -4,11 +4,11 @@ require 'active_support/core_ext/proc'
module ActiveSupport
# Rescuable module adds support for easier exception handling.
module Rescuable
- def self.included(base) # :nodoc:
- base.class_inheritable_accessor :rescue_handlers
- base.rescue_handlers = []
+ extend Concern
- base.extend(ClassMethods)
+ included do
+ class_inheritable_accessor :rescue_handlers
+ self.rescue_handlers = []
end
module ClassMethods
@@ -81,7 +81,7 @@ module ActiveSupport
def handler_for_rescue(exception)
# We go from right to left because pairs are pushed onto rescue_handlers
# as rescue_from declarations are found.
- _, rescuer = Array(rescue_handlers).reverse.detect do |klass_name, handler|
+ _, rescuer = rescue_handlers.reverse.detect do |klass_name, handler|
# The purpose of allowing strings in rescue_from is to support the
# declaration of handler associations for exception classes whose
# definition is yet unknown.
diff --git a/activesupport/lib/active_support/ruby/shim.rb b/activesupport/lib/active_support/ruby/shim.rb
index 37c57c485a..f811239077 100644
--- a/activesupport/lib/active_support/ruby/shim.rb
+++ b/activesupport/lib/active_support/ruby/shim.rb
@@ -4,21 +4,15 @@
# Date next_year, next_month
# DateTime to_date, to_datetime, xmlschema
# Enumerable group_by, each_with_object, none?
-# Integer even?, odd?
-# Object tap
# Process Process.daemon
# REXML security fix
# String ord
-# Symbol to_proc
# Time to_date, to_time, to_datetime
require 'active_support'
require 'active_support/core_ext/date/calculations'
require 'active_support/core_ext/date_time/conversions'
require 'active_support/core_ext/enumerable'
-require 'active_support/core_ext/integer/even_odd'
-require 'active_support/core_ext/object/tap'
require 'active_support/core_ext/process/daemon'
require 'active_support/core_ext/string/conversions'
require 'active_support/core_ext/rexml'
-require 'active_support/core_ext/symbol/to_proc'
require 'active_support/core_ext/time/conversions'
diff --git a/activesupport/lib/active_support/testing/isolation.rb b/activesupport/lib/active_support/testing/isolation.rb
index bec303f6ab..c75b59c284 100644
--- a/activesupport/lib/active_support/testing/isolation.rb
+++ b/activesupport/lib/active_support/testing/isolation.rb
@@ -1,5 +1,3 @@
-require 'active_support/core_ext/load_error'
-
module ActiveSupport
module Testing
class ProxyTestResult
diff --git a/activesupport/lib/active_support/testing/setup_and_teardown.rb b/activesupport/lib/active_support/testing/setup_and_teardown.rb
index b59ac79e7b..0e998d2dbe 100644
--- a/activesupport/lib/active_support/testing/setup_and_teardown.rb
+++ b/activesupport/lib/active_support/testing/setup_and_teardown.rb
@@ -1,11 +1,9 @@
-require 'active_support/callbacks'
-
module ActiveSupport
module Testing
module SetupAndTeardown
def self.included(base)
base.class_eval do
- include ActiveSupport::Callbacks
+ include ActiveSupport::DeprecatedCallbacks
define_callbacks :setup, :teardown
if defined?(MiniTest::Assertions) && TestCase < MiniTest::Assertions
@@ -23,18 +21,18 @@ module ActiveSupport
run_callbacks :setup
result = super
rescue Exception => e
- result = runner.puke(self.class, self.name, e)
+ result = runner.puke(self.class, method_name, e)
ensure
begin
run_callbacks :teardown, :enumerator => :reverse_each
rescue Exception => e
- result = runner.puke(self.class, self.name, e)
+ result = runner.puke(self.class, method_name, e)
end
end
result
end
end
-
+
module ForClassicTestUnit
# For compatibility with Ruby < 1.8.6
PASSTHROUGH_EXCEPTIONS = Test::Unit::TestCase::PASSTHROUGH_EXCEPTIONS rescue [NoMemoryError, SignalException, Interrupt, SystemExit]
diff --git a/activesupport/lib/active_support/time.rb b/activesupport/lib/active_support/time.rb
index d36a683601..0f421421d0 100644
--- a/activesupport/lib/active_support/time.rb
+++ b/activesupport/lib/active_support/time.rb
@@ -1,7 +1,4 @@
require 'active_support'
-require 'active_support/core_ext/time'
-require 'active_support/core_ext/date'
-require 'active_support/core_ext/date_time'
module ActiveSupport
autoload :Duration, 'active_support/duration'
@@ -12,3 +9,26 @@ module ActiveSupport
[Duration, TimeWithZone, TimeZone]
end
end
+
+require 'date'
+require 'time'
+
+require 'active_support/core_ext/time/publicize_conversion_methods'
+require 'active_support/core_ext/time/marshal_with_utc_flag'
+require 'active_support/core_ext/time/acts_like'
+require 'active_support/core_ext/time/calculations'
+require 'active_support/core_ext/time/conversions'
+require 'active_support/core_ext/time/zones'
+
+require 'active_support/core_ext/date/acts_like'
+require 'active_support/core_ext/date/freeze'
+require 'active_support/core_ext/date/calculations'
+require 'active_support/core_ext/date/conversions'
+
+require 'active_support/core_ext/date_time/acts_like'
+require 'active_support/core_ext/date_time/calculations'
+require 'active_support/core_ext/date_time/conversions'
+require 'active_support/core_ext/date_time/zones'
+
+require 'active_support/core_ext/integer/time'
+require 'active_support/core_ext/numeric/time'
diff --git a/activesupport/lib/active_support/time_with_zone.rb b/activesupport/lib/active_support/time_with_zone.rb
index 4907fae9d6..8304f6c434 100644
--- a/activesupport/lib/active_support/time_with_zone.rb
+++ b/activesupport/lib/active_support/time_with_zone.rb
@@ -1,9 +1,4 @@
-require 'active_support/duration'
-require 'active_support/core_ext/numeric/time'
-require 'active_support/core_ext/integer/time'
-require 'active_support/core_ext/time/conversions'
-require 'active_support/core_ext/date/conversions'
-require 'active_support/core_ext/date_time/conversions'
+require "active_support/values/time_zone"
module ActiveSupport
# A Time-like class that can represent a time in any time zone. Necessary because standard Ruby Time instances are
diff --git a/activesupport/lib/active_support/values/time_zone.rb b/activesupport/lib/active_support/values/time_zone.rb
index 564528bfe2..cbb8e890ae 100644
--- a/activesupport/lib/active_support/values/time_zone.rb
+++ b/activesupport/lib/active_support/values/time_zone.rb
@@ -1,6 +1,4 @@
-require 'active_support/core_ext/time'
-require 'active_support/core_ext/date'
-require 'active_support/core_ext/date_time'
+require 'active_support/core_ext/object/blank'
# The TimeZone class serves as a wrapper around TZInfo::Timezone instances. It allows us to do the following:
#
@@ -63,7 +61,7 @@ module ActiveSupport
"Azores" => "Atlantic/Azores",
"Cape Verde Is." => "Atlantic/Cape_Verde",
"Dublin" => "Europe/Dublin",
- "Edinburgh" => "Europe/Dublin",
+ "Edinburgh" => "Europe/London",
"Lisbon" => "Europe/Lisbon",
"London" => "Europe/London",
"Casablanca" => "Africa/Casablanca",
diff --git a/activesupport/lib/active_support/vendor.rb b/activesupport/lib/active_support/vendor.rb
index 9f464c8246..eb5080888c 100644
--- a/activesupport/lib/active_support/vendor.rb
+++ b/activesupport/lib/active_support/vendor.rb
@@ -1,16 +1,19 @@
+require 'pathname'
+
def ActiveSupport.requirable?(file)
$LOAD_PATH.any? { |p| Dir.glob("#{p}/#{file}.*").any? }
end
-[%w(builder 2.1.2), %w(i18n 0.1.3), %w(memcache-client 1.7.5), %w(tzinfo 0.3.13)].each do |lib, version|
+[%w(builder 2.1.2), %w(i18n 0.1.3), %w(memcache-client 1.7.5), %w(tzinfo 0.3.15)].each do |lib, version|
# If the lib is not already requirable
unless ActiveSupport.requirable? lib
# Try to activate a gem ~> satisfying the requested version first.
begin
- gem lib, "~> #{version}"
+ gem lib, ">= #{version}"
# Use the vendored lib if the gem's missing or we aren't using RubyGems.
rescue LoadError, NoMethodError
- $LOAD_PATH.unshift File.expand_path("#{File.dirname(__FILE__)}/vendor/#{lib}-#{version}/lib")
+ # There could be symlinks
+ $LOAD_PATH.unshift Pathname.new(__FILE__).dirname.join("vendor/#{lib}-#{version}/lib").realpath.to_s
end
end
end
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Argentina/Buenos_Aires.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Argentina/Buenos_Aires.rb
deleted file mode 100644
index 8f4dd31dbb..0000000000
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Argentina/Buenos_Aires.rb
+++ /dev/null
@@ -1,166 +0,0 @@
-require 'tzinfo/timezone_definition'
-
-module TZInfo
- module Definitions
- module America
- module Argentina
- module Buenos_Aires
- include TimezoneDefinition
-
- timezone 'America/Argentina/Buenos_Aires' do |tz|
- tz.offset :o0, -14028, 0, :LMT
- tz.offset :o1, -15408, 0, :CMT
- tz.offset :o2, -14400, 0, :ART
- tz.offset :o3, -14400, 3600, :ARST
- tz.offset :o4, -10800, 0, :ART
- tz.offset :o5, -10800, 3600, :ARST
-
- tz.transition 1894, 10, :o1, 17374555169, 7200
- tz.transition 1920, 5, :o2, 1453467407, 600
- tz.transition 1930, 12, :o3, 7278935, 3
- tz.transition 1931, 4, :o2, 19411461, 8
- tz.transition 1931, 10, :o3, 7279889, 3
- tz.transition 1932, 3, :o2, 19414141, 8
- tz.transition 1932, 11, :o3, 7281038, 3
- tz.transition 1933, 3, :o2, 19417061, 8
- tz.transition 1933, 11, :o3, 7282133, 3
- tz.transition 1934, 3, :o2, 19419981, 8
- tz.transition 1934, 11, :o3, 7283228, 3
- tz.transition 1935, 3, :o2, 19422901, 8
- tz.transition 1935, 11, :o3, 7284323, 3
- tz.transition 1936, 3, :o2, 19425829, 8
- tz.transition 1936, 11, :o3, 7285421, 3
- tz.transition 1937, 3, :o2, 19428749, 8
- tz.transition 1937, 11, :o3, 7286516, 3
- tz.transition 1938, 3, :o2, 19431669, 8
- tz.transition 1938, 11, :o3, 7287611, 3
- tz.transition 1939, 3, :o2, 19434589, 8
- tz.transition 1939, 11, :o3, 7288706, 3
- tz.transition 1940, 3, :o2, 19437517, 8
- tz.transition 1940, 7, :o3, 7289435, 3
- tz.transition 1941, 6, :o2, 19441285, 8
- tz.transition 1941, 10, :o3, 7290848, 3
- tz.transition 1943, 8, :o2, 19447501, 8
- tz.transition 1943, 10, :o3, 7293038, 3
- tz.transition 1946, 3, :o2, 19455045, 8
- tz.transition 1946, 10, :o3, 7296284, 3
- tz.transition 1963, 10, :o2, 19506429, 8
- tz.transition 1963, 12, :o3, 7315136, 3
- tz.transition 1964, 3, :o2, 19507645, 8
- tz.transition 1964, 10, :o3, 7316051, 3
- tz.transition 1965, 3, :o2, 19510565, 8
- tz.transition 1965, 10, :o3, 7317146, 3
- tz.transition 1966, 3, :o2, 19513485, 8
- tz.transition 1966, 10, :o3, 7318241, 3
- tz.transition 1967, 4, :o2, 19516661, 8
- tz.transition 1967, 10, :o3, 7319294, 3
- tz.transition 1968, 4, :o2, 19519629, 8
- tz.transition 1968, 10, :o3, 7320407, 3
- tz.transition 1969, 4, :o2, 19522541, 8
- tz.transition 1969, 10, :o4, 7321499, 3
- tz.transition 1974, 1, :o5, 128142000
- tz.transition 1974, 5, :o4, 136605600
- tz.transition 1988, 12, :o5, 596948400
- tz.transition 1989, 3, :o4, 605066400
- tz.transition 1989, 10, :o5, 624423600
- tz.transition 1990, 3, :o4, 636516000
- tz.transition 1990, 10, :o5, 656478000
- tz.transition 1991, 3, :o4, 667965600
- tz.transition 1991, 10, :o5, 687927600
- tz.transition 1992, 3, :o4, 699415200
- tz.transition 1992, 10, :o5, 719377200
- tz.transition 1993, 3, :o4, 731469600
- tz.transition 1999, 10, :o3, 938919600
- tz.transition 2000, 3, :o4, 952052400
- tz.transition 2007, 12, :o5, 1198983600
- tz.transition 2008, 3, :o4, 1205632800
- tz.transition 2008, 10, :o5, 1224385200
- tz.transition 2009, 3, :o4, 1237082400
- tz.transition 2009, 10, :o5, 1255834800
- tz.transition 2010, 3, :o4, 1269136800
- tz.transition 2010, 10, :o5, 1287284400
- tz.transition 2011, 3, :o4, 1300586400
- tz.transition 2011, 10, :o5, 1318734000
- tz.transition 2012, 3, :o4, 1332036000
- tz.transition 2012, 10, :o5, 1350788400
- tz.transition 2013, 3, :o4, 1363485600
- tz.transition 2013, 10, :o5, 1382238000
- tz.transition 2014, 3, :o4, 1394935200
- tz.transition 2014, 10, :o5, 1413687600
- tz.transition 2015, 3, :o4, 1426384800
- tz.transition 2015, 10, :o5, 1445137200
- tz.transition 2016, 3, :o4, 1458439200
- tz.transition 2016, 10, :o5, 1476586800
- tz.transition 2017, 3, :o4, 1489888800
- tz.transition 2017, 10, :o5, 1508036400
- tz.transition 2018, 3, :o4, 1521338400
- tz.transition 2018, 10, :o5, 1540090800
- tz.transition 2019, 3, :o4, 1552788000
- tz.transition 2019, 10, :o5, 1571540400
- tz.transition 2020, 3, :o4, 1584237600
- tz.transition 2020, 10, :o5, 1602990000
- tz.transition 2021, 3, :o4, 1616292000
- tz.transition 2021, 10, :o5, 1634439600
- tz.transition 2022, 3, :o4, 1647741600
- tz.transition 2022, 10, :o5, 1665889200
- tz.transition 2023, 3, :o4, 1679191200
- tz.transition 2023, 10, :o5, 1697338800
- tz.transition 2024, 3, :o4, 1710640800
- tz.transition 2024, 10, :o5, 1729393200
- tz.transition 2025, 3, :o4, 1742090400
- tz.transition 2025, 10, :o5, 1760842800
- tz.transition 2026, 3, :o4, 1773540000
- tz.transition 2026, 10, :o5, 1792292400
- tz.transition 2027, 3, :o4, 1805594400
- tz.transition 2027, 10, :o5, 1823742000
- tz.transition 2028, 3, :o4, 1837044000
- tz.transition 2028, 10, :o5, 1855191600
- tz.transition 2029, 3, :o4, 1868493600
- tz.transition 2029, 10, :o5, 1887246000
- tz.transition 2030, 3, :o4, 1899943200
- tz.transition 2030, 10, :o5, 1918695600
- tz.transition 2031, 3, :o4, 1931392800
- tz.transition 2031, 10, :o5, 1950145200
- tz.transition 2032, 3, :o4, 1963447200
- tz.transition 2032, 10, :o5, 1981594800
- tz.transition 2033, 3, :o4, 1994896800
- tz.transition 2033, 10, :o5, 2013044400
- tz.transition 2034, 3, :o4, 2026346400
- tz.transition 2034, 10, :o5, 2044494000
- tz.transition 2035, 3, :o4, 2057796000
- tz.transition 2035, 10, :o5, 2076548400
- tz.transition 2036, 3, :o4, 2089245600
- tz.transition 2036, 10, :o5, 2107998000
- tz.transition 2037, 3, :o4, 2120695200
- tz.transition 2037, 10, :o5, 2139447600
- tz.transition 2038, 3, :o4, 29586043, 12
- tz.transition 2038, 10, :o5, 19725709, 8
- tz.transition 2039, 3, :o4, 29590411, 12
- tz.transition 2039, 10, :o5, 19728621, 8
- tz.transition 2040, 3, :o4, 29594779, 12
- tz.transition 2040, 10, :o5, 19731589, 8
- tz.transition 2041, 3, :o4, 29599147, 12
- tz.transition 2041, 10, :o5, 19734501, 8
- tz.transition 2042, 3, :o4, 29603515, 12
- tz.transition 2042, 10, :o5, 19737413, 8
- tz.transition 2043, 3, :o4, 29607883, 12
- tz.transition 2043, 10, :o5, 19740325, 8
- tz.transition 2044, 3, :o4, 29612335, 12
- tz.transition 2044, 10, :o5, 19743237, 8
- tz.transition 2045, 3, :o4, 29616703, 12
- tz.transition 2045, 10, :o5, 19746149, 8
- tz.transition 2046, 3, :o4, 29621071, 12
- tz.transition 2046, 10, :o5, 19749117, 8
- tz.transition 2047, 3, :o4, 29625439, 12
- tz.transition 2047, 10, :o5, 19752029, 8
- tz.transition 2048, 3, :o4, 29629807, 12
- tz.transition 2048, 10, :o5, 19754941, 8
- tz.transition 2049, 3, :o4, 29634259, 12
- tz.transition 2049, 10, :o5, 19757853, 8
- tz.transition 2050, 3, :o4, 29638627, 12
- end
- end
- end
- end
- end
-end
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Karachi.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Karachi.rb
deleted file mode 100644
index 4f187b4ad4..0000000000
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Karachi.rb
+++ /dev/null
@@ -1,32 +0,0 @@
-require 'tzinfo/timezone_definition'
-
-module TZInfo
- module Definitions
- module Asia
- module Karachi
- include TimezoneDefinition
-
- timezone 'Asia/Karachi' do |tz|
- tz.offset :o0, 16092, 0, :LMT
- tz.offset :o1, 19800, 0, :IST
- tz.offset :o2, 19800, 3600, :IST
- tz.offset :o3, 18000, 0, :KART
- tz.offset :o4, 18000, 0, :PKT
- tz.offset :o5, 18000, 3600, :PKST
-
- tz.transition 1906, 12, :o1, 1934061051, 800
- tz.transition 1942, 8, :o2, 116668957, 48
- tz.transition 1945, 10, :o1, 116723675, 48
- tz.transition 1951, 9, :o3, 116828125, 48
- tz.transition 1971, 3, :o4, 38775600
- tz.transition 2002, 4, :o5, 1018119660
- tz.transition 2002, 10, :o4, 1033840860
- tz.transition 2008, 5, :o5, 1212260400
- tz.transition 2008, 10, :o4, 1225476000
- tz.transition 2009, 4, :o5, 1239735600
- tz.transition 2009, 10, :o4, 1257012000
- end
- end
- end
- end
-end
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo.rb
index c8bdbeec5d..c8bdbeec5d 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/data_timezone.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/data_timezone.rb
index 5eccbdf0db..5eccbdf0db 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/data_timezone.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/data_timezone.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/data_timezone_info.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/data_timezone_info.rb
index a45d94554b..a45d94554b 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/data_timezone_info.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/data_timezone_info.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Africa/Algiers.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Africa/Algiers.rb
index 8c5f25577f..8c5f25577f 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Africa/Algiers.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Africa/Algiers.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Africa/Cairo.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Africa/Cairo.rb
index 6e6daf3522..b7ed8e8244 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Africa/Cairo.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Africa/Cairo.rb
@@ -129,89 +129,89 @@ module TZInfo
tz.transition 2008, 4, :o2, 1209074400
tz.transition 2008, 8, :o1, 1219957200
tz.transition 2009, 4, :o2, 1240524000
- tz.transition 2009, 8, :o1, 1251406800
+ tz.transition 2009, 8, :o1, 1250802000
tz.transition 2010, 4, :o2, 1272578400
- tz.transition 2010, 8, :o1, 1282856400
+ tz.transition 2010, 9, :o1, 1285880400
tz.transition 2011, 4, :o2, 1304028000
- tz.transition 2011, 8, :o1, 1314306000
+ tz.transition 2011, 9, :o1, 1317330000
tz.transition 2012, 4, :o2, 1335477600
- tz.transition 2012, 8, :o1, 1346360400
+ tz.transition 2012, 9, :o1, 1348779600
tz.transition 2013, 4, :o2, 1366927200
- tz.transition 2013, 8, :o1, 1377810000
+ tz.transition 2013, 9, :o1, 1380229200
tz.transition 2014, 4, :o2, 1398376800
- tz.transition 2014, 8, :o1, 1409259600
+ tz.transition 2014, 9, :o1, 1411678800
tz.transition 2015, 4, :o2, 1429826400
- tz.transition 2015, 8, :o1, 1440709200
+ tz.transition 2015, 9, :o1, 1443128400
tz.transition 2016, 4, :o2, 1461880800
- tz.transition 2016, 8, :o1, 1472158800
+ tz.transition 2016, 9, :o1, 1475182800
tz.transition 2017, 4, :o2, 1493330400
- tz.transition 2017, 8, :o1, 1504213200
+ tz.transition 2017, 9, :o1, 1506632400
tz.transition 2018, 4, :o2, 1524780000
- tz.transition 2018, 8, :o1, 1535662800
+ tz.transition 2018, 9, :o1, 1538082000
tz.transition 2019, 4, :o2, 1556229600
- tz.transition 2019, 8, :o1, 1567112400
+ tz.transition 2019, 9, :o1, 1569531600
tz.transition 2020, 4, :o2, 1587679200
- tz.transition 2020, 8, :o1, 1598562000
+ tz.transition 2020, 9, :o1, 1600981200
tz.transition 2021, 4, :o2, 1619733600
- tz.transition 2021, 8, :o1, 1630011600
+ tz.transition 2021, 9, :o1, 1633035600
tz.transition 2022, 4, :o2, 1651183200
- tz.transition 2022, 8, :o1, 1661461200
+ tz.transition 2022, 9, :o1, 1664485200
tz.transition 2023, 4, :o2, 1682632800
- tz.transition 2023, 8, :o1, 1693515600
+ tz.transition 2023, 9, :o1, 1695934800
tz.transition 2024, 4, :o2, 1714082400
- tz.transition 2024, 8, :o1, 1724965200
+ tz.transition 2024, 9, :o1, 1727384400
tz.transition 2025, 4, :o2, 1745532000
- tz.transition 2025, 8, :o1, 1756414800
+ tz.transition 2025, 9, :o1, 1758834000
tz.transition 2026, 4, :o2, 1776981600
- tz.transition 2026, 8, :o1, 1787864400
+ tz.transition 2026, 9, :o1, 1790283600
tz.transition 2027, 4, :o2, 1809036000
- tz.transition 2027, 8, :o1, 1819314000
+ tz.transition 2027, 9, :o1, 1822338000
tz.transition 2028, 4, :o2, 1840485600
- tz.transition 2028, 8, :o1, 1851368400
+ tz.transition 2028, 9, :o1, 1853787600
tz.transition 2029, 4, :o2, 1871935200
- tz.transition 2029, 8, :o1, 1882818000
+ tz.transition 2029, 9, :o1, 1885237200
tz.transition 2030, 4, :o2, 1903384800
- tz.transition 2030, 8, :o1, 1914267600
+ tz.transition 2030, 9, :o1, 1916686800
tz.transition 2031, 4, :o2, 1934834400
- tz.transition 2031, 8, :o1, 1945717200
+ tz.transition 2031, 9, :o1, 1948136400
tz.transition 2032, 4, :o2, 1966888800
- tz.transition 2032, 8, :o1, 1977166800
+ tz.transition 2032, 9, :o1, 1980190800
tz.transition 2033, 4, :o2, 1998338400
- tz.transition 2033, 8, :o1, 2008616400
+ tz.transition 2033, 9, :o1, 2011640400
tz.transition 2034, 4, :o2, 2029788000
- tz.transition 2034, 8, :o1, 2040670800
+ tz.transition 2034, 9, :o1, 2043090000
tz.transition 2035, 4, :o2, 2061237600
- tz.transition 2035, 8, :o1, 2072120400
+ tz.transition 2035, 9, :o1, 2074539600
tz.transition 2036, 4, :o2, 2092687200
- tz.transition 2036, 8, :o1, 2103570000
+ tz.transition 2036, 9, :o1, 2105989200
tz.transition 2037, 4, :o2, 2124136800
- tz.transition 2037, 8, :o1, 2135019600
+ tz.transition 2037, 9, :o1, 2137438800
tz.transition 2038, 4, :o2, 29586521, 12
- tz.transition 2038, 8, :o1, 19725299, 8
+ tz.transition 2038, 9, :o1, 19725579, 8
tz.transition 2039, 4, :o2, 29590889, 12
- tz.transition 2039, 8, :o1, 19728211, 8
+ tz.transition 2039, 9, :o1, 19728491, 8
tz.transition 2040, 4, :o2, 29595257, 12
- tz.transition 2040, 8, :o1, 19731179, 8
+ tz.transition 2040, 9, :o1, 19731403, 8
tz.transition 2041, 4, :o2, 29599625, 12
- tz.transition 2041, 8, :o1, 19734091, 8
+ tz.transition 2041, 9, :o1, 19734315, 8
tz.transition 2042, 4, :o2, 29603993, 12
- tz.transition 2042, 8, :o1, 19737003, 8
+ tz.transition 2042, 9, :o1, 19737227, 8
tz.transition 2043, 4, :o2, 29608361, 12
- tz.transition 2043, 8, :o1, 19739915, 8
+ tz.transition 2043, 9, :o1, 19740139, 8
tz.transition 2044, 4, :o2, 29612813, 12
- tz.transition 2044, 8, :o1, 19742827, 8
+ tz.transition 2044, 9, :o1, 19743107, 8
tz.transition 2045, 4, :o2, 29617181, 12
- tz.transition 2045, 8, :o1, 19745795, 8
+ tz.transition 2045, 9, :o1, 19746019, 8
tz.transition 2046, 4, :o2, 29621549, 12
- tz.transition 2046, 8, :o1, 19748707, 8
+ tz.transition 2046, 9, :o1, 19748931, 8
tz.transition 2047, 4, :o2, 29625917, 12
- tz.transition 2047, 8, :o1, 19751619, 8
+ tz.transition 2047, 9, :o1, 19751843, 8
tz.transition 2048, 4, :o2, 29630285, 12
- tz.transition 2048, 8, :o1, 19754531, 8
+ tz.transition 2048, 9, :o1, 19754755, 8
tz.transition 2049, 4, :o2, 29634737, 12
- tz.transition 2049, 8, :o1, 19757443, 8
+ tz.transition 2049, 9, :o1, 19757723, 8
tz.transition 2050, 4, :o2, 29639105, 12
- tz.transition 2050, 8, :o1, 19760355, 8
+ tz.transition 2050, 9, :o1, 19760635, 8
end
end
end
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Africa/Casablanca.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Africa/Casablanca.rb
index 18d73c93a0..18d73c93a0 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Africa/Casablanca.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Africa/Casablanca.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Africa/Harare.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Africa/Harare.rb
index 070c95ae0f..070c95ae0f 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Africa/Harare.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Africa/Harare.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Africa/Johannesburg.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Africa/Johannesburg.rb
index f0af0d8e33..f0af0d8e33 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Africa/Johannesburg.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Africa/Johannesburg.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Africa/Monrovia.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Africa/Monrovia.rb
index 40e711fa44..40e711fa44 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Africa/Monrovia.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Africa/Monrovia.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Africa/Nairobi.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Africa/Nairobi.rb
index 7b0a2f43be..7b0a2f43be 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Africa/Nairobi.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Africa/Nairobi.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/Argentina/Buenos_Aires.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/Argentina/Buenos_Aires.rb
new file mode 100644
index 0000000000..307f9546de
--- /dev/null
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/Argentina/Buenos_Aires.rb
@@ -0,0 +1,84 @@
+require 'tzinfo/timezone_definition'
+
+module TZInfo
+ module Definitions
+ module America
+ module Argentina
+ module Buenos_Aires
+ include TimezoneDefinition
+
+ timezone 'America/Argentina/Buenos_Aires' do |tz|
+ tz.offset :o0, -14028, 0, :LMT
+ tz.offset :o1, -15408, 0, :CMT
+ tz.offset :o2, -14400, 0, :ART
+ tz.offset :o3, -14400, 3600, :ARST
+ tz.offset :o4, -10800, 0, :ART
+ tz.offset :o5, -10800, 3600, :ARST
+
+ tz.transition 1894, 10, :o1, 17374555169, 7200
+ tz.transition 1920, 5, :o2, 1453467407, 600
+ tz.transition 1930, 12, :o3, 7278935, 3
+ tz.transition 1931, 4, :o2, 19411461, 8
+ tz.transition 1931, 10, :o3, 7279889, 3
+ tz.transition 1932, 3, :o2, 19414141, 8
+ tz.transition 1932, 11, :o3, 7281038, 3
+ tz.transition 1933, 3, :o2, 19417061, 8
+ tz.transition 1933, 11, :o3, 7282133, 3
+ tz.transition 1934, 3, :o2, 19419981, 8
+ tz.transition 1934, 11, :o3, 7283228, 3
+ tz.transition 1935, 3, :o2, 19422901, 8
+ tz.transition 1935, 11, :o3, 7284323, 3
+ tz.transition 1936, 3, :o2, 19425829, 8
+ tz.transition 1936, 11, :o3, 7285421, 3
+ tz.transition 1937, 3, :o2, 19428749, 8
+ tz.transition 1937, 11, :o3, 7286516, 3
+ tz.transition 1938, 3, :o2, 19431669, 8
+ tz.transition 1938, 11, :o3, 7287611, 3
+ tz.transition 1939, 3, :o2, 19434589, 8
+ tz.transition 1939, 11, :o3, 7288706, 3
+ tz.transition 1940, 3, :o2, 19437517, 8
+ tz.transition 1940, 7, :o3, 7289435, 3
+ tz.transition 1941, 6, :o2, 19441285, 8
+ tz.transition 1941, 10, :o3, 7290848, 3
+ tz.transition 1943, 8, :o2, 19447501, 8
+ tz.transition 1943, 10, :o3, 7293038, 3
+ tz.transition 1946, 3, :o2, 19455045, 8
+ tz.transition 1946, 10, :o3, 7296284, 3
+ tz.transition 1963, 10, :o2, 19506429, 8
+ tz.transition 1963, 12, :o3, 7315136, 3
+ tz.transition 1964, 3, :o2, 19507645, 8
+ tz.transition 1964, 10, :o3, 7316051, 3
+ tz.transition 1965, 3, :o2, 19510565, 8
+ tz.transition 1965, 10, :o3, 7317146, 3
+ tz.transition 1966, 3, :o2, 19513485, 8
+ tz.transition 1966, 10, :o3, 7318241, 3
+ tz.transition 1967, 4, :o2, 19516661, 8
+ tz.transition 1967, 10, :o3, 7319294, 3
+ tz.transition 1968, 4, :o2, 19519629, 8
+ tz.transition 1968, 10, :o3, 7320407, 3
+ tz.transition 1969, 4, :o2, 19522541, 8
+ tz.transition 1969, 10, :o4, 7321499, 3
+ tz.transition 1974, 1, :o5, 128142000
+ tz.transition 1974, 5, :o4, 136605600
+ tz.transition 1988, 12, :o5, 596948400
+ tz.transition 1989, 3, :o4, 605066400
+ tz.transition 1989, 10, :o5, 624423600
+ tz.transition 1990, 3, :o4, 636516000
+ tz.transition 1990, 10, :o5, 656478000
+ tz.transition 1991, 3, :o4, 667965600
+ tz.transition 1991, 10, :o5, 687927600
+ tz.transition 1992, 3, :o4, 699415200
+ tz.transition 1992, 10, :o5, 719377200
+ tz.transition 1993, 3, :o4, 731469600
+ tz.transition 1999, 10, :o3, 938919600
+ tz.transition 2000, 3, :o4, 952052400
+ tz.transition 2007, 12, :o5, 1198983600
+ tz.transition 2008, 3, :o4, 1205632800
+ tz.transition 2008, 10, :o5, 1224385200
+ tz.transition 2009, 3, :o4, 1237082400
+ end
+ end
+ end
+ end
+ end
+end
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Argentina/San_Juan.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/Argentina/San_Juan.rb
index ba8be4705f..ba8be4705f 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Argentina/San_Juan.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/Argentina/San_Juan.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Bogota.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/Bogota.rb
index ef96435c6a..ef96435c6a 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Bogota.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/Bogota.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Caracas.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/Caracas.rb
index 27392a540a..27392a540a 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Caracas.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/Caracas.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Chicago.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/Chicago.rb
index 0996857cf0..0996857cf0 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Chicago.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/Chicago.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Chihuahua.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/Chihuahua.rb
index 1710b57c79..1710b57c79 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Chihuahua.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/Chihuahua.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Denver.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/Denver.rb
index 1c1efb5ff3..1c1efb5ff3 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Denver.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/Denver.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Godthab.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/Godthab.rb
index 1e05518b0d..1e05518b0d 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Godthab.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/Godthab.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Guatemala.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/Guatemala.rb
index a2bf73401c..a2bf73401c 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Guatemala.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/Guatemala.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Halifax.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/Halifax.rb
index d25ae775b3..d25ae775b3 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Halifax.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/Halifax.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Indiana/Indianapolis.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/Indiana/Indianapolis.rb
index f1430f6c24..f1430f6c24 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Indiana/Indianapolis.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/Indiana/Indianapolis.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Juneau.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/Juneau.rb
index f646f3f54a..f646f3f54a 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Juneau.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/Juneau.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/La_Paz.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/La_Paz.rb
index 45c907899f..45c907899f 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/La_Paz.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/La_Paz.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Lima.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/Lima.rb
index af68ac29f7..af68ac29f7 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Lima.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/Lima.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Los_Angeles.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/Los_Angeles.rb
index 16007fd675..16007fd675 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Los_Angeles.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/Los_Angeles.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Mazatlan.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/Mazatlan.rb
index ba9e6efcf1..ba9e6efcf1 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Mazatlan.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/Mazatlan.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Mexico_City.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/Mexico_City.rb
index 2347fce647..2347fce647 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Mexico_City.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/Mexico_City.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Monterrey.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/Monterrey.rb
index 5816a9eab1..5816a9eab1 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Monterrey.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/Monterrey.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/New_York.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/New_York.rb
index 7d802bd2de..7d802bd2de 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/New_York.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/New_York.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Phoenix.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/Phoenix.rb
index b514e0c0f9..b514e0c0f9 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Phoenix.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/Phoenix.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Regina.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/Regina.rb
index ebdb68814a..ebdb68814a 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Regina.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/Regina.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Santiago.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/Santiago.rb
index 0287c9ebc4..0287c9ebc4 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Santiago.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/Santiago.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Sao_Paulo.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/Sao_Paulo.rb
index 0524f81c04..0524f81c04 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Sao_Paulo.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/Sao_Paulo.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/St_Johns.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/St_Johns.rb
index e4a3599d35..e4a3599d35 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/St_Johns.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/St_Johns.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Tijuana.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/Tijuana.rb
index 423059da46..423059da46 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/America/Tijuana.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/America/Tijuana.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Almaty.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Almaty.rb
index 9ee18970f1..9ee18970f1 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Almaty.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Almaty.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Baghdad.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Baghdad.rb
index 774dca1587..774dca1587 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Baghdad.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Baghdad.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Baku.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Baku.rb
index e86340ebfa..e86340ebfa 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Baku.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Baku.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Bangkok.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Bangkok.rb
index 139194e5e5..139194e5e5 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Bangkok.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Bangkok.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Chongqing.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Chongqing.rb
index 8c94b4ba86..8c94b4ba86 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Chongqing.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Chongqing.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Colombo.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Colombo.rb
index f6531fa819..f6531fa819 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Colombo.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Colombo.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Dhaka.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Dhaka.rb
index ccd0265503..46dce9a0d0 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Dhaka.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Dhaka.rb
@@ -13,6 +13,7 @@ module TZInfo
tz.offset :o3, 19800, 0, :IST
tz.offset :o4, 21600, 0, :DACT
tz.offset :o5, 21600, 0, :BDT
+ tz.offset :o6, 21600, 3600, :BDST
tz.transition 1889, 12, :o1, 2083422167, 864
tz.transition 1941, 9, :o2, 524937943, 216
@@ -20,6 +21,7 @@ module TZInfo
tz.transition 1942, 8, :o2, 116668957, 48
tz.transition 1951, 9, :o4, 116828123, 48
tz.transition 1971, 3, :o5, 38772000
+ tz.transition 2009, 6, :o6, 1245430800
end
end
end
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Hong_Kong.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Hong_Kong.rb
index f1edd75ac8..f1edd75ac8 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Hong_Kong.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Hong_Kong.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Irkutsk.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Irkutsk.rb
index 2d47d9580b..2d47d9580b 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Irkutsk.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Irkutsk.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Jakarta.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Jakarta.rb
index cc58fa173b..cc58fa173b 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Jakarta.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Jakarta.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Jerusalem.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Jerusalem.rb
index 9b737b899e..9b737b899e 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Jerusalem.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Jerusalem.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Kabul.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Kabul.rb
index 669c09790a..669c09790a 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Kabul.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Kabul.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Kamchatka.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Kamchatka.rb
index 2f1690b3a9..2f1690b3a9 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Kamchatka.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Kamchatka.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Karachi.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Karachi.rb
new file mode 100644
index 0000000000..dfe02c5cf6
--- /dev/null
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Karachi.rb
@@ -0,0 +1,114 @@
+require 'tzinfo/timezone_definition'
+
+module TZInfo
+ module Definitions
+ module Asia
+ module Karachi
+ include TimezoneDefinition
+
+ timezone 'Asia/Karachi' do |tz|
+ tz.offset :o0, 16092, 0, :LMT
+ tz.offset :o1, 19800, 0, :IST
+ tz.offset :o2, 19800, 3600, :IST
+ tz.offset :o3, 18000, 0, :KART
+ tz.offset :o4, 18000, 0, :PKT
+ tz.offset :o5, 18000, 3600, :PKST
+
+ tz.transition 1906, 12, :o1, 1934061051, 800
+ tz.transition 1942, 8, :o2, 116668957, 48
+ tz.transition 1945, 10, :o1, 116723675, 48
+ tz.transition 1951, 9, :o3, 116828125, 48
+ tz.transition 1971, 3, :o4, 38775600
+ tz.transition 2002, 4, :o5, 1018119660
+ tz.transition 2002, 10, :o4, 1033840860
+ tz.transition 2008, 5, :o5, 1212260400
+ tz.transition 2008, 10, :o4, 1225476000
+ tz.transition 2009, 4, :o5, 1239735600
+ tz.transition 2009, 10, :o4, 1257012000
+ tz.transition 2010, 4, :o5, 1271271600
+ tz.transition 2010, 10, :o4, 1288548000
+ tz.transition 2011, 4, :o5, 1302807600
+ tz.transition 2011, 10, :o4, 1320084000
+ tz.transition 2012, 4, :o5, 1334430000
+ tz.transition 2012, 10, :o4, 1351706400
+ tz.transition 2013, 4, :o5, 1365966000
+ tz.transition 2013, 10, :o4, 1383242400
+ tz.transition 2014, 4, :o5, 1397502000
+ tz.transition 2014, 10, :o4, 1414778400
+ tz.transition 2015, 4, :o5, 1429038000
+ tz.transition 2015, 10, :o4, 1446314400
+ tz.transition 2016, 4, :o5, 1460660400
+ tz.transition 2016, 10, :o4, 1477936800
+ tz.transition 2017, 4, :o5, 1492196400
+ tz.transition 2017, 10, :o4, 1509472800
+ tz.transition 2018, 4, :o5, 1523732400
+ tz.transition 2018, 10, :o4, 1541008800
+ tz.transition 2019, 4, :o5, 1555268400
+ tz.transition 2019, 10, :o4, 1572544800
+ tz.transition 2020, 4, :o5, 1586890800
+ tz.transition 2020, 10, :o4, 1604167200
+ tz.transition 2021, 4, :o5, 1618426800
+ tz.transition 2021, 10, :o4, 1635703200
+ tz.transition 2022, 4, :o5, 1649962800
+ tz.transition 2022, 10, :o4, 1667239200
+ tz.transition 2023, 4, :o5, 1681498800
+ tz.transition 2023, 10, :o4, 1698775200
+ tz.transition 2024, 4, :o5, 1713121200
+ tz.transition 2024, 10, :o4, 1730397600
+ tz.transition 2025, 4, :o5, 1744657200
+ tz.transition 2025, 10, :o4, 1761933600
+ tz.transition 2026, 4, :o5, 1776193200
+ tz.transition 2026, 10, :o4, 1793469600
+ tz.transition 2027, 4, :o5, 1807729200
+ tz.transition 2027, 10, :o4, 1825005600
+ tz.transition 2028, 4, :o5, 1839351600
+ tz.transition 2028, 10, :o4, 1856628000
+ tz.transition 2029, 4, :o5, 1870887600
+ tz.transition 2029, 10, :o4, 1888164000
+ tz.transition 2030, 4, :o5, 1902423600
+ tz.transition 2030, 10, :o4, 1919700000
+ tz.transition 2031, 4, :o5, 1933959600
+ tz.transition 2031, 10, :o4, 1951236000
+ tz.transition 2032, 4, :o5, 1965582000
+ tz.transition 2032, 10, :o4, 1982858400
+ tz.transition 2033, 4, :o5, 1997118000
+ tz.transition 2033, 10, :o4, 2014394400
+ tz.transition 2034, 4, :o5, 2028654000
+ tz.transition 2034, 10, :o4, 2045930400
+ tz.transition 2035, 4, :o5, 2060190000
+ tz.transition 2035, 10, :o4, 2077466400
+ tz.transition 2036, 4, :o5, 2091812400
+ tz.transition 2036, 10, :o4, 2109088800
+ tz.transition 2037, 4, :o5, 2123348400
+ tz.transition 2037, 10, :o4, 2140624800
+ tz.transition 2038, 4, :o5, 59172679, 24
+ tz.transition 2038, 10, :o4, 9862913, 4
+ tz.transition 2039, 4, :o5, 59181439, 24
+ tz.transition 2039, 10, :o4, 9864373, 4
+ tz.transition 2040, 4, :o5, 59190223, 24
+ tz.transition 2040, 10, :o4, 9865837, 4
+ tz.transition 2041, 4, :o5, 59198983, 24
+ tz.transition 2041, 10, :o4, 9867297, 4
+ tz.transition 2042, 4, :o5, 59207743, 24
+ tz.transition 2042, 10, :o4, 9868757, 4
+ tz.transition 2043, 4, :o5, 59216503, 24
+ tz.transition 2043, 10, :o4, 9870217, 4
+ tz.transition 2044, 4, :o5, 59225287, 24
+ tz.transition 2044, 10, :o4, 9871681, 4
+ tz.transition 2045, 4, :o5, 59234047, 24
+ tz.transition 2045, 10, :o4, 9873141, 4
+ tz.transition 2046, 4, :o5, 59242807, 24
+ tz.transition 2046, 10, :o4, 9874601, 4
+ tz.transition 2047, 4, :o5, 59251567, 24
+ tz.transition 2047, 10, :o4, 9876061, 4
+ tz.transition 2048, 4, :o5, 59260351, 24
+ tz.transition 2048, 10, :o4, 9877525, 4
+ tz.transition 2049, 4, :o5, 59269111, 24
+ tz.transition 2049, 10, :o4, 9878985, 4
+ tz.transition 2050, 4, :o5, 59277871, 24
+ tz.transition 2050, 10, :o4, 9880445, 4
+ end
+ end
+ end
+ end
+end
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Kathmandu.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Kathmandu.rb
index 37b241612e..37b241612e 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Kathmandu.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Kathmandu.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Kolkata.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Kolkata.rb
index 1b6ffbd59d..1b6ffbd59d 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Kolkata.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Kolkata.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Krasnoyarsk.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Krasnoyarsk.rb
index d6c503c155..d6c503c155 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Krasnoyarsk.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Krasnoyarsk.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Kuala_Lumpur.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Kuala_Lumpur.rb
index 77a0c206fa..77a0c206fa 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Kuala_Lumpur.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Kuala_Lumpur.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Kuwait.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Kuwait.rb
index 5bd5283197..5bd5283197 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Kuwait.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Kuwait.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Magadan.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Magadan.rb
index 302093693e..302093693e 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Magadan.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Magadan.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Muscat.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Muscat.rb
index 604f651dfa..604f651dfa 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Muscat.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Muscat.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Novosibirsk.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Novosibirsk.rb
index a4e7796e75..a4e7796e75 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Novosibirsk.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Novosibirsk.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Rangoon.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Rangoon.rb
index 759b82d77a..759b82d77a 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Rangoon.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Rangoon.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Riyadh.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Riyadh.rb
index 7add410620..7add410620 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Riyadh.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Riyadh.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Seoul.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Seoul.rb
index 795d2a75df..795d2a75df 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Seoul.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Seoul.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Shanghai.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Shanghai.rb
index 34b13d59ae..34b13d59ae 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Shanghai.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Shanghai.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Singapore.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Singapore.rb
index b323a78f74..b323a78f74 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Singapore.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Singapore.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Taipei.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Taipei.rb
index 3ba12108fb..3ba12108fb 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Taipei.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Taipei.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Tashkent.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Tashkent.rb
index c205c7934d..c205c7934d 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Tashkent.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Tashkent.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Tbilisi.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Tbilisi.rb
index 15792a5651..15792a5651 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Tbilisi.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Tbilisi.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Tehran.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Tehran.rb
index d8df964a46..d8df964a46 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Tehran.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Tehran.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Tokyo.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Tokyo.rb
index 51c9e16421..51c9e16421 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Tokyo.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Tokyo.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Ulaanbaatar.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Ulaanbaatar.rb
index 2854f5c5fd..2854f5c5fd 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Ulaanbaatar.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Ulaanbaatar.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Urumqi.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Urumqi.rb
index d793ff1341..d793ff1341 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Urumqi.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Urumqi.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Vladivostok.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Vladivostok.rb
index bd9e3d60ec..bd9e3d60ec 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Vladivostok.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Vladivostok.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Yakutsk.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Yakutsk.rb
index 56435a788f..56435a788f 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Yakutsk.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Yakutsk.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Yekaterinburg.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Yekaterinburg.rb
index 8ef8df4a41..8ef8df4a41 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Yekaterinburg.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Yekaterinburg.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Yerevan.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Yerevan.rb
index e7f160861f..e7f160861f 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Asia/Yerevan.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Asia/Yerevan.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Atlantic/Azores.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Atlantic/Azores.rb
index 1bd16a75ac..1bd16a75ac 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Atlantic/Azores.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Atlantic/Azores.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Atlantic/Cape_Verde.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Atlantic/Cape_Verde.rb
index 61c8c15043..61c8c15043 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Atlantic/Cape_Verde.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Atlantic/Cape_Verde.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Atlantic/South_Georgia.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Atlantic/South_Georgia.rb
index 6a4cbafb9f..6a4cbafb9f 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Atlantic/South_Georgia.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Atlantic/South_Georgia.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Australia/Adelaide.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Australia/Adelaide.rb
index c5d561cc1e..c5d561cc1e 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Australia/Adelaide.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Australia/Adelaide.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Australia/Brisbane.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Australia/Brisbane.rb
index dd85ddae94..dd85ddae94 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Australia/Brisbane.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Australia/Brisbane.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Australia/Darwin.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Australia/Darwin.rb
index 17de88124d..17de88124d 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Australia/Darwin.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Australia/Darwin.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Australia/Hobart.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Australia/Hobart.rb
index 11384b9840..11384b9840 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Australia/Hobart.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Australia/Hobart.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Australia/Melbourne.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Australia/Melbourne.rb
index c1304488ea..c1304488ea 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Australia/Melbourne.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Australia/Melbourne.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Australia/Perth.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Australia/Perth.rb
index d9e66f14a8..d9e66f14a8 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Australia/Perth.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Australia/Perth.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Australia/Sydney.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Australia/Sydney.rb
index 9062bd7c3c..9062bd7c3c 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Australia/Sydney.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Australia/Sydney.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Etc/UTC.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Etc/UTC.rb
index 28b2c6a04c..28b2c6a04c 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Etc/UTC.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Etc/UTC.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Amsterdam.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Amsterdam.rb
index 2d0c95c4bc..2d0c95c4bc 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Amsterdam.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Amsterdam.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Athens.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Athens.rb
index 4e21e535ca..4e21e535ca 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Athens.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Athens.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Belgrade.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Belgrade.rb
index 4dbd893d75..4dbd893d75 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Belgrade.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Belgrade.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Berlin.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Berlin.rb
index 721054236c..721054236c 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Berlin.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Berlin.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Bratislava.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Bratislava.rb
index 7a731a0b6a..7a731a0b6a 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Bratislava.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Bratislava.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Brussels.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Brussels.rb
index 6b0a242944..6b0a242944 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Brussels.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Brussels.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Bucharest.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Bucharest.rb
index 521c3c932e..521c3c932e 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Bucharest.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Bucharest.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Budapest.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Budapest.rb
index 1f3a9738b7..1f3a9738b7 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Budapest.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Budapest.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Copenhagen.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Copenhagen.rb
index 47cbaf14a7..47cbaf14a7 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Copenhagen.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Copenhagen.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Dublin.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Dublin.rb
index 0560bb5436..0560bb5436 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Dublin.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Dublin.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Helsinki.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Helsinki.rb
index 13a806bcc7..13a806bcc7 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Helsinki.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Helsinki.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Istanbul.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Istanbul.rb
index 8306c47536..8306c47536 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Istanbul.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Istanbul.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Kiev.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Kiev.rb
index 513d3308be..513d3308be 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Kiev.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Kiev.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Lisbon.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Lisbon.rb
index 1c6d2a3d30..1c6d2a3d30 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Lisbon.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Lisbon.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Ljubljana.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Ljubljana.rb
index a9828e6ef8..a9828e6ef8 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Ljubljana.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Ljubljana.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/London.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/London.rb
index 64ce41e900..64ce41e900 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/London.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/London.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Madrid.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Madrid.rb
index 1fb568239a..1fb568239a 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Madrid.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Madrid.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Minsk.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Minsk.rb
index fa15816cc8..fa15816cc8 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Minsk.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Minsk.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Moscow.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Moscow.rb
index ef269b675b..ef269b675b 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Moscow.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Moscow.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Paris.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Paris.rb
index e3236c0ba1..e3236c0ba1 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Paris.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Paris.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Prague.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Prague.rb
index bcabee96c1..bcabee96c1 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Prague.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Prague.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Riga.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Riga.rb
index 784837f758..784837f758 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Riga.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Riga.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Rome.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Rome.rb
index aa7b43d9d2..aa7b43d9d2 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Rome.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Rome.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Sarajevo.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Sarajevo.rb
index 068c5fe6ad..068c5fe6ad 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Sarajevo.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Sarajevo.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Skopje.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Skopje.rb
index 10b71f285e..10b71f285e 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Skopje.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Skopje.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Sofia.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Sofia.rb
index 38a70eceb9..38a70eceb9 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Sofia.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Sofia.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Stockholm.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Stockholm.rb
index 43db70fa61..43db70fa61 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Stockholm.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Stockholm.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Tallinn.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Tallinn.rb
index de5a8569f3..de5a8569f3 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Tallinn.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Tallinn.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Vienna.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Vienna.rb
index 990aabab66..990aabab66 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Vienna.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Vienna.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Vilnius.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Vilnius.rb
index d89d095a75..d89d095a75 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Vilnius.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Vilnius.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Warsaw.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Warsaw.rb
index 7fa51c2691..7fa51c2691 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Warsaw.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Warsaw.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Zagreb.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Zagreb.rb
index ecdd903d28..ecdd903d28 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Europe/Zagreb.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Europe/Zagreb.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Pacific/Auckland.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Pacific/Auckland.rb
index a524fd6b6b..a524fd6b6b 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Pacific/Auckland.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Pacific/Auckland.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Pacific/Fiji.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Pacific/Fiji.rb
index 5fe9bbd9a6..5fe9bbd9a6 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Pacific/Fiji.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Pacific/Fiji.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Pacific/Guam.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Pacific/Guam.rb
index d4c1a0a682..d4c1a0a682 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Pacific/Guam.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Pacific/Guam.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Pacific/Honolulu.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Pacific/Honolulu.rb
index 204b226537..204b226537 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Pacific/Honolulu.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Pacific/Honolulu.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Pacific/Majuro.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Pacific/Majuro.rb
index 32adad92c1..32adad92c1 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Pacific/Majuro.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Pacific/Majuro.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Pacific/Midway.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Pacific/Midway.rb
index 97784fcc10..97784fcc10 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Pacific/Midway.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Pacific/Midway.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Pacific/Noumea.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Pacific/Noumea.rb
index 70173db8ab..70173db8ab 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Pacific/Noumea.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Pacific/Noumea.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Pacific/Pago_Pago.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Pacific/Pago_Pago.rb
index c8fcd7d527..c8fcd7d527 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Pacific/Pago_Pago.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Pacific/Pago_Pago.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Pacific/Port_Moresby.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Pacific/Port_Moresby.rb
index f06cf6d54f..f06cf6d54f 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Pacific/Port_Moresby.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Pacific/Port_Moresby.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Pacific/Tongatapu.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Pacific/Tongatapu.rb
index 7578d92f38..7578d92f38 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/definitions/Pacific/Tongatapu.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/definitions/Pacific/Tongatapu.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/info_timezone.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/info_timezone.rb
index 001303c594..001303c594 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/info_timezone.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/info_timezone.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/linked_timezone.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/linked_timezone.rb
index f8ec4fca87..f8ec4fca87 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/linked_timezone.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/linked_timezone.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/linked_timezone_info.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/linked_timezone_info.rb
index 8197ff3e81..8197ff3e81 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/linked_timezone_info.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/linked_timezone_info.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/offset_rationals.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/offset_rationals.rb
index b1f10b2b63..b1f10b2b63 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/offset_rationals.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/offset_rationals.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/ruby_core_support.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/ruby_core_support.rb
index b65eeaaae7..9a0441206b 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/ruby_core_support.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/ruby_core_support.rb
@@ -1,56 +1,56 @@
-#--
-# Copyright (c) 2008 Philip Ross
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in all
-# copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-#++
-
-require 'date'
-require 'rational'
-
-module TZInfo
-
- # Methods to support different versions of Ruby.
- module RubyCoreSupport #:nodoc:
-
- # Use Rational.new! for performance reasons in Ruby 1.8.
- # This has been removed from 1.9, but Rational performs better.
- if Rational.respond_to? :new!
- def self.rational_new!(numerator, denominator = 1)
- Rational.new!(numerator, denominator)
- end
- else
- def self.rational_new!(numerator, denominator = 1)
- Rational(numerator, denominator)
- end
- end
-
- # Ruby 1.8.6 introduced new! and deprecated new0.
- # Ruby 1.9.0 removed new0.
- # We still need to support new0 for older versions of Ruby.
- if DateTime.respond_to? :new!
- def self.datetime_new!(ajd = 0, of = 0, sg = Date::ITALY)
- DateTime.new!(ajd, of, sg)
- end
- else
- def self.datetime_new!(ajd = 0, of = 0, sg = Date::ITALY)
- DateTime.new0(ajd, of, sg)
- end
- end
- end
+#--
+# Copyright (c) 2008 Philip Ross
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in all
+# copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#++
+
+require 'date'
+require 'rational'
+
+module TZInfo
+
+ # Methods to support different versions of Ruby.
+ module RubyCoreSupport #:nodoc:
+
+ # Use Rational.new! for performance reasons in Ruby 1.8.
+ # This has been removed from 1.9, but Rational performs better.
+ if Rational.respond_to? :new!
+ def self.rational_new!(numerator, denominator = 1)
+ Rational.new!(numerator, denominator)
+ end
+ else
+ def self.rational_new!(numerator, denominator = 1)
+ Rational(numerator, denominator)
+ end
+ end
+
+ # Ruby 1.8.6 introduced new! and deprecated new0.
+ # Ruby 1.9.0 removed new0.
+ # We still need to support new0 for older versions of Ruby.
+ if DateTime.respond_to? :new!
+ def self.datetime_new!(ajd = 0, of = 0, sg = Date::ITALY)
+ DateTime.new!(ajd, of, sg)
+ end
+ else
+ def self.datetime_new!(ajd = 0, of = 0, sg = Date::ITALY)
+ DateTime.new0(ajd, of, sg)
+ end
+ end
+ end
end \ No newline at end of file
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/time_or_datetime.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/time_or_datetime.rb
index 264517f3ee..264517f3ee 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/time_or_datetime.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/time_or_datetime.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/timezone.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/timezone.rb
index ef4ecd8ae1..ef4ecd8ae1 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/timezone.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/timezone.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/timezone_definition.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/timezone_definition.rb
index 39ca8bfa53..39ca8bfa53 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/timezone_definition.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/timezone_definition.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/timezone_info.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/timezone_info.rb
index 68e38c35fb..68e38c35fb 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/timezone_info.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/timezone_info.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/timezone_offset_info.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/timezone_offset_info.rb
index 6a0bbca46f..6a0bbca46f 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/timezone_offset_info.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/timezone_offset_info.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/timezone_period.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/timezone_period.rb
index 00888fcfdc..00888fcfdc 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/timezone_period.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/timezone_period.rb
diff --git a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/timezone_transition_info.rb b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/timezone_transition_info.rb
index 6b0669cc4a..6b0669cc4a 100644
--- a/activesupport/lib/active_support/vendor/tzinfo-0.3.13/lib/tzinfo/timezone_transition_info.rb
+++ b/activesupport/lib/active_support/vendor/tzinfo-0.3.15/lib/tzinfo/timezone_transition_info.rb
diff --git a/activesupport/lib/active_support/whiny_nil.rb b/activesupport/lib/active_support/whiny_nil.rb
index 36fe9510ba..c4aaba7ab3 100644
--- a/activesupport/lib/active_support/whiny_nil.rb
+++ b/activesupport/lib/active_support/whiny_nil.rb
@@ -43,7 +43,14 @@ class NilClass
private
def method_missing(method, *args, &block)
- raise_nil_warning_for METHOD_CLASS_MAP[method], method, caller
+ # Ruby 1.9.2: disallow explicit coercion via method_missing.
+ if method == :to_ary || method == :to_str
+ super
+ elsif klass = METHOD_CLASS_MAP[method]
+ raise_nil_warning_for klass, method, caller
+ else
+ super
+ end
end
# Raises a NoMethodError when you attempt to call a method on +nil+.
@@ -55,4 +62,3 @@ class NilClass
raise NoMethodError, message, with_caller || caller
end
end
-
diff --git a/activesupport/lib/active_support/xml_mini/libxml.rb b/activesupport/lib/active_support/xml_mini/libxml.rb
index 2ae22c35fb..0f7ba1918b 100644
--- a/activesupport/lib/active_support/xml_mini/libxml.rb
+++ b/activesupport/lib/active_support/xml_mini/libxml.rb
@@ -13,8 +13,6 @@ module ActiveSupport
data = StringIO.new(data || '')
end
- LibXML::XML.default_keep_blanks = false
-
char = data.getc
if char.nil?
{}
@@ -44,9 +42,9 @@ module LibXML #:nodoc:
# hash::
# Hash to merge the converted element into.
def to_hash(hash={})
- if text?
- raise LibXML::XML::Error if content.length >= LIB_XML_LIMIT
- hash[CONTENT_ROOT] = content
+ if text? || cdata?
+ raise LibXML::XML::Error if hash[CONTENT_ROOT].to_s.length + content.length >= LIB_XML_LIMIT
+ hash[CONTENT_ROOT] = hash[CONTENT_ROOT].to_s + content
else
sub_hash = insert_name_into_hash(hash, name)
attributes_to_hash(sub_hash)
@@ -88,6 +86,11 @@ module LibXML #:nodoc:
# Hash to merge the children into.
def children_to_hash(hash={})
each { |child| child.to_hash(hash) }
+
+ if hash.length > 1 && hash[CONTENT_ROOT].blank?
+ hash.delete(CONTENT_ROOT)
+ end
+
attributes_to_hash(hash)
hash
end