activesupport 2.0.5 → 2.1.0

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.

Files changed (236) hide show
  1. data/CHANGELOG +183 -5
  2. data/lib/active_support.rb +6 -2
  3. data/lib/active_support/base64.rb +5 -0
  4. data/lib/active_support/basic_object.rb +23 -4
  5. data/lib/active_support/buffered_logger.rb +17 -3
  6. data/lib/active_support/cache.rb +145 -0
  7. data/lib/active_support/cache/compressed_mem_cache_store.rb +15 -0
  8. data/lib/active_support/cache/drb_store.rb +15 -0
  9. data/lib/active_support/cache/file_store.rb +70 -0
  10. data/lib/active_support/cache/mem_cache_store.rb +100 -0
  11. data/lib/active_support/cache/memory_store.rb +38 -0
  12. data/lib/active_support/callbacks.rb +275 -0
  13. data/lib/active_support/core_ext/array/access.rb +2 -4
  14. data/lib/active_support/core_ext/array/conversions.rb +89 -5
  15. data/lib/active_support/core_ext/array/extract_options.rb +2 -1
  16. data/lib/active_support/core_ext/array/grouping.rb +3 -8
  17. data/lib/active_support/core_ext/array/random_access.rb +1 -1
  18. data/lib/active_support/core_ext/base64.rb +4 -0
  19. data/lib/active_support/core_ext/base64/encoding.rb +13 -0
  20. data/lib/active_support/core_ext/benchmark.rb +12 -0
  21. data/lib/active_support/core_ext/bigdecimal.rb +4 -0
  22. data/lib/active_support/core_ext/bigdecimal/conversions.rb +39 -4
  23. data/lib/active_support/core_ext/blank.rb +5 -2
  24. data/lib/active_support/core_ext/class/attribute_accessors.rb +7 -1
  25. data/lib/active_support/core_ext/class/delegating_attributes.rb +7 -1
  26. data/lib/active_support/core_ext/class/inheritable_attributes.rb +1 -1
  27. data/lib/active_support/core_ext/class/removal.rb +26 -0
  28. data/lib/active_support/core_ext/date/calculations.rb +28 -1
  29. data/lib/active_support/core_ext/date/conversions.rb +1 -0
  30. data/lib/active_support/core_ext/date_time.rb +2 -0
  31. data/lib/active_support/core_ext/date_time/calculations.rb +37 -2
  32. data/lib/active_support/core_ext/date_time/conversions.rb +27 -14
  33. data/lib/active_support/core_ext/enumerable.rb +16 -9
  34. data/lib/active_support/core_ext/exception.rb +8 -0
  35. data/lib/active_support/core_ext/file.rb +6 -6
  36. data/lib/active_support/core_ext/hash/conversions.rb +26 -8
  37. data/lib/active_support/core_ext/hash/indifferent_access.rb +35 -0
  38. data/lib/active_support/core_ext/hash/reverse_merge.rb +4 -1
  39. data/lib/active_support/core_ext/integer/even_odd.rb +10 -5
  40. data/lib/active_support/core_ext/integer/inflections.rb +0 -1
  41. data/lib/active_support/core_ext/kernel/daemonizing.rb +2 -10
  42. data/lib/active_support/core_ext/kernel/reporting.rb +8 -0
  43. data/lib/active_support/core_ext/module/attr_internal.rb +4 -3
  44. data/lib/active_support/core_ext/module/attribute_accessors.rb +11 -1
  45. data/lib/active_support/core_ext/module/delegation.rb +5 -3
  46. data/lib/active_support/core_ext/module/inclusion.rb +19 -0
  47. data/lib/active_support/core_ext/module/introspection.rb +50 -16
  48. data/lib/active_support/core_ext/module/loading.rb +10 -0
  49. data/lib/active_support/core_ext/numeric.rb +3 -1
  50. data/lib/active_support/core_ext/numeric/conversions.rb +19 -0
  51. data/lib/active_support/core_ext/object/instance_variables.rb +52 -0
  52. data/lib/active_support/core_ext/object/misc.rb +1 -1
  53. data/lib/active_support/core_ext/process.rb +1 -0
  54. data/lib/active_support/core_ext/process/daemon.rb +25 -0
  55. data/lib/active_support/core_ext/range/conversions.rb +5 -1
  56. data/lib/active_support/core_ext/range/include_range.rb +8 -0
  57. data/lib/active_support/core_ext/range/overlaps.rb +3 -0
  58. data/lib/active_support/core_ext/string.rb +5 -10
  59. data/lib/active_support/core_ext/string/access.rb +72 -48
  60. data/lib/active_support/core_ext/string/conversions.rb +4 -4
  61. data/lib/active_support/core_ext/string/filters.rb +26 -0
  62. data/lib/active_support/core_ext/string/inflections.rb +56 -64
  63. data/lib/active_support/core_ext/string/iterators.rb +4 -0
  64. data/lib/active_support/core_ext/string/starts_ends_with.rb +12 -4
  65. data/lib/active_support/core_ext/string/unicode.rb +14 -7
  66. data/lib/active_support/core_ext/symbol.rb +1 -1
  67. data/lib/active_support/core_ext/time.rb +2 -0
  68. data/lib/active_support/core_ext/time/calculations.rb +75 -23
  69. data/lib/active_support/core_ext/time/conversions.rb +22 -35
  70. data/lib/active_support/core_ext/time/zones.rb +86 -0
  71. data/lib/active_support/dependencies.rb +92 -80
  72. data/lib/active_support/deprecation.rb +2 -16
  73. data/lib/active_support/duration.rb +4 -4
  74. data/lib/active_support/gzip.rb +25 -0
  75. data/lib/active_support/inflector.rb +92 -69
  76. data/lib/active_support/json.rb +17 -25
  77. data/lib/active_support/json/decoding.rb +1 -1
  78. data/lib/active_support/json/encoders/date.rb +11 -2
  79. data/lib/active_support/json/encoders/date_time.rb +11 -2
  80. data/lib/active_support/json/encoders/enumerable.rb +2 -2
  81. data/lib/active_support/json/encoders/hash.rb +3 -6
  82. data/lib/active_support/json/encoders/object.rb +1 -1
  83. data/lib/active_support/json/encoders/string.rb +8 -2
  84. data/lib/active_support/json/encoders/time.rb +11 -2
  85. data/lib/active_support/json/encoding.rb +0 -1
  86. data/lib/active_support/multibyte/chars.rb +8 -6
  87. data/lib/active_support/multibyte/handlers/utf8_handler.rb +11 -11
  88. data/lib/active_support/ordered_hash.rb +43 -0
  89. data/lib/active_support/ordered_options.rb +0 -38
  90. data/lib/active_support/test_case.rb +10 -2
  91. data/lib/active_support/testing/default.rb +3 -6
  92. data/lib/active_support/testing/setup_and_teardown.rb +93 -0
  93. data/lib/active_support/time_with_zone.rb +283 -0
  94. data/lib/active_support/values/time_zone.rb +336 -123
  95. data/lib/active_support/vendor.rb +12 -0
  96. data/lib/active_support/vendor/memcache-client-1.5.0/memcache.rb +849 -0
  97. data/lib/active_support/vendor/tzinfo-0.3.8/tzinfo.rb +33 -0
  98. data/lib/active_support/vendor/tzinfo-0.3.8/tzinfo/data_timezone.rb +47 -0
  99. data/lib/active_support/vendor/tzinfo-0.3.8/tzinfo/data_timezone_info.rb +226 -0
  100. data/lib/active_support/vendor/tzinfo-0.3.8/tzinfo/definitions/Africa/Algiers.rb +55 -0
  101. data/lib/active_support/vendor/tzinfo-0.3.8/tzinfo/definitions/Africa/Cairo.rb +219 -0
  102. data/lib/active_support/vendor/tzinfo-0.3.8/tzinfo/definitions/Africa/Casablanca.rb +38 -0
  103. data/lib/active_support/vendor/tzinfo-0.3.8/tzinfo/definitions/Africa/Harare.rb +18 -0
  104. data/lib/active_support/vendor/tzinfo-0.3.8/tzinfo/definitions/Africa/Johannesburg.rb +25 -0
  105. data/lib/active_support/vendor/tzinfo-0.3.8/tzinfo/definitions/Africa/Monrovia.rb +22 -0
  106. data/lib/active_support/vendor/tzinfo-0.3.8/tzinfo/definitions/Africa/Nairobi.rb +23 -0
  107. data/lib/active_support/vendor/tzinfo-0.3.8/tzinfo/definitions/America/Argentina/Buenos_Aires.rb +166 -0
  108. data/lib/active_support/vendor/tzinfo-0.3.8/tzinfo/definitions/America/Argentina/San_Juan.rb +170 -0
  109. data/lib/active_support/vendor/tzinfo-0.3.8/tzinfo/definitions/America/Bogota.rb +23 -0
  110. data/lib/active_support/vendor/tzinfo-0.3.8/tzinfo/definitions/America/Caracas.rb +23 -0
  111. data/lib/active_support/vendor/tzinfo-0.3.8/tzinfo/definitions/America/Chicago.rb +283 -0
  112. data/lib/active_support/vendor/tzinfo-0.3.8/tzinfo/definitions/America/Chihuahua.rb +136 -0
  113. data/lib/active_support/vendor/tzinfo-0.3.8/tzinfo/definitions/America/Denver.rb +204 -0
  114. data/lib/active_support/vendor/tzinfo-0.3.8/tzinfo/definitions/America/Godthab.rb +161 -0
  115. data/lib/active_support/vendor/tzinfo-0.3.8/tzinfo/definitions/America/Guatemala.rb +27 -0
  116. data/lib/active_support/vendor/tzinfo-0.3.8/tzinfo/definitions/America/Halifax.rb +274 -0
  117. data/lib/active_support/vendor/tzinfo-0.3.8/tzinfo/definitions/America/Indiana/Indianapolis.rb +149 -0
  118. data/lib/active_support/vendor/tzinfo-0.3.8/tzinfo/definitions/America/Juneau.rb +194 -0
  119. data/lib/active_support/vendor/tzinfo-0.3.8/tzinfo/definitions/America/La_Paz.rb +22 -0
  120. data/lib/active_support/vendor/tzinfo-0.3.8/tzinfo/definitions/America/Lima.rb +35 -0
  121. data/lib/active_support/vendor/tzinfo-0.3.8/tzinfo/definitions/America/Los_Angeles.rb +232 -0
  122. data/lib/active_support/vendor/tzinfo-0.3.8/tzinfo/definitions/America/Mazatlan.rb +139 -0
  123. data/lib/active_support/vendor/tzinfo-0.3.8/tzinfo/definitions/America/Mexico_City.rb +144 -0
  124. data/lib/active_support/vendor/tzinfo-0.3.8/tzinfo/definitions/America/Monterrey.rb +131 -0
  125. data/lib/active_support/vendor/tzinfo-0.3.8/tzinfo/definitions/America/New_York.rb +282 -0
  126. data/lib/active_support/vendor/tzinfo-0.3.8/tzinfo/definitions/America/Phoenix.rb +30 -0
  127. data/lib/active_support/vendor/tzinfo-0.3.8/tzinfo/definitions/America/Regina.rb +74 -0
  128. data/lib/active_support/vendor/tzinfo-0.3.8/tzinfo/definitions/America/Santiago.rb +205 -0
  129. data/lib/active_support/vendor/tzinfo-0.3.8/tzinfo/definitions/America/St_Johns.rb +288 -0
  130. data/lib/active_support/vendor/tzinfo-0.3.8/tzinfo/definitions/America/Tijuana.rb +196 -0
  131. data/lib/active_support/vendor/tzinfo-0.3.8/tzinfo/definitions/Asia/Almaty.rb +67 -0
  132. data/lib/active_support/vendor/tzinfo-0.3.8/tzinfo/definitions/Asia/Baghdad.rb +73 -0
  133. data/lib/active_support/vendor/tzinfo-0.3.8/tzinfo/definitions/Asia/Baku.rb +161 -0
  134. data/lib/active_support/vendor/tzinfo-0.3.8/tzinfo/definitions/Asia/Bangkok.rb +20 -0
  135. data/lib/active_support/vendor/tzinfo-0.3.8/tzinfo/definitions/Asia/Chongqing.rb +33 -0
  136. data/lib/active_support/vendor/tzinfo-0.3.8/tzinfo/definitions/Asia/Dhaka.rb +27 -0
  137. data/lib/active_support/vendor/tzinfo-0.3.8/tzinfo/definitions/Asia/Hong_Kong.rb +87 -0
  138. data/lib/active_support/vendor/tzinfo-0.3.8/tzinfo/definitions/Asia/Irkutsk.rb +165 -0
  139. data/lib/active_support/vendor/tzinfo-0.3.8/tzinfo/definitions/Asia/Jakarta.rb +30 -0
  140. data/lib/active_support/vendor/tzinfo-0.3.8/tzinfo/definitions/Asia/Jerusalem.rb +163 -0
  141. data/lib/active_support/vendor/tzinfo-0.3.8/tzinfo/definitions/Asia/Kabul.rb +20 -0
  142. data/lib/active_support/vendor/tzinfo-0.3.8/tzinfo/definitions/Asia/Kamchatka.rb +163 -0
  143. data/lib/active_support/vendor/tzinfo-0.3.8/tzinfo/definitions/Asia/Karachi.rb +28 -0
  144. data/lib/active_support/vendor/tzinfo-0.3.8/tzinfo/definitions/Asia/Katmandu.rb +20 -0
  145. data/lib/active_support/vendor/tzinfo-0.3.8/tzinfo/definitions/Asia/Kolkata.rb +25 -0
  146. data/lib/active_support/vendor/tzinfo-0.3.8/tzinfo/definitions/Asia/Krasnoyarsk.rb +163 -0
  147. data/lib/active_support/vendor/tzinfo-0.3.8/tzinfo/definitions/Asia/Kuala_Lumpur.rb +31 -0
  148. data/lib/active_support/vendor/tzinfo-0.3.8/tzinfo/definitions/Asia/Kuwait.rb +18 -0
  149. data/lib/active_support/vendor/tzinfo-0.3.8/tzinfo/definitions/Asia/Magadan.rb +163 -0
  150. data/lib/active_support/vendor/tzinfo-0.3.8/tzinfo/definitions/Asia/Muscat.rb +18 -0
  151. data/lib/active_support/vendor/tzinfo-0.3.8/tzinfo/definitions/Asia/Novosibirsk.rb +164 -0
  152. data/lib/active_support/vendor/tzinfo-0.3.8/tzinfo/definitions/Asia/Rangoon.rb +24 -0
  153. data/lib/active_support/vendor/tzinfo-0.3.8/tzinfo/definitions/Asia/Riyadh.rb +18 -0
  154. data/lib/active_support/vendor/tzinfo-0.3.8/tzinfo/definitions/Asia/Seoul.rb +34 -0
  155. data/lib/active_support/vendor/tzinfo-0.3.8/tzinfo/definitions/Asia/Shanghai.rb +35 -0
  156. data/lib/active_support/vendor/tzinfo-0.3.8/tzinfo/definitions/Asia/Singapore.rb +33 -0
  157. data/lib/active_support/vendor/tzinfo-0.3.8/tzinfo/definitions/Asia/Taipei.rb +59 -0
  158. data/lib/active_support/vendor/tzinfo-0.3.8/tzinfo/definitions/Asia/Tashkent.rb +47 -0
  159. data/lib/active_support/vendor/tzinfo-0.3.8/tzinfo/definitions/Asia/Tbilisi.rb +78 -0
  160. data/lib/active_support/vendor/tzinfo-0.3.8/tzinfo/definitions/Asia/Tehran.rb +121 -0
  161. data/lib/active_support/vendor/tzinfo-0.3.8/tzinfo/definitions/Asia/Tokyo.rb +30 -0
  162. data/lib/active_support/vendor/tzinfo-0.3.8/tzinfo/definitions/Asia/Ulaanbaatar.rb +65 -0
  163. data/lib/active_support/vendor/tzinfo-0.3.8/tzinfo/definitions/Asia/Urumqi.rb +33 -0
  164. data/lib/active_support/vendor/tzinfo-0.3.8/tzinfo/definitions/Asia/Vladivostok.rb +164 -0
  165. data/lib/active_support/vendor/tzinfo-0.3.8/tzinfo/definitions/Asia/Yakutsk.rb +163 -0
  166. data/lib/active_support/vendor/tzinfo-0.3.8/tzinfo/definitions/Asia/Yekaterinburg.rb +165 -0
  167. data/lib/active_support/vendor/tzinfo-0.3.8/tzinfo/definitions/Asia/Yerevan.rb +165 -0
  168. data/lib/active_support/vendor/tzinfo-0.3.8/tzinfo/definitions/Atlantic/Azores.rb +270 -0
  169. data/lib/active_support/vendor/tzinfo-0.3.8/tzinfo/definitions/Atlantic/Cape_Verde.rb +23 -0
  170. data/lib/active_support/vendor/tzinfo-0.3.8/tzinfo/definitions/Atlantic/South_Georgia.rb +18 -0
  171. data/lib/active_support/vendor/tzinfo-0.3.8/tzinfo/definitions/Australia/Adelaide.rb +187 -0
  172. data/lib/active_support/vendor/tzinfo-0.3.8/tzinfo/definitions/Australia/Brisbane.rb +35 -0
  173. data/lib/active_support/vendor/tzinfo-0.3.8/tzinfo/definitions/Australia/Darwin.rb +29 -0
  174. data/lib/active_support/vendor/tzinfo-0.3.8/tzinfo/definitions/Australia/Hobart.rb +193 -0
  175. data/lib/active_support/vendor/tzinfo-0.3.8/tzinfo/definitions/Australia/Melbourne.rb +185 -0
  176. data/lib/active_support/vendor/tzinfo-0.3.8/tzinfo/definitions/Australia/Perth.rb +37 -0
  177. data/lib/active_support/vendor/tzinfo-0.3.8/tzinfo/definitions/Australia/Sydney.rb +185 -0
  178. data/lib/active_support/vendor/tzinfo-0.3.8/tzinfo/definitions/Etc/UTC.rb +16 -0
  179. data/lib/active_support/vendor/tzinfo-0.3.8/tzinfo/definitions/Europe/Amsterdam.rb +228 -0
  180. data/lib/active_support/vendor/tzinfo-0.3.8/tzinfo/definitions/Europe/Athens.rb +185 -0
  181. data/lib/active_support/vendor/tzinfo-0.3.8/tzinfo/definitions/Europe/Belgrade.rb +163 -0
  182. data/lib/active_support/vendor/tzinfo-0.3.8/tzinfo/definitions/Europe/Berlin.rb +188 -0
  183. data/lib/active_support/vendor/tzinfo-0.3.8/tzinfo/definitions/Europe/Bratislava.rb +13 -0
  184. data/lib/active_support/vendor/tzinfo-0.3.8/tzinfo/definitions/Europe/Brussels.rb +232 -0
  185. data/lib/active_support/vendor/tzinfo-0.3.8/tzinfo/definitions/Europe/Bucharest.rb +181 -0
  186. data/lib/active_support/vendor/tzinfo-0.3.8/tzinfo/definitions/Europe/Budapest.rb +197 -0
  187. data/lib/active_support/vendor/tzinfo-0.3.8/tzinfo/definitions/Europe/Copenhagen.rb +179 -0
  188. data/lib/active_support/vendor/tzinfo-0.3.8/tzinfo/definitions/Europe/Dublin.rb +276 -0
  189. data/lib/active_support/vendor/tzinfo-0.3.8/tzinfo/definitions/Europe/Helsinki.rb +163 -0
  190. data/lib/active_support/vendor/tzinfo-0.3.8/tzinfo/definitions/Europe/Istanbul.rb +218 -0
  191. data/lib/active_support/vendor/tzinfo-0.3.8/tzinfo/definitions/Europe/Kiev.rb +168 -0
  192. data/lib/active_support/vendor/tzinfo-0.3.8/tzinfo/definitions/Europe/Lisbon.rb +268 -0
  193. data/lib/active_support/vendor/tzinfo-0.3.8/tzinfo/definitions/Europe/Ljubljana.rb +13 -0
  194. data/lib/active_support/vendor/tzinfo-0.3.8/tzinfo/definitions/Europe/London.rb +288 -0
  195. data/lib/active_support/vendor/tzinfo-0.3.8/tzinfo/definitions/Europe/Madrid.rb +211 -0
  196. data/lib/active_support/vendor/tzinfo-0.3.8/tzinfo/definitions/Europe/Minsk.rb +170 -0
  197. data/lib/active_support/vendor/tzinfo-0.3.8/tzinfo/definitions/Europe/Moscow.rb +181 -0
  198. data/lib/active_support/vendor/tzinfo-0.3.8/tzinfo/definitions/Europe/Paris.rb +232 -0
  199. data/lib/active_support/vendor/tzinfo-0.3.8/tzinfo/definitions/Europe/Prague.rb +187 -0
  200. data/lib/active_support/vendor/tzinfo-0.3.8/tzinfo/definitions/Europe/Riga.rb +176 -0
  201. data/lib/active_support/vendor/tzinfo-0.3.8/tzinfo/definitions/Europe/Rome.rb +215 -0
  202. data/lib/active_support/vendor/tzinfo-0.3.8/tzinfo/definitions/Europe/Sarajevo.rb +13 -0
  203. data/lib/active_support/vendor/tzinfo-0.3.8/tzinfo/definitions/Europe/Skopje.rb +13 -0
  204. data/lib/active_support/vendor/tzinfo-0.3.8/tzinfo/definitions/Europe/Sofia.rb +173 -0
  205. data/lib/active_support/vendor/tzinfo-0.3.8/tzinfo/definitions/Europe/Stockholm.rb +165 -0
  206. data/lib/active_support/vendor/tzinfo-0.3.8/tzinfo/definitions/Europe/Tallinn.rb +172 -0
  207. data/lib/active_support/vendor/tzinfo-0.3.8/tzinfo/definitions/Europe/Vienna.rb +183 -0
  208. data/lib/active_support/vendor/tzinfo-0.3.8/tzinfo/definitions/Europe/Vilnius.rb +170 -0
  209. data/lib/active_support/vendor/tzinfo-0.3.8/tzinfo/definitions/Europe/Warsaw.rb +212 -0
  210. data/lib/active_support/vendor/tzinfo-0.3.8/tzinfo/definitions/Europe/Zagreb.rb +13 -0
  211. data/lib/active_support/vendor/tzinfo-0.3.8/tzinfo/definitions/Pacific/Auckland.rb +202 -0
  212. data/lib/active_support/vendor/tzinfo-0.3.8/tzinfo/definitions/Pacific/Fiji.rb +23 -0
  213. data/lib/active_support/vendor/tzinfo-0.3.8/tzinfo/definitions/Pacific/Guam.rb +22 -0
  214. data/lib/active_support/vendor/tzinfo-0.3.8/tzinfo/definitions/Pacific/Honolulu.rb +28 -0
  215. data/lib/active_support/vendor/tzinfo-0.3.8/tzinfo/definitions/Pacific/Majuro.rb +20 -0
  216. data/lib/active_support/vendor/tzinfo-0.3.8/tzinfo/definitions/Pacific/Midway.rb +25 -0
  217. data/lib/active_support/vendor/tzinfo-0.3.8/tzinfo/definitions/Pacific/Noumea.rb +25 -0
  218. data/lib/active_support/vendor/tzinfo-0.3.8/tzinfo/definitions/Pacific/Pago_Pago.rb +26 -0
  219. data/lib/active_support/vendor/tzinfo-0.3.8/tzinfo/definitions/Pacific/Port_Moresby.rb +20 -0
  220. data/lib/active_support/vendor/tzinfo-0.3.8/tzinfo/definitions/Pacific/Tongatapu.rb +27 -0
  221. data/lib/active_support/vendor/tzinfo-0.3.8/tzinfo/info_timezone.rb +52 -0
  222. data/lib/active_support/vendor/tzinfo-0.3.8/tzinfo/linked_timezone.rb +51 -0
  223. data/lib/active_support/vendor/tzinfo-0.3.8/tzinfo/linked_timezone_info.rb +44 -0
  224. data/lib/active_support/vendor/tzinfo-0.3.8/tzinfo/offset_rationals.rb +95 -0
  225. data/lib/active_support/vendor/tzinfo-0.3.8/tzinfo/time_or_datetime.rb +292 -0
  226. data/lib/active_support/vendor/tzinfo-0.3.8/tzinfo/timezone.rb +508 -0
  227. data/lib/active_support/vendor/tzinfo-0.3.8/tzinfo/timezone_definition.rb +56 -0
  228. data/lib/active_support/vendor/tzinfo-0.3.8/tzinfo/timezone_info.rb +40 -0
  229. data/lib/active_support/vendor/tzinfo-0.3.8/tzinfo/timezone_offset_info.rb +94 -0
  230. data/lib/active_support/vendor/tzinfo-0.3.8/tzinfo/timezone_period.rb +198 -0
  231. data/lib/active_support/vendor/tzinfo-0.3.8/tzinfo/timezone_transition_info.rb +138 -0
  232. data/lib/active_support/version.rb +2 -2
  233. data/lib/active_support/whiny_nil.rb +30 -10
  234. metadata +175 -5
  235. data/lib/active_support/core_ext/rexml.rb +0 -38
  236. data/lib/active_support/testing.rb +0 -1
