activesupport 2.1.2 → 2.2.2
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of activesupport might be problematic. Click here for more details.
- data/CHANGELOG +64 -5
- data/lib/active_support.rb +6 -6
- data/lib/active_support/base64.rb +13 -2
- data/lib/active_support/basic_object.rb +1 -1
- data/lib/active_support/buffered_logger.rb +15 -14
- data/lib/active_support/cache.rb +116 -40
- data/lib/active_support/cache/compressed_mem_cache_store.rb +7 -2
- data/lib/active_support/cache/file_store.rb +7 -5
- data/lib/active_support/cache/mem_cache_store.rb +48 -21
- data/lib/active_support/cache/memory_store.rb +16 -2
- data/lib/active_support/cache/synchronized_memory_store.rb +47 -0
- data/lib/active_support/callbacks.rb +14 -9
- data/lib/active_support/core_ext/array/access.rb +27 -0
- data/lib/active_support/core_ext/array/conversions.rb +12 -7
- data/lib/active_support/core_ext/array/grouping.rb +53 -10
- data/lib/active_support/core_ext/base64/encoding.rb +3 -0
- data/lib/active_support/core_ext/bigdecimal/conversions.rb +18 -22
- data/lib/active_support/core_ext/blank.rb +5 -0
- data/lib/active_support/core_ext/class/inheritable_attributes.rb +5 -5
- data/lib/active_support/core_ext/date/behavior.rb +3 -0
- data/lib/active_support/core_ext/date/calculations.rb +24 -9
- data/lib/active_support/core_ext/date_time/calculations.rb +19 -5
- data/lib/active_support/core_ext/duplicable.rb +6 -0
- data/lib/active_support/core_ext/enumerable.rb +42 -4
- data/lib/active_support/core_ext/file.rb +4 -20
- data/lib/active_support/core_ext/file/atomic.rb +46 -0
- data/lib/active_support/core_ext/float.rb +2 -0
- data/lib/active_support/core_ext/float/time.rb +27 -0
- data/lib/active_support/core_ext/hash.rb +2 -1
- data/lib/active_support/core_ext/hash/conversions.rb +1 -1
- data/lib/active_support/core_ext/hash/deep_merge.rb +23 -0
- data/lib/active_support/core_ext/hash/except.rb +1 -1
- data/lib/active_support/core_ext/hash/reverse_merge.rb +12 -5
- data/lib/active_support/core_ext/hash/slice.rb +7 -4
- data/lib/active_support/core_ext/integer.rb +2 -0
- data/lib/active_support/core_ext/integer/time.rb +45 -0
- data/lib/active_support/core_ext/kernel/debugger.rb +4 -4
- data/lib/active_support/core_ext/logger.rb +128 -1
- data/lib/active_support/core_ext/module.rb +11 -1
- data/lib/active_support/core_ext/module/aliasing.rb +71 -67
- data/lib/active_support/core_ext/module/delegation.rb +32 -1
- data/lib/active_support/core_ext/module/introspection.rb +81 -66
- data/lib/active_support/core_ext/module/model_naming.rb +8 -7
- data/lib/active_support/core_ext/module/synchronization.rb +39 -0
- data/lib/active_support/core_ext/numeric/time.rb +0 -10
- data/lib/active_support/core_ext/object.rb +1 -0
- data/lib/active_support/core_ext/object/extending.rb +29 -7
- data/lib/active_support/core_ext/object/instance_variables.rb +1 -1
- data/lib/active_support/core_ext/object/metaclass.rb +13 -0
- data/lib/active_support/core_ext/object/misc.rb +36 -21
- data/lib/active_support/core_ext/rexml.rb +2 -2
- data/lib/active_support/core_ext/string.rb +6 -2
- data/lib/active_support/core_ext/string/access.rb +5 -5
- data/lib/active_support/core_ext/string/behavior.rb +13 -0
- data/lib/active_support/core_ext/string/inflections.rb +21 -2
- data/lib/active_support/core_ext/string/multibyte.rb +81 -0
- data/lib/active_support/core_ext/time/calculations.rb +39 -12
- data/lib/active_support/core_ext/time/conversions.rb +1 -0
- data/lib/active_support/core_ext/time/zones.rb +1 -1
- data/lib/active_support/dependencies.rb +178 -110
- data/lib/active_support/deprecation.rb +24 -4
- data/lib/active_support/inflector.rb +122 -38
- data/lib/active_support/json.rb +1 -1
- data/lib/active_support/json/encoders/date.rb +9 -2
- data/lib/active_support/json/encoders/date_time.rb +9 -2
- data/lib/active_support/json/encoders/time.rb +10 -3
- data/lib/active_support/locale/en.yml +32 -0
- data/lib/active_support/memoizable.rb +82 -0
- data/lib/active_support/multibyte.rb +31 -7
- data/lib/active_support/multibyte/chars.rb +664 -122
- data/lib/active_support/multibyte/exceptions.rb +8 -0
- data/lib/active_support/multibyte/unicode_database.rb +71 -0
- data/lib/active_support/option_merger.rb +2 -10
- data/lib/active_support/ordered_hash.rb +15 -0
- data/lib/active_support/rescuable.rb +108 -0
- data/lib/active_support/secure_random.rb +197 -0
- data/lib/active_support/string_inquirer.rb +11 -1
- data/lib/active_support/test_case.rb +16 -5
- data/lib/active_support/testing/core_ext/test.rb +6 -0
- data/lib/active_support/{core_ext → testing/core_ext}/test/unit/assertions.rb +14 -6
- data/lib/active_support/testing/performance.rb +452 -0
- data/lib/active_support/testing/setup_and_teardown.rb +34 -7
- data/lib/active_support/time_with_zone.rb +66 -42
- data/lib/active_support/values/time_zone.rb +11 -4
- data/lib/active_support/values/unicode_tables.dat +0 -0
- data/lib/active_support/vendor.rb +13 -5
- data/lib/active_support/vendor/builder-2.1.2/builder/xmlevents.rb +1 -1
- data/lib/active_support/vendor/i18n-0.0.1/i18n.rb +194 -0
- data/lib/active_support/vendor/i18n-0.0.1/i18n/backend/simple.rb +216 -0
- data/lib/active_support/vendor/i18n-0.0.1/i18n/exceptions.rb +53 -0
- data/lib/active_support/vendor/{memcache-client-1.5.0 → memcache-client-1.5.1}/memcache.rb +5 -5
- data/lib/active_support/vendor/{tzinfo-0.3.11 → tzinfo-0.3.12}/tzinfo.rb +0 -0
- data/lib/active_support/vendor/{tzinfo-0.3.11 → tzinfo-0.3.12}/tzinfo/data_timezone.rb +0 -0
- data/lib/active_support/vendor/{tzinfo-0.3.11 → tzinfo-0.3.12}/tzinfo/data_timezone_info.rb +0 -0
- data/lib/active_support/vendor/{tzinfo-0.3.11 → tzinfo-0.3.12}/tzinfo/definitions/Africa/Algiers.rb +0 -0
- data/lib/active_support/vendor/{tzinfo-0.3.11 → tzinfo-0.3.12}/tzinfo/definitions/Africa/Cairo.rb +0 -0
- data/lib/active_support/vendor/{tzinfo-0.3.11 → tzinfo-0.3.12}/tzinfo/definitions/Africa/Casablanca.rb +0 -0
- data/lib/active_support/vendor/{tzinfo-0.3.11 → tzinfo-0.3.12}/tzinfo/definitions/Africa/Harare.rb +0 -0
- data/lib/active_support/vendor/{tzinfo-0.3.11 → tzinfo-0.3.12}/tzinfo/definitions/Africa/Johannesburg.rb +0 -0
- data/lib/active_support/vendor/{tzinfo-0.3.11 → tzinfo-0.3.12}/tzinfo/definitions/Africa/Monrovia.rb +0 -0
- data/lib/active_support/vendor/{tzinfo-0.3.11 → tzinfo-0.3.12}/tzinfo/definitions/Africa/Nairobi.rb +0 -0
- data/lib/active_support/vendor/{tzinfo-0.3.11 → tzinfo-0.3.12}/tzinfo/definitions/America/Argentina/Buenos_Aires.rb +0 -0
- data/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Argentina/San_Juan.rb +86 -0
- data/lib/active_support/vendor/{tzinfo-0.3.11 → tzinfo-0.3.12}/tzinfo/definitions/America/Bogota.rb +0 -0
- data/lib/active_support/vendor/{tzinfo-0.3.11 → tzinfo-0.3.12}/tzinfo/definitions/America/Caracas.rb +0 -0
- data/lib/active_support/vendor/{tzinfo-0.3.11 → tzinfo-0.3.12}/tzinfo/definitions/America/Chicago.rb +0 -0
- data/lib/active_support/vendor/{tzinfo-0.3.11 → tzinfo-0.3.12}/tzinfo/definitions/America/Chihuahua.rb +0 -0
- data/lib/active_support/vendor/{tzinfo-0.3.11 → tzinfo-0.3.12}/tzinfo/definitions/America/Denver.rb +0 -0
- data/lib/active_support/vendor/{tzinfo-0.3.11 → tzinfo-0.3.12}/tzinfo/definitions/America/Godthab.rb +0 -0
- data/lib/active_support/vendor/{tzinfo-0.3.11 → tzinfo-0.3.12}/tzinfo/definitions/America/Guatemala.rb +0 -0
- data/lib/active_support/vendor/{tzinfo-0.3.11 → tzinfo-0.3.12}/tzinfo/definitions/America/Halifax.rb +0 -0
- data/lib/active_support/vendor/{tzinfo-0.3.11 → tzinfo-0.3.12}/tzinfo/definitions/America/Indiana/Indianapolis.rb +0 -0
- data/lib/active_support/vendor/{tzinfo-0.3.11 → tzinfo-0.3.12}/tzinfo/definitions/America/Juneau.rb +0 -0
- data/lib/active_support/vendor/{tzinfo-0.3.11 → tzinfo-0.3.12}/tzinfo/definitions/America/La_Paz.rb +0 -0
- data/lib/active_support/vendor/{tzinfo-0.3.11 → tzinfo-0.3.12}/tzinfo/definitions/America/Lima.rb +0 -0
- data/lib/active_support/vendor/{tzinfo-0.3.11 → tzinfo-0.3.12}/tzinfo/definitions/America/Los_Angeles.rb +0 -0
- data/lib/active_support/vendor/{tzinfo-0.3.11 → tzinfo-0.3.12}/tzinfo/definitions/America/Mazatlan.rb +0 -0
- data/lib/active_support/vendor/{tzinfo-0.3.11 → tzinfo-0.3.12}/tzinfo/definitions/America/Mexico_City.rb +0 -0
- data/lib/active_support/vendor/{tzinfo-0.3.11 → tzinfo-0.3.12}/tzinfo/definitions/America/Monterrey.rb +0 -0
- data/lib/active_support/vendor/{tzinfo-0.3.11 → tzinfo-0.3.12}/tzinfo/definitions/America/New_York.rb +0 -0
- data/lib/active_support/vendor/{tzinfo-0.3.11 → tzinfo-0.3.12}/tzinfo/definitions/America/Phoenix.rb +0 -0
- data/lib/active_support/vendor/{tzinfo-0.3.11 → tzinfo-0.3.12}/tzinfo/definitions/America/Regina.rb +0 -0
- data/lib/active_support/vendor/{tzinfo-0.3.11 → tzinfo-0.3.12}/tzinfo/definitions/America/Santiago.rb +0 -0
- data/lib/active_support/vendor/{tzinfo-0.3.11 → tzinfo-0.3.12}/tzinfo/definitions/America/Sao_Paulo.rb +0 -0
- data/lib/active_support/vendor/{tzinfo-0.3.11 → tzinfo-0.3.12}/tzinfo/definitions/America/St_Johns.rb +0 -0
- data/lib/active_support/vendor/{tzinfo-0.3.11 → tzinfo-0.3.12}/tzinfo/definitions/America/Tijuana.rb +0 -0
- data/lib/active_support/vendor/{tzinfo-0.3.11 → tzinfo-0.3.12}/tzinfo/definitions/Asia/Almaty.rb +0 -0
- data/lib/active_support/vendor/{tzinfo-0.3.11 → tzinfo-0.3.12}/tzinfo/definitions/Asia/Baghdad.rb +0 -0
- data/lib/active_support/vendor/{tzinfo-0.3.11 → tzinfo-0.3.12}/tzinfo/definitions/Asia/Baku.rb +0 -0
- data/lib/active_support/vendor/{tzinfo-0.3.11 → tzinfo-0.3.12}/tzinfo/definitions/Asia/Bangkok.rb +0 -0
- data/lib/active_support/vendor/{tzinfo-0.3.11 → tzinfo-0.3.12}/tzinfo/definitions/Asia/Chongqing.rb +0 -0
- data/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Colombo.rb +30 -0
- data/lib/active_support/vendor/{tzinfo-0.3.11 → tzinfo-0.3.12}/tzinfo/definitions/Asia/Dhaka.rb +0 -0
- data/lib/active_support/vendor/{tzinfo-0.3.11 → tzinfo-0.3.12}/tzinfo/definitions/Asia/Hong_Kong.rb +0 -0
- data/lib/active_support/vendor/{tzinfo-0.3.11 → tzinfo-0.3.12}/tzinfo/definitions/Asia/Irkutsk.rb +0 -0
- data/lib/active_support/vendor/{tzinfo-0.3.11 → tzinfo-0.3.12}/tzinfo/definitions/Asia/Jakarta.rb +0 -0
- data/lib/active_support/vendor/{tzinfo-0.3.11 → tzinfo-0.3.12}/tzinfo/definitions/Asia/Jerusalem.rb +0 -0
- data/lib/active_support/vendor/{tzinfo-0.3.11 → tzinfo-0.3.12}/tzinfo/definitions/Asia/Kabul.rb +0 -0
- data/lib/active_support/vendor/{tzinfo-0.3.11 → tzinfo-0.3.12}/tzinfo/definitions/Asia/Kamchatka.rb +0 -0
- data/lib/active_support/vendor/{tzinfo-0.3.11 → tzinfo-0.3.12}/tzinfo/definitions/Asia/Karachi.rb +0 -0
- data/lib/active_support/vendor/{tzinfo-0.3.11 → tzinfo-0.3.12}/tzinfo/definitions/Asia/Katmandu.rb +0 -0
- data/lib/active_support/vendor/{tzinfo-0.3.11 → tzinfo-0.3.12}/tzinfo/definitions/Asia/Kolkata.rb +0 -0
- data/lib/active_support/vendor/{tzinfo-0.3.11 → tzinfo-0.3.12}/tzinfo/definitions/Asia/Krasnoyarsk.rb +0 -0
- data/lib/active_support/vendor/{tzinfo-0.3.11 → tzinfo-0.3.12}/tzinfo/definitions/Asia/Kuala_Lumpur.rb +0 -0
- data/lib/active_support/vendor/{tzinfo-0.3.11 → tzinfo-0.3.12}/tzinfo/definitions/Asia/Kuwait.rb +0 -0
- data/lib/active_support/vendor/{tzinfo-0.3.11 → tzinfo-0.3.12}/tzinfo/definitions/Asia/Magadan.rb +0 -0
- data/lib/active_support/vendor/{tzinfo-0.3.11 → tzinfo-0.3.12}/tzinfo/definitions/Asia/Muscat.rb +0 -0
- data/lib/active_support/vendor/{tzinfo-0.3.11 → tzinfo-0.3.12}/tzinfo/definitions/Asia/Novosibirsk.rb +0 -0
- data/lib/active_support/vendor/{tzinfo-0.3.11 → tzinfo-0.3.12}/tzinfo/definitions/Asia/Rangoon.rb +0 -0
- data/lib/active_support/vendor/{tzinfo-0.3.11 → tzinfo-0.3.12}/tzinfo/definitions/Asia/Riyadh.rb +0 -0
- data/lib/active_support/vendor/{tzinfo-0.3.11 → tzinfo-0.3.12}/tzinfo/definitions/Asia/Seoul.rb +0 -0
- data/lib/active_support/vendor/{tzinfo-0.3.11 → tzinfo-0.3.12}/tzinfo/definitions/Asia/Shanghai.rb +0 -0
- data/lib/active_support/vendor/{tzinfo-0.3.11 → tzinfo-0.3.12}/tzinfo/definitions/Asia/Singapore.rb +0 -0
- data/lib/active_support/vendor/{tzinfo-0.3.11 → tzinfo-0.3.12}/tzinfo/definitions/Asia/Taipei.rb +0 -0
- data/lib/active_support/vendor/{tzinfo-0.3.11 → tzinfo-0.3.12}/tzinfo/definitions/Asia/Tashkent.rb +0 -0
- data/lib/active_support/vendor/{tzinfo-0.3.11 → tzinfo-0.3.12}/tzinfo/definitions/Asia/Tbilisi.rb +0 -0
- data/lib/active_support/vendor/{tzinfo-0.3.11 → tzinfo-0.3.12}/tzinfo/definitions/Asia/Tehran.rb +0 -0
- data/lib/active_support/vendor/{tzinfo-0.3.11 → tzinfo-0.3.12}/tzinfo/definitions/Asia/Tokyo.rb +0 -0
- data/lib/active_support/vendor/{tzinfo-0.3.11 → tzinfo-0.3.12}/tzinfo/definitions/Asia/Ulaanbaatar.rb +0 -0
- data/lib/active_support/vendor/{tzinfo-0.3.11 → tzinfo-0.3.12}/tzinfo/definitions/Asia/Urumqi.rb +0 -0
- data/lib/active_support/vendor/{tzinfo-0.3.11 → tzinfo-0.3.12}/tzinfo/definitions/Asia/Vladivostok.rb +0 -0
- data/lib/active_support/vendor/{tzinfo-0.3.11 → tzinfo-0.3.12}/tzinfo/definitions/Asia/Yakutsk.rb +0 -0
- data/lib/active_support/vendor/{tzinfo-0.3.11 → tzinfo-0.3.12}/tzinfo/definitions/Asia/Yekaterinburg.rb +0 -0
- data/lib/active_support/vendor/{tzinfo-0.3.11 → tzinfo-0.3.12}/tzinfo/definitions/Asia/Yerevan.rb +0 -0
- data/lib/active_support/vendor/{tzinfo-0.3.11 → tzinfo-0.3.12}/tzinfo/definitions/Atlantic/Azores.rb +0 -0
- data/lib/active_support/vendor/{tzinfo-0.3.11 → tzinfo-0.3.12}/tzinfo/definitions/Atlantic/Cape_Verde.rb +0 -0
- data/lib/active_support/vendor/{tzinfo-0.3.11 → tzinfo-0.3.12}/tzinfo/definitions/Atlantic/South_Georgia.rb +0 -0
- data/lib/active_support/vendor/{tzinfo-0.3.11 → tzinfo-0.3.12}/tzinfo/definitions/Australia/Adelaide.rb +0 -0
- data/lib/active_support/vendor/{tzinfo-0.3.11 → tzinfo-0.3.12}/tzinfo/definitions/Australia/Brisbane.rb +0 -0
- data/lib/active_support/vendor/{tzinfo-0.3.11 → tzinfo-0.3.12}/tzinfo/definitions/Australia/Darwin.rb +0 -0
- data/lib/active_support/vendor/{tzinfo-0.3.11 → tzinfo-0.3.12}/tzinfo/definitions/Australia/Hobart.rb +0 -0
- data/lib/active_support/vendor/{tzinfo-0.3.11 → tzinfo-0.3.12}/tzinfo/definitions/Australia/Melbourne.rb +0 -0
- data/lib/active_support/vendor/{tzinfo-0.3.11 → tzinfo-0.3.12}/tzinfo/definitions/Australia/Perth.rb +0 -0
- data/lib/active_support/vendor/{tzinfo-0.3.11 → tzinfo-0.3.12}/tzinfo/definitions/Australia/Sydney.rb +0 -0
- data/lib/active_support/vendor/{tzinfo-0.3.11 → tzinfo-0.3.12}/tzinfo/definitions/Etc/UTC.rb +0 -0
- data/lib/active_support/vendor/{tzinfo-0.3.11 → tzinfo-0.3.12}/tzinfo/definitions/Europe/Amsterdam.rb +0 -0
- data/lib/active_support/vendor/{tzinfo-0.3.11 → tzinfo-0.3.12}/tzinfo/definitions/Europe/Athens.rb +0 -0
- data/lib/active_support/vendor/{tzinfo-0.3.11 → tzinfo-0.3.12}/tzinfo/definitions/Europe/Belgrade.rb +0 -0
- data/lib/active_support/vendor/{tzinfo-0.3.11 → tzinfo-0.3.12}/tzinfo/definitions/Europe/Berlin.rb +0 -0
- data/lib/active_support/vendor/{tzinfo-0.3.11 → tzinfo-0.3.12}/tzinfo/definitions/Europe/Bratislava.rb +0 -0
- data/lib/active_support/vendor/{tzinfo-0.3.11 → tzinfo-0.3.12}/tzinfo/definitions/Europe/Brussels.rb +0 -0
- data/lib/active_support/vendor/{tzinfo-0.3.11 → tzinfo-0.3.12}/tzinfo/definitions/Europe/Bucharest.rb +0 -0
- data/lib/active_support/vendor/{tzinfo-0.3.11 → tzinfo-0.3.12}/tzinfo/definitions/Europe/Budapest.rb +0 -0
- data/lib/active_support/vendor/{tzinfo-0.3.11 → tzinfo-0.3.12}/tzinfo/definitions/Europe/Copenhagen.rb +0 -0
- data/lib/active_support/vendor/{tzinfo-0.3.11 → tzinfo-0.3.12}/tzinfo/definitions/Europe/Dublin.rb +0 -0
- data/lib/active_support/vendor/{tzinfo-0.3.11 → tzinfo-0.3.12}/tzinfo/definitions/Europe/Helsinki.rb +0 -0
- data/lib/active_support/vendor/{tzinfo-0.3.11 → tzinfo-0.3.12}/tzinfo/definitions/Europe/Istanbul.rb +0 -0
- data/lib/active_support/vendor/{tzinfo-0.3.11 → tzinfo-0.3.12}/tzinfo/definitions/Europe/Kiev.rb +0 -0
- data/lib/active_support/vendor/{tzinfo-0.3.11 → tzinfo-0.3.12}/tzinfo/definitions/Europe/Lisbon.rb +0 -0
- data/lib/active_support/vendor/{tzinfo-0.3.11 → tzinfo-0.3.12}/tzinfo/definitions/Europe/Ljubljana.rb +0 -0
- data/lib/active_support/vendor/{tzinfo-0.3.11 → tzinfo-0.3.12}/tzinfo/definitions/Europe/London.rb +0 -0
- data/lib/active_support/vendor/{tzinfo-0.3.11 → tzinfo-0.3.12}/tzinfo/definitions/Europe/Madrid.rb +0 -0
- data/lib/active_support/vendor/{tzinfo-0.3.11 → tzinfo-0.3.12}/tzinfo/definitions/Europe/Minsk.rb +0 -0
- data/lib/active_support/vendor/{tzinfo-0.3.11 → tzinfo-0.3.12}/tzinfo/definitions/Europe/Moscow.rb +0 -0
- data/lib/active_support/vendor/{tzinfo-0.3.11 → tzinfo-0.3.12}/tzinfo/definitions/Europe/Paris.rb +0 -0
- data/lib/active_support/vendor/{tzinfo-0.3.11 → tzinfo-0.3.12}/tzinfo/definitions/Europe/Prague.rb +0 -0
- data/lib/active_support/vendor/{tzinfo-0.3.11 → tzinfo-0.3.12}/tzinfo/definitions/Europe/Riga.rb +0 -0
- data/lib/active_support/vendor/{tzinfo-0.3.11 → tzinfo-0.3.12}/tzinfo/definitions/Europe/Rome.rb +0 -0
- data/lib/active_support/vendor/{tzinfo-0.3.11 → tzinfo-0.3.12}/tzinfo/definitions/Europe/Sarajevo.rb +0 -0
- data/lib/active_support/vendor/{tzinfo-0.3.11 → tzinfo-0.3.12}/tzinfo/definitions/Europe/Skopje.rb +0 -0
- data/lib/active_support/vendor/{tzinfo-0.3.11 → tzinfo-0.3.12}/tzinfo/definitions/Europe/Sofia.rb +0 -0
- data/lib/active_support/vendor/{tzinfo-0.3.11 → tzinfo-0.3.12}/tzinfo/definitions/Europe/Stockholm.rb +0 -0
- data/lib/active_support/vendor/{tzinfo-0.3.11 → tzinfo-0.3.12}/tzinfo/definitions/Europe/Tallinn.rb +0 -0
- data/lib/active_support/vendor/{tzinfo-0.3.11 → tzinfo-0.3.12}/tzinfo/definitions/Europe/Vienna.rb +0 -0
- data/lib/active_support/vendor/{tzinfo-0.3.11 → tzinfo-0.3.12}/tzinfo/definitions/Europe/Vilnius.rb +0 -0
- data/lib/active_support/vendor/{tzinfo-0.3.11 → tzinfo-0.3.12}/tzinfo/definitions/Europe/Warsaw.rb +0 -0
- data/lib/active_support/vendor/{tzinfo-0.3.11 → tzinfo-0.3.12}/tzinfo/definitions/Europe/Zagreb.rb +0 -0
- data/lib/active_support/vendor/{tzinfo-0.3.11 → tzinfo-0.3.12}/tzinfo/definitions/Pacific/Auckland.rb +0 -0
- data/lib/active_support/vendor/{tzinfo-0.3.11 → tzinfo-0.3.12}/tzinfo/definitions/Pacific/Fiji.rb +0 -0
- data/lib/active_support/vendor/{tzinfo-0.3.11 → tzinfo-0.3.12}/tzinfo/definitions/Pacific/Guam.rb +0 -0
- data/lib/active_support/vendor/{tzinfo-0.3.11 → tzinfo-0.3.12}/tzinfo/definitions/Pacific/Honolulu.rb +0 -0
- data/lib/active_support/vendor/{tzinfo-0.3.11 → tzinfo-0.3.12}/tzinfo/definitions/Pacific/Majuro.rb +0 -0
- data/lib/active_support/vendor/{tzinfo-0.3.11 → tzinfo-0.3.12}/tzinfo/definitions/Pacific/Midway.rb +0 -0
- data/lib/active_support/vendor/{tzinfo-0.3.11 → tzinfo-0.3.12}/tzinfo/definitions/Pacific/Noumea.rb +0 -0
- data/lib/active_support/vendor/{tzinfo-0.3.11 → tzinfo-0.3.12}/tzinfo/definitions/Pacific/Pago_Pago.rb +0 -0
- data/lib/active_support/vendor/{tzinfo-0.3.11 → tzinfo-0.3.12}/tzinfo/definitions/Pacific/Port_Moresby.rb +0 -0
- data/lib/active_support/vendor/{tzinfo-0.3.11 → tzinfo-0.3.12}/tzinfo/definitions/Pacific/Tongatapu.rb +0 -0
- data/lib/active_support/vendor/{tzinfo-0.3.11 → tzinfo-0.3.12}/tzinfo/info_timezone.rb +0 -0
- data/lib/active_support/vendor/{tzinfo-0.3.11 → tzinfo-0.3.12}/tzinfo/linked_timezone.rb +0 -0
- data/lib/active_support/vendor/{tzinfo-0.3.11 → tzinfo-0.3.12}/tzinfo/linked_timezone_info.rb +0 -0
- data/lib/active_support/vendor/{tzinfo-0.3.11 → tzinfo-0.3.12}/tzinfo/offset_rationals.rb +0 -0
- data/lib/active_support/vendor/{tzinfo-0.3.11 → tzinfo-0.3.12}/tzinfo/ruby_core_support.rb +0 -0
- data/lib/active_support/vendor/{tzinfo-0.3.11 → tzinfo-0.3.12}/tzinfo/time_or_datetime.rb +0 -0
- data/lib/active_support/vendor/{tzinfo-0.3.11 → tzinfo-0.3.12}/tzinfo/timezone.rb +0 -0
- data/lib/active_support/vendor/{tzinfo-0.3.11 → tzinfo-0.3.12}/tzinfo/timezone_definition.rb +0 -0
- data/lib/active_support/vendor/{tzinfo-0.3.11 → tzinfo-0.3.12}/tzinfo/timezone_info.rb +0 -0
- data/lib/active_support/vendor/{tzinfo-0.3.11 → tzinfo-0.3.12}/tzinfo/timezone_offset_info.rb +0 -0
- data/lib/active_support/vendor/{tzinfo-0.3.11 → tzinfo-0.3.12}/tzinfo/timezone_period.rb +0 -0
- data/lib/active_support/vendor/{tzinfo-0.3.11 → tzinfo-0.3.12}/tzinfo/timezone_transition_info.rb +0 -0
- data/lib/active_support/vendor/xml-simple-1.0.11/xmlsimple.rb +3 -3
- data/lib/active_support/version.rb +1 -1
- metadata +185 -167
- data/lib/active_support/clean_logger.rb +0 -127
- data/lib/active_support/core_ext/string/unicode.rb +0 -66
- data/lib/active_support/core_ext/test.rb +0 -1
- data/lib/active_support/multibyte/generators/generate_tables.rb +0 -149
- data/lib/active_support/multibyte/handlers/passthru_handler.rb +0 -9
- data/lib/active_support/multibyte/handlers/utf8_handler.rb +0 -564
- data/lib/active_support/multibyte/handlers/utf8_handler_proc.rb +0 -43
- data/lib/active_support/vendor/tzinfo-0.3.11/tzinfo/definitions/America/Argentina/San_Juan.rb +0 -170
@@ -47,15 +47,46 @@ class Module
|
|
47
47
|
# Foo.new.min # => 4
|
48
48
|
# Foo.new.max # => 11
|
49
49
|
#
|
50
|
+
# Delegates can optionally be prefixed using the <tt>:prefix</tt> option. If the value
|
51
|
+
# is <tt>true</tt>, the delegate methods are prefixed with the name of the object being
|
52
|
+
# delegated to.
|
53
|
+
#
|
54
|
+
# Person = Struct.new(:name, :address)
|
55
|
+
#
|
56
|
+
# class Invoice < Struct.new(:client)
|
57
|
+
# delegate :name, :address, :to => :client, :prefix => true
|
58
|
+
# end
|
59
|
+
#
|
60
|
+
# john_doe = Person.new("John Doe", "Vimmersvej 13")
|
61
|
+
# invoice = Invoice.new(john_doe)
|
62
|
+
# invoice.client_name # => "John Doe"
|
63
|
+
# invoice.client_address # => "Vimmersvej 13"
|
64
|
+
#
|
65
|
+
# It is also possible to supply a custom prefix.
|
66
|
+
#
|
67
|
+
# class Invoice < Struct.new(:client)
|
68
|
+
# delegate :name, :address, :to => :client, :prefix => :customer
|
69
|
+
# end
|
70
|
+
#
|
71
|
+
# invoice = Invoice.new(john_doe)
|
72
|
+
# invoice.customer_name # => "John Doe"
|
73
|
+
# invoice.customer_address # => "Vimmersvej 13"
|
74
|
+
#
|
50
75
|
def delegate(*methods)
|
51
76
|
options = methods.pop
|
52
77
|
unless options.is_a?(Hash) && to = options[:to]
|
53
78
|
raise ArgumentError, "Delegation needs a target. Supply an options hash with a :to key as the last argument (e.g. delegate :hello, :to => :greeter)."
|
54
79
|
end
|
55
80
|
|
81
|
+
if options[:prefix] == true && options[:to].to_s =~ /^[^a-z_]/
|
82
|
+
raise ArgumentError, "Can only automatically set the delegation prefix when delegating to a method."
|
83
|
+
end
|
84
|
+
|
85
|
+
prefix = options[:prefix] && "#{options[:prefix] == true ? to : options[:prefix]}_"
|
86
|
+
|
56
87
|
methods.each do |method|
|
57
88
|
module_eval(<<-EOS, "(__DELEGATION__)", 1)
|
58
|
-
def #{method}(*args, &block)
|
89
|
+
def #{prefix}#{method}(*args, &block)
|
59
90
|
#{to}.__send__(#{method.inspect}, *args, &block)
|
60
91
|
end
|
61
92
|
EOS
|
@@ -1,75 +1,90 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
# The parent of top-level and anonymous modules is Object.
|
14
|
-
#
|
15
|
-
# p M.parent # => Object
|
16
|
-
# p Module.new.parent # => Object
|
17
|
-
#
|
18
|
-
def parent
|
19
|
-
parent_name = name.split('::')[0..-2] * '::'
|
20
|
-
parent_name.empty? ? Object : parent_name.constantize
|
21
|
-
end
|
1
|
+
module ActiveSupport
|
2
|
+
module CoreExtensions
|
3
|
+
module Module
|
4
|
+
# Returns the name of the module containing this one.
|
5
|
+
#
|
6
|
+
# p M::N.parent_name # => "M"
|
7
|
+
def parent_name
|
8
|
+
unless defined? @parent_name
|
9
|
+
@parent_name = name =~ /::[^:]+\Z/ ? $`.freeze : nil
|
10
|
+
end
|
11
|
+
@parent_name
|
12
|
+
end
|
22
13
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
end
|
43
|
-
parents << Object unless parents.include? Object
|
44
|
-
parents
|
45
|
-
end
|
14
|
+
# Returns the module which contains this one according to its name.
|
15
|
+
#
|
16
|
+
# module M
|
17
|
+
# module N
|
18
|
+
# end
|
19
|
+
# end
|
20
|
+
# X = M::N
|
21
|
+
#
|
22
|
+
# p M::N.parent # => M
|
23
|
+
# p X.parent # => M
|
24
|
+
#
|
25
|
+
# The parent of top-level and anonymous modules is Object.
|
26
|
+
#
|
27
|
+
# p M.parent # => Object
|
28
|
+
# p Module.new.parent # => Object
|
29
|
+
#
|
30
|
+
def parent
|
31
|
+
parent_name ? parent_name.constantize : Object
|
32
|
+
end
|
46
33
|
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
34
|
+
# Returns all the parents of this module according to its name, ordered from
|
35
|
+
# nested outwards. The receiver is not contained within the result.
|
36
|
+
#
|
37
|
+
# module M
|
38
|
+
# module N
|
39
|
+
# end
|
40
|
+
# end
|
41
|
+
# X = M::N
|
42
|
+
#
|
43
|
+
# p M.parents # => [Object]
|
44
|
+
# p M::N.parents # => [M, Object]
|
45
|
+
# p X.parents # => [M, Object]
|
46
|
+
#
|
47
|
+
def parents
|
48
|
+
parents = []
|
49
|
+
if parent_name
|
50
|
+
parts = parent_name.split('::')
|
51
|
+
until parts.empty?
|
52
|
+
parents << (parts * '::').constantize
|
53
|
+
parts.pop
|
54
|
+
end
|
55
|
+
end
|
56
|
+
parents << Object unless parents.include? Object
|
57
|
+
parents
|
58
|
+
end
|
54
59
|
|
55
|
-
|
56
|
-
|
57
|
-
|
60
|
+
if RUBY_VERSION < '1.9'
|
61
|
+
# Returns the constants that have been defined locally by this object and
|
62
|
+
# not in an ancestor. This method is exact if running under Ruby 1.9. In
|
63
|
+
# previous versions it may miss some constants if their definition in some
|
64
|
+
# ancestor is identical to their definition in the receiver.
|
65
|
+
def local_constants
|
66
|
+
inherited = {}
|
67
|
+
|
68
|
+
ancestors.each do |anc|
|
69
|
+
next if anc == self
|
70
|
+
anc.constants.each { |const| inherited[const] = anc.const_get(const) }
|
71
|
+
end
|
72
|
+
|
73
|
+
constants.select do |const|
|
74
|
+
!inherited.key?(const) || inherited[const].object_id != const_get(const).object_id
|
75
|
+
end
|
76
|
+
end
|
77
|
+
else
|
78
|
+
def local_constants #:nodoc:
|
79
|
+
constants(false)
|
80
|
+
end
|
58
81
|
end
|
59
82
|
|
60
|
-
constants
|
61
|
-
|
83
|
+
# Returns the names of the constants defined locally rather than the
|
84
|
+
# constants themselves. See <tt>local_constants</tt>.
|
85
|
+
def local_constant_names
|
86
|
+
local_constants.map { |c| c.to_s }
|
62
87
|
end
|
63
88
|
end
|
64
|
-
else
|
65
|
-
def local_constants #:nodoc:
|
66
|
-
constants(false)
|
67
|
-
end
|
68
|
-
end
|
69
|
-
|
70
|
-
# Returns the names of the constants defined locally rather than the
|
71
|
-
# constants themselves. See <tt>local_constants</tt>.
|
72
|
-
def local_constant_names
|
73
|
-
local_constants.map(&:to_s)
|
74
89
|
end
|
75
90
|
end
|
@@ -1,21 +1,22 @@
|
|
1
1
|
module ActiveSupport
|
2
2
|
class ModelName < String
|
3
|
-
attr_reader :singular, :plural, :partial_path
|
3
|
+
attr_reader :singular, :plural, :cache_key, :partial_path
|
4
4
|
|
5
5
|
def initialize(name)
|
6
6
|
super
|
7
7
|
@singular = underscore.tr('/', '_').freeze
|
8
8
|
@plural = @singular.pluralize.freeze
|
9
|
-
@
|
9
|
+
@cache_key = tableize.freeze
|
10
|
+
@partial_path = "#{@cache_key}/#{demodulize.underscore}".freeze
|
10
11
|
end
|
11
12
|
end
|
12
13
|
|
13
|
-
module
|
14
|
+
module CoreExtensions
|
14
15
|
module Module
|
15
|
-
module
|
16
|
-
|
17
|
-
|
18
|
-
|
16
|
+
# Returns an ActiveSupport::ModelName object for module. It can be
|
17
|
+
# used to retrieve all kinds of naming-related information.
|
18
|
+
def model_name
|
19
|
+
@model_name ||= ModelName.new(name)
|
19
20
|
end
|
20
21
|
end
|
21
22
|
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
class Module
|
2
|
+
# Synchronize access around a method, delegating synchronization to a
|
3
|
+
# particular mutex. A mutex (either a Mutex, or any object that responds to
|
4
|
+
# #synchronize and yields to a block) must be provided as a final :with option.
|
5
|
+
# The :with option should be a symbol or string, and can represent a method,
|
6
|
+
# constant, or instance or class variable.
|
7
|
+
# Example:
|
8
|
+
# class SharedCache
|
9
|
+
# @@lock = Mutex.new
|
10
|
+
# def expire
|
11
|
+
# ...
|
12
|
+
# end
|
13
|
+
# synchronize :expire, :with => :@@lock
|
14
|
+
# end
|
15
|
+
def synchronize(*methods)
|
16
|
+
options = methods.extract_options!
|
17
|
+
unless options.is_a?(Hash) && with = options[:with]
|
18
|
+
raise ArgumentError, "Synchronization needs a mutex. Supply an options hash with a :with key as the last argument (e.g. synchronize :hello, :with => :@mutex)."
|
19
|
+
end
|
20
|
+
|
21
|
+
methods.each do |method|
|
22
|
+
aliased_method, punctuation = method.to_s.sub(/([?!=])$/, ''), $1
|
23
|
+
|
24
|
+
if method_defined?("#{aliased_method}_without_synchronization#{punctuation}")
|
25
|
+
raise ArgumentError, "#{method} is already synchronized. Double synchronization is not currently supported."
|
26
|
+
end
|
27
|
+
|
28
|
+
module_eval(<<-EOS, __FILE__, __LINE__)
|
29
|
+
def #{aliased_method}_with_synchronization#{punctuation}(*args, &block)
|
30
|
+
#{with}.synchronize do
|
31
|
+
#{aliased_method}_without_synchronization#{punctuation}(*args, &block)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
EOS
|
35
|
+
|
36
|
+
alias_method_chain method, :synchronization
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -60,16 +60,6 @@ module ActiveSupport #:nodoc:
|
|
60
60
|
end
|
61
61
|
alias :fortnight :fortnights
|
62
62
|
|
63
|
-
def months
|
64
|
-
ActiveSupport::Duration.new(self * 30.days, [[:months, self]])
|
65
|
-
end
|
66
|
-
alias :month :months
|
67
|
-
|
68
|
-
def years
|
69
|
-
ActiveSupport::Duration.new(self * 365.25.days, [[:years, self]])
|
70
|
-
end
|
71
|
-
alias :year :years
|
72
|
-
|
73
63
|
# Reads best without arguments: 10.minutes.ago
|
74
64
|
def ago(time = ::Time.now)
|
75
65
|
time - self
|
@@ -3,21 +3,43 @@ class Object
|
|
3
3
|
Class.remove_class(*subclasses_of(*superclasses))
|
4
4
|
end
|
5
5
|
|
6
|
-
|
7
|
-
|
6
|
+
begin
|
7
|
+
ObjectSpace.each_object(Class.new) {}
|
8
8
|
|
9
9
|
# Exclude this class unless it's a subclass of our supers and is defined.
|
10
10
|
# We check defined? in case we find a removed class that has yet to be
|
11
11
|
# garbage collected. This also fails for anonymous classes -- please
|
12
12
|
# submit a patch if you have a workaround.
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
13
|
+
def subclasses_of(*superclasses) #:nodoc:
|
14
|
+
subclasses = []
|
15
|
+
|
16
|
+
superclasses.each do |sup|
|
17
|
+
ObjectSpace.each_object(class << sup; self; end) do |k|
|
18
|
+
if k != sup && (k.name.blank? || eval("defined?(::#{k}) && ::#{k}.object_id == k.object_id"))
|
19
|
+
subclasses << k
|
20
|
+
end
|
21
|
+
end
|
17
22
|
end
|
23
|
+
|
24
|
+
subclasses
|
18
25
|
end
|
26
|
+
rescue RuntimeError
|
27
|
+
# JRuby and any implementations which cannot handle the objectspace traversal
|
28
|
+
# above fall back to this implementation
|
29
|
+
def subclasses_of(*superclasses) #:nodoc:
|
30
|
+
subclasses = []
|
19
31
|
|
20
|
-
|
32
|
+
superclasses.each do |sup|
|
33
|
+
ObjectSpace.each_object(Class) do |k|
|
34
|
+
if superclasses.any? { |superclass| k < superclass } &&
|
35
|
+
(k.name.blank? || eval("defined?(::#{k}) && ::#{k}.object_id == k.object_id"))
|
36
|
+
subclasses << k
|
37
|
+
end
|
38
|
+
end
|
39
|
+
subclasses.uniq!
|
40
|
+
end
|
41
|
+
subclasses
|
42
|
+
end
|
21
43
|
end
|
22
44
|
|
23
45
|
def extended_by #:nodoc:
|
@@ -35,7 +35,7 @@ class Object
|
|
35
35
|
# C.new(0, 1).instance_variable_names # => ["@y", "@x"]
|
36
36
|
if RUBY_VERSION >= '1.9'
|
37
37
|
def instance_variable_names
|
38
|
-
instance_variables.map
|
38
|
+
instance_variables.map { |var| var.to_s }
|
39
39
|
end
|
40
40
|
else
|
41
41
|
alias_method :instance_variable_names, :instance_variables
|
@@ -0,0 +1,13 @@
|
|
1
|
+
class Object
|
2
|
+
# Get object's meta (ghost, eigenclass, singleton) class
|
3
|
+
def metaclass
|
4
|
+
class << self
|
5
|
+
self
|
6
|
+
end
|
7
|
+
end
|
8
|
+
|
9
|
+
# If class_eval is called on an object, add those methods to its metaclass
|
10
|
+
def class_eval(*args, &block)
|
11
|
+
metaclass.class_eval(*args, &block)
|
12
|
+
end
|
13
|
+
end
|
@@ -1,35 +1,50 @@
|
|
1
1
|
class Object
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
# A Ruby-ized realization of the K combinator, courtesy of Mikael Brockman.
|
2
|
+
# Returns +value+ after yielding +value+ to the block. This simplifies the
|
3
|
+
# process of constructing an object, performing work on the object, and then
|
4
|
+
# returning the object from a method. It is a Ruby-ized realization of the K
|
5
|
+
# combinator, courtesy of Mikael Brockman.
|
8
6
|
#
|
9
|
-
#
|
10
|
-
# returning values = [] do
|
11
|
-
# values << 'bar'
|
12
|
-
# values << 'baz'
|
13
|
-
# end
|
14
|
-
# end
|
7
|
+
# ==== Examples
|
15
8
|
#
|
16
|
-
#
|
9
|
+
# # Without returning
|
10
|
+
# def foo
|
11
|
+
# values = []
|
12
|
+
# values << "bar"
|
13
|
+
# values << "baz"
|
14
|
+
# return values
|
15
|
+
# end
|
17
16
|
#
|
18
|
-
#
|
19
|
-
# returning [] do |values|
|
20
|
-
# values << 'bar'
|
21
|
-
# values << 'baz'
|
22
|
-
# end
|
23
|
-
# end
|
17
|
+
# foo # => ['bar', 'baz']
|
24
18
|
#
|
25
|
-
#
|
19
|
+
# # returning with a local variable
|
20
|
+
# def foo
|
21
|
+
# returning values = [] do
|
22
|
+
# values << 'bar'
|
23
|
+
# values << 'baz'
|
24
|
+
# end
|
25
|
+
# end
|
26
26
|
#
|
27
|
+
# foo # => ['bar', 'baz']
|
28
|
+
#
|
29
|
+
# # returning with a block argument
|
30
|
+
# def foo
|
31
|
+
# returning [] do |values|
|
32
|
+
# values << 'bar'
|
33
|
+
# values << 'baz'
|
34
|
+
# end
|
35
|
+
# end
|
36
|
+
#
|
37
|
+
# foo # => ['bar', 'baz']
|
27
38
|
def returning(value)
|
28
39
|
yield(value)
|
29
40
|
value
|
30
41
|
end
|
31
42
|
|
32
|
-
# An elegant way to
|
43
|
+
# An elegant way to factor duplication out of options passed to a series of
|
44
|
+
# method calls. Each method called in the block, with the block variable as
|
45
|
+
# the receiver, will have its options merged with the default +options+ hash
|
46
|
+
# provided. Each method called on the block variable must take an options
|
47
|
+
# hash as its final argument.
|
33
48
|
#
|
34
49
|
# with_options :order => 'created_at', :class_name => 'Comment' do |post|
|
35
50
|
# post.has_many :comments, :conditions => ['approved = ?', true], :dependent => :delete_all
|