@@ -0,0 +1,22 @@
1
+ require 'tzinfo/timezone_definition'
2
+
3
+ module TZInfo
4
+ module Definitions
5
+ module Pacific
6
+ module Guam
7
+ include TimezoneDefinition
8
+
9
+ timezone 'Pacific/Guam' do |tz|
10
+ tz.offset :o0, -51660, 0, :LMT
11
+ tz.offset :o1, 34740, 0, :LMT
12
+ tz.offset :o2, 36000, 0, :GST
13
+ tz.offset :o3, 36000, 0, :ChST
14
+
15
+ tz.transition 1844, 12, :o1, 1149567407, 480
16
+ tz.transition 1900, 12, :o2, 1159384847, 480
17
+ tz.transition 2000, 12, :o3, 977493600
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,28 @@
1
+ require 'tzinfo/timezone_definition'
2
+
3
+ module TZInfo
4
+ module Definitions
5
+ module Pacific
6
+ module Honolulu
7
+ include TimezoneDefinition
8
+
9
+ timezone 'Pacific/Honolulu' do |tz|
10
+ tz.offset :o0, -37886, 0, :LMT
11
+ tz.offset :o1, -37800, 0, :HST
12
+ tz.offset :o2, -37800, 3600, :HDT
13
+ tz.offset :o3, -37800, 3600, :HWT
14
+ tz.offset :o4, -37800, 3600, :HPT
15
+ tz.offset :o5, -36000, 0, :HST
16
+
17
+ tz.transition 1900, 1, :o1, 104328926143, 43200
18
+ tz.transition 1933, 4, :o2, 116505265, 48
19
+ tz.transition 1933, 5, :o1, 116506271, 48
20
+ tz.transition 1942, 2, :o3, 116659201, 48
21
+ tz.transition 1945, 8, :o4, 58360379, 24
22
+ tz.transition 1945, 9, :o1, 116722991, 48
23
+ tz.transition 1947, 6, :o5, 116752561, 48
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,20 @@
1
+ require 'tzinfo/timezone_definition'
2
+
3
+ module TZInfo
4
+ module Definitions
5
+ module Pacific
6
+ module Majuro
7
+ include TimezoneDefinition
8
+
9
+ timezone 'Pacific/Majuro' do |tz|
10
+ tz.offset :o0, 41088, 0, :LMT
11
+ tz.offset :o1, 39600, 0, :MHT
12
+ tz.offset :o2, 43200, 0, :MHT
13
+
14
+ tz.transition 1900, 12, :o1, 1086923261, 450
15
+ tz.transition 1969, 9, :o2, 58571881, 24
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,25 @@
1
+ require 'tzinfo/timezone_definition'
2
+
3
+ module TZInfo
4
+ module Definitions
5
+ module Pacific
6
+ module Midway
7
+ include TimezoneDefinition
8
+
9
+ timezone 'Pacific/Midway' do |tz|
10
+ tz.offset :o0, -42568, 0, :LMT
11
+ tz.offset :o1, -39600, 0, :NST
12
+ tz.offset :o2, -39600, 3600, :NDT
13
+ tz.offset :o3, -39600, 0, :BST
14
+ tz.offset :o4, -39600, 0, :SST
15
+
16
+ tz.transition 1901, 1, :o1, 26086168721, 10800
17
+ tz.transition 1956, 6, :o2, 58455071, 24
18
+ tz.transition 1956, 9, :o1, 29228627, 12
19
+ tz.transition 1967, 4, :o3, 58549967, 24
20
+ tz.transition 1983, 11, :o4, 439038000
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,25 @@
1
+ require 'tzinfo/timezone_definition'
2
+
3
+ module TZInfo
4
+ module Definitions
5
+ module Pacific
6
+ module Noumea
7
+ include TimezoneDefinition
8
+
9
+ timezone 'Pacific/Noumea' do |tz|
10
+ tz.offset :o0, 39948, 0, :LMT
11
+ tz.offset :o1, 39600, 0, :NCT
12
+ tz.offset :o2, 39600, 3600, :NCST
13
+
14
+ tz.transition 1912, 1, :o1, 17419781071, 7200
15
+ tz.transition 1977, 12, :o2, 250002000
16
+ tz.transition 1978, 2, :o1, 257342400
17
+ tz.transition 1978, 12, :o2, 281451600
18
+ tz.transition 1979, 2, :o1, 288878400
19
+ tz.transition 1996, 11, :o2, 849366000
20
+ tz.transition 1997, 3, :o1, 857228400
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,26 @@
1
+ require 'tzinfo/timezone_definition'
2
+
3
+ module TZInfo
4
+ module Definitions
5
+ module Pacific
6
+ module Pago_Pago
7
+ include TimezoneDefinition
8
+
9
+ timezone 'Pacific/Pago_Pago' do |tz|
10
+ tz.offset :o0, 45432, 0, :LMT
11
+ tz.offset :o1, -40968, 0, :LMT
12
+ tz.offset :o2, -41400, 0, :SAMT
13
+ tz.offset :o3, -39600, 0, :NST
14
+ tz.offset :o4, -39600, 0, :BST
15
+ tz.offset :o5, -39600, 0, :SST
16
+
17
+ tz.transition 1879, 7, :o1, 2889041969, 1200
18
+ tz.transition 1911, 1, :o2, 2902845569, 1200
19
+ tz.transition 1950, 1, :o3, 116797583, 48
20
+ tz.transition 1967, 4, :o4, 58549967, 24
21
+ tz.transition 1983, 11, :o5, 439038000
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,20 @@
1
+ require 'tzinfo/timezone_definition'
2
+
3
+ module TZInfo
4
+ module Definitions
5
+ module Pacific
6
+ module Port_Moresby
7
+ include TimezoneDefinition
8
+
9
+ timezone 'Pacific/Port_Moresby' do |tz|
10
+ tz.offset :o0, 35320, 0, :LMT
11
+ tz.offset :o1, 35312, 0, :PMMT
12
+ tz.offset :o2, 36000, 0, :PGT
13
+
14
+ tz.transition 1879, 12, :o1, 5200664597, 2160
15
+ tz.transition 1894, 12, :o2, 13031248093, 5400
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,27 @@
1
+ require 'tzinfo/timezone_definition'
2
+
3
+ module TZInfo
4
+ module Definitions
5
+ module Pacific
6
+ module Tongatapu
7
+ include TimezoneDefinition
8
+
9
+ timezone 'Pacific/Tongatapu' do |tz|
10
+ tz.offset :o0, 44360, 0, :LMT
11
+ tz.offset :o1, 44400, 0, :TOT
12
+ tz.offset :o2, 46800, 0, :TOT
13
+ tz.offset :o3, 46800, 3600, :TOST
14
+
15
+ tz.transition 1900, 12, :o1, 5217231571, 2160
16
+ tz.transition 1940, 12, :o2, 174959639, 72
17
+ tz.transition 1999, 10, :o3, 939214800
18
+ tz.transition 2000, 3, :o2, 953384400
19
+ tz.transition 2000, 11, :o3, 973342800
20
+ tz.transition 2001, 1, :o2, 980596800
21
+ tz.transition 2001, 11, :o3, 1004792400
22
+ tz.transition 2002, 1, :o2, 1012046400
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,52 @@
1
+ #--
2
+ # Copyright (c) 2006 Philip Ross
3
+ #
4
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ # of this software and associated documentation files (the "Software"), to deal
6
+ # in the Software without restriction, including without limitation the rights
7
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ # copies of the Software, and to permit persons to whom the Software is
9
+ # furnished to do so, subject to the following conditions:
10
+ #
11
+ # The above copyright notice and this permission notice shall be included in all
12
+ # copies or substantial portions of the Software.
13
+ #
14
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20
+ # THE SOFTWARE.
21
+ #++
22
+
23
+ require 'tzinfo/timezone'
24
+
25
+ module TZInfo
26
+
27
+ # A Timezone based on a TimezoneInfo.
28
+ class InfoTimezone < Timezone #:nodoc:
29
+
30
+ # Constructs a new InfoTimezone with a TimezoneInfo instance.
31
+ def self.new(info)
32
+ tz = super()
33
+ tz.send(:setup, info)
34
+ tz
35
+ end
36
+
37
+ # The identifier of the timezone, e.g. "Europe/Paris".
38
+ def identifier
39
+ @info.identifier
40
+ end
41
+
42
+ protected
43
+ # The TimezoneInfo for this Timezone.
44
+ def info
45
+ @info
46
+ end
47
+
48
+ def setup(info)
49
+ @info = info
50
+ end
51
+ end
52
+ end
@@ -0,0 +1,51 @@
1
+ #--
2
+ # Copyright (c) 2006 Philip Ross
3
+ #
4
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ # of this software and associated documentation files (the "Software"), to deal
6
+ # in the Software without restriction, including without limitation the rights
7
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ # copies of the Software, and to permit persons to whom the Software is
9
+ # furnished to do so, subject to the following conditions:
10
+ #
11
+ # The above copyright notice and this permission notice shall be included in all
12
+ # copies or substantial portions of the Software.
13
+ #
14
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20
+ # THE SOFTWARE.
21
+ #++
22
+
23
+ require 'tzinfo/info_timezone'
24
+
25
+ module TZInfo
26
+
27
+ class LinkedTimezone < InfoTimezone #:nodoc:
28
+ # Returns the TimezonePeriod for the given UTC time. utc can either be
29
+ # a DateTime, Time or integer timestamp (Time.to_i). Any timezone
30
+ # information in utc is ignored (it is treated as a UTC time).
31
+ #
32
+ # If no TimezonePeriod could be found, PeriodNotFound is raised.
33
+ def period_for_utc(utc)
34
+ @linked_timezone.period_for_utc(utc)
35
+ end
36
+
37
+ # Returns the set of TimezonePeriod instances that are valid for the given
38
+ # local time as an array. If you just want a single period, use
39
+ # period_for_local instead and specify how abiguities should be resolved.
40
+ # Raises PeriodNotFound if no periods are found for the given time.
41
+ def periods_for_local(local)
42
+ @linked_timezone.periods_for_local(local)
43
+ end
44
+
45
+ protected
46
+ def setup(info)
47
+ super(info)
48
+ @linked_timezone = Timezone.get(info.link_to_identifier)
49
+ end
50
+ end
51
+ end
@@ -0,0 +1,44 @@
1
+ #--
2
+ # Copyright (c) 2006 Philip Ross
3
+ #
4
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ # of this software and associated documentation files (the "Software"), to deal
6
+ # in the Software without restriction, including without limitation the rights
7
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ # copies of the Software, and to permit persons to whom the Software is
9
+ # furnished to do so, subject to the following conditions:
10
+ #
11
+ # The above copyright notice and this permission notice shall be included in all
12
+ # copies or substantial portions of the Software.
13
+ #
14
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20
+ # THE SOFTWARE.
21
+ #++
22
+
23
+ require 'tzinfo/timezone_info'
24
+
25
+ module TZInfo
26
+ # Represents a linked timezone defined in a data module.
27
+ class LinkedTimezoneInfo < TimezoneInfo #:nodoc:
28
+
29
+ # The zone that provides the data (that this zone is an alias for).
30
+ attr_reader :link_to_identifier
31
+
32
+ # Constructs a new TimezoneInfo with an identifier and the identifier
33
+ # of the zone linked to.
34
+ def initialize(identifier, link_to_identifier)
35
+ super(identifier)
36
+ @link_to_identifier = link_to_identifier
37
+ end
38
+
39
+ # Returns internal object state as a programmer-readable string.
40
+ def inspect
41
+ "#<#{self.class}: #@identifier,#@link_to_identifier>"
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,95 @@
1
+ #--
2
+ # Copyright (c) 2006 Philip Ross
3
+ #
4
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ # of this software and associated documentation files (the "Software"), to deal
6
+ # in the Software without restriction, including without limitation the rights
7
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ # copies of the Software, and to permit persons to whom the Software is
9
+ # furnished to do so, subject to the following conditions:
10
+ #
11
+ # The above copyright notice and this permission notice shall be included in all
12
+ # copies or substantial portions of the Software.
13
+ #
14
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20
+ # THE SOFTWARE.
21
+ #++
22
+
23
+ module TZInfo
24
+
25
+ # Provides a method for getting Rationals for a timezone offset in seconds.
26
+ # Pre-reduced rationals are returned for all the half-hour intervals between
27
+ # -14 and +14 hours to avoid having to call gcd at runtime.
28
+ module OffsetRationals #:nodoc:
29
+ @@rational_cache = {
30
+ -50400 => Rational(-7,12),
31
+ -48600 => Rational(-9,16),
32
+ -46800 => Rational(-13,24),
33
+ -45000 => Rational(-25,48),
34
+ -43200 => Rational(-1,2),
35
+ -41400 => Rational(-23,48),
36
+ -39600 => Rational(-11,24),
37
+ -37800 => Rational(-7,16),
38
+ -36000 => Rational(-5,12),
39
+ -34200 => Rational(-19,48),
40
+ -32400 => Rational(-3,8),
41
+ -30600 => Rational(-17,48),
42
+ -28800 => Rational(-1,3),
43
+ -27000 => Rational(-5,16),
44
+ -25200 => Rational(-7,24),
45
+ -23400 => Rational(-13,48),
46
+ -21600 => Rational(-1,4),
47
+ -19800 => Rational(-11,48),
48
+ -18000 => Rational(-5,24),
49
+ -16200 => Rational(-3,16),
50
+ -14400 => Rational(-1,6),
51
+ -12600 => Rational(-7,48),
52
+ -10800 => Rational(-1,8),
53
+ -9000 => Rational(-5,48),
54
+ -7200 => Rational(-1,12),
55
+ -5400 => Rational(-1,16),
56
+ -3600 => Rational(-1,24),
57
+ -1800 => Rational(-1,48),
58
+ 0 => Rational(0,1),
59
+ 1800 => Rational(1,48),
60
+ 3600 => Rational(1,24),
61
+ 5400 => Rational(1,16),
62
+ 7200 => Rational(1,12),
63
+ 9000 => Rational(5,48),
64
+ 10800 => Rational(1,8),
65
+ 12600 => Rational(7,48),
66
+ 14400 => Rational(1,6),
67
+ 16200 => Rational(3,16),
68
+ 18000 => Rational(5,24),
69
+ 19800 => Rational(11,48),
70
+ 21600 => Rational(1,4),
71
+ 23400 => Rational(13,48),
72
+ 25200 => Rational(7,24),
73
+ 27000 => Rational(5,16),
74
+ 28800 => Rational(1,3),
75
+ 30600 => Rational(17,48),
76
+ 32400 => Rational(3,8),
77
+ 34200 => Rational(19,48),
78
+ 36000 => Rational(5,12),
79
+ 37800 => Rational(7,16),
80
+ 39600 => Rational(11,24),
81
+ 41400 => Rational(23,48),
82
+ 43200 => Rational(1,2),
83
+ 45000 => Rational(25,48),
84
+ 46800 => Rational(13,24),
85
+ 48600 => Rational(9,16),
86
+ 50400 => Rational(7,12)}
87
+
88
+ # Returns a Rational expressing the fraction of a day that offset in
89
+ # seconds represents (i.e. equivalent to Rational(offset, 86400)).
90
+ def rational_for_offset(offset)
91
+ @@rational_cache[offset] || Rational(offset, 86400)
92
+ end
93
+ module_function :rational_for_offset
94
+ end
95
+ end