backbone-deep-rails 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (220) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/lib/backbone/deep/rails/version.rb +1 -1
  4. metadata +18 -245
  5. data/vendor/bundle/cache/activemodel-3.2.11.gem +0 -0
  6. data/vendor/bundle/cache/activesupport-3.2.11.gem +0 -0
  7. data/vendor/bundle/gems/activesupport-3.2.11/CHANGELOG.md +0 -157
  8. data/vendor/bundle/gems/activesupport-3.2.11/MIT-LICENSE +0 -20
  9. data/vendor/bundle/gems/activesupport-3.2.11/README.rdoc +0 -33
  10. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support.rb +0 -82
  11. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/all.rb +0 -3
  12. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/backtrace_cleaner.rb +0 -99
  13. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/base64.rb +0 -54
  14. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/basic_object.rb +0 -21
  15. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/benchmarkable.rb +0 -55
  16. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/buffered_logger.rb +0 -125
  17. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/builder.rb +0 -6
  18. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/cache.rb +0 -638
  19. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/cache/file_store.rb +0 -178
  20. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/cache/mem_cache_store.rb +0 -206
  21. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/cache/memory_store.rb +0 -159
  22. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/cache/null_store.rb +0 -44
  23. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/cache/strategy/local_cache.rb +0 -169
  24. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/callbacks.rb +0 -626
  25. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/concern.rb +0 -131
  26. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/configurable.rb +0 -90
  27. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext.rb +0 -3
  28. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/array.rb +0 -8
  29. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/array/access.rb +0 -46
  30. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/array/conversions.rb +0 -164
  31. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/array/extract_options.rb +0 -29
  32. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/array/grouping.rb +0 -100
  33. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/array/prepend_and_append.rb +0 -7
  34. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/array/random_access.rb +0 -30
  35. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/array/uniq_by.rb +0 -16
  36. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/array/wrap.rb +0 -48
  37. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/benchmark.rb +0 -7
  38. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/big_decimal.rb +0 -1
  39. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/big_decimal/conversions.rb +0 -45
  40. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/class.rb +0 -4
  41. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/class/attribute.rb +0 -115
  42. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/class/attribute_accessors.rb +0 -168
  43. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/class/delegating_attributes.rb +0 -44
  44. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/class/subclasses.rb +0 -36
  45. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/date/acts_like.rb +0 -8
  46. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/date/calculations.rb +0 -276
  47. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/date/conversions.rb +0 -106
  48. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/date/freeze.rb +0 -33
  49. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/date/zones.rb +0 -14
  50. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/date_time/acts_like.rb +0 -13
  51. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/date_time/calculations.rb +0 -143
  52. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/date_time/conversions.rb +0 -103
  53. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/date_time/zones.rb +0 -21
  54. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/enumerable.rb +0 -127
  55. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/exception.rb +0 -3
  56. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/file.rb +0 -2
  57. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/file/atomic.rb +0 -42
  58. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/file/path.rb +0 -5
  59. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/float.rb +0 -1
  60. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/float/rounding.rb +0 -19
  61. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/hash.rb +0 -9
  62. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/hash/conversions.rb +0 -175
  63. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/hash/deep_dup.rb +0 -18
  64. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/hash/deep_merge.rb +0 -21
  65. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/hash/diff.rb +0 -13
  66. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/hash/except.rb +0 -23
  67. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/hash/indifferent_access.rb +0 -24
  68. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/hash/keys.rb +0 -54
  69. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/hash/reverse_merge.rb +0 -23
  70. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/hash/slice.rb +0 -40
  71. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/integer.rb +0 -3
  72. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/integer/inflections.rb +0 -17
  73. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/integer/multiple.rb +0 -10
  74. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/integer/time.rb +0 -39
  75. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/io.rb +0 -15
  76. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/kernel.rb +0 -4
  77. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/kernel/agnostics.rb +0 -11
  78. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/kernel/debugger.rb +0 -10
  79. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/kernel/reporting.rb +0 -93
  80. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/kernel/singleton_class.rb +0 -13
  81. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/load_error.rb +0 -23
  82. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/logger.rb +0 -83
  83. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/module.rb +0 -12
  84. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/module/aliasing.rb +0 -70
  85. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/module/anonymous.rb +0 -24
  86. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/module/attr_internal.rb +0 -39
  87. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/module/attribute_accessors.rb +0 -64
  88. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/module/delegation.rb +0 -153
  89. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/module/deprecation.rb +0 -9
  90. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/module/introspection.rb +0 -88
  91. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/module/method_names.rb +0 -14
  92. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/module/qualified_const.rb +0 -64
  93. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/module/reachable.rb +0 -8
  94. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/module/remove_method.rb +0 -16
  95. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/module/synchronization.rb +0 -45
  96. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/name_error.rb +0 -18
  97. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/numeric.rb +0 -2
  98. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/numeric/bytes.rb +0 -44
  99. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/numeric/time.rb +0 -79
  100. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/object.rb +0 -13
  101. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/object/acts_like.rb +0 -10
  102. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/object/blank.rb +0 -121
  103. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/object/conversions.rb +0 -4
  104. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/object/duplicable.rb +0 -119
  105. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/object/inclusion.rb +0 -25
  106. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/object/instance_variables.rb +0 -33
  107. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/object/to_json.rb +0 -19
  108. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/object/to_param.rb +0 -55
  109. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/object/to_query.rb +0 -27
  110. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/object/try.rb +0 -57
  111. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/object/with_options.rb +0 -43
  112. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/proc.rb +0 -14
  113. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/process.rb +0 -1
  114. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/process/daemon.rb +0 -23
  115. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/range.rb +0 -5
  116. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/range/blockless_step.rb +0 -29
  117. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/range/conversions.rb +0 -21
  118. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/range/cover.rb +0 -3
  119. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/range/include_range.rb +0 -21
  120. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/range/overlaps.rb +0 -8
  121. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/regexp.rb +0 -5
  122. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/rexml.rb +0 -46
  123. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/string.rb +0 -14
  124. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/string/access.rb +0 -99
  125. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/string/behavior.rb +0 -6
  126. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/string/conversions.rb +0 -66
  127. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/string/encoding.rb +0 -11
  128. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/string/exclude.rb +0 -11
  129. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/string/filters.rb +0 -49
  130. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/string/inflections.rb +0 -202
  131. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/string/inquiry.rb +0 -13
  132. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/string/interpolation.rb +0 -2
  133. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/string/multibyte.rb +0 -72
  134. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/string/output_safety.rb +0 -186
  135. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/string/starts_ends_with.rb +0 -4
  136. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/string/strip.rb +0 -26
  137. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/string/xchar.rb +0 -18
  138. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/time/acts_like.rb +0 -8
  139. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/time/calculations.rb +0 -360
  140. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/time/conversions.rb +0 -85
  141. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/time/marshal.rb +0 -57
  142. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/time/publicize_conversion_methods.rb +0 -10
  143. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/time/zones.rb +0 -86
  144. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/core_ext/uri.rb +0 -30
  145. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/dependencies.rb +0 -703
  146. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/dependencies/autoload.rb +0 -50
  147. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/deprecation.rb +0 -18
  148. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/deprecation/behaviors.rb +0 -49
  149. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/deprecation/method_wrappers.rb +0 -29
  150. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/deprecation/proxy_wrappers.rb +0 -81
  151. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/deprecation/reporting.rb +0 -65
  152. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/descendants_tracker.rb +0 -45
  153. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/duration.rb +0 -110
  154. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/file_update_checker.rb +0 -121
  155. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/file_watcher.rb +0 -36
  156. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/gzip.rb +0 -30
  157. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/hash_with_indifferent_access.rb +0 -178
  158. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/i18n.rb +0 -9
  159. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/i18n_railtie.rb +0 -102
  160. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/inflections.rb +0 -63
  161. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/inflector.rb +0 -7
  162. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/inflector/inflections.rb +0 -174
  163. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/inflector/methods.rb +0 -321
  164. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/inflector/transliterate.rb +0 -98
  165. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/json.rb +0 -2
  166. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/json/decoding.rb +0 -79
  167. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/json/encoding.rb +0 -284
  168. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/json/variable.rb +0 -9
  169. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/lazy_load_hooks.rb +0 -46
  170. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/locale/en.yml +0 -36
  171. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/log_subscriber.rb +0 -122
  172. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/log_subscriber/test_helper.rb +0 -101
  173. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/memoizable.rb +0 -116
  174. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/message_encryptor.rb +0 -103
  175. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/message_verifier.rb +0 -74
  176. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/multibyte.rb +0 -44
  177. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/multibyte/chars.rb +0 -476
  178. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/multibyte/exceptions.rb +0 -8
  179. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/multibyte/unicode.rb +0 -393
  180. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/multibyte/utils.rb +0 -60
  181. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/notifications.rb +0 -154
  182. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/notifications/fanout.rb +0 -61
  183. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/notifications/instrumenter.rb +0 -53
  184. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/option_merger.rb +0 -25
  185. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/ordered_hash.rb +0 -222
  186. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/ordered_options.rb +0 -61
  187. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/railtie.rb +0 -59
  188. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/rescuable.rb +0 -115
  189. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/ruby/shim.rb +0 -22
  190. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/string_inquirer.rb +0 -21
  191. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/tagged_logging.rb +0 -80
  192. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/test_case.rb +0 -34
  193. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/testing/assertions.rb +0 -97
  194. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/testing/declarative.rb +0 -40
  195. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/testing/deprecation.rb +0 -55
  196. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/testing/isolation.rb +0 -157
  197. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/testing/mochaing.rb +0 -7
  198. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/testing/pending.rb +0 -52
  199. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/testing/performance.rb +0 -317
  200. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/testing/performance/jruby.rb +0 -115
  201. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/testing/performance/rubinius.rb +0 -113
  202. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/testing/performance/ruby.rb +0 -152
  203. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/testing/performance/ruby/mri.rb +0 -57
  204. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/testing/performance/ruby/yarv.rb +0 -57
  205. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/testing/setup_and_teardown.rb +0 -118
  206. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/time.rb +0 -35
  207. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/time/autoload.rb +0 -5
  208. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/time_with_zone.rb +0 -358
  209. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/values/time_zone.rb +0 -397
  210. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/values/unicode_tables.dat +0 -0
  211. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/version.rb +0 -10
  212. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/whiny_nil.rb +0 -24
  213. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/xml_mini.rb +0 -168
  214. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/xml_mini/jdom.rb +0 -175
  215. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/xml_mini/libxml.rb +0 -80
  216. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/xml_mini/libxmlsax.rb +0 -86
  217. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/xml_mini/nokogiri.rb +0 -84
  218. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/xml_mini/nokogirisax.rb +0 -88
  219. data/vendor/bundle/gems/activesupport-3.2.11/lib/active_support/xml_mini/rexml.rb +0 -130
  220. data/vendor/bundle/specifications/activesupport-3.2.11.gemspec +0 -33
@@ -1,44 +0,0 @@
1
- module ActiveSupport
2
- module Cache
3
- # A cache store implementation which doesn't actually store anything. Useful in
4
- # development and test environments where you don't want caching turned on but
5
- # need to go through the caching interface.
6
- #
7
- # This cache does implement the local cache strategy, so values will actually
8
- # be cached inside blocks that utilize this strategy. See
9
- # ActiveSupport::Cache::Strategy::LocalCache for more details.
10
- class NullStore < Store
11
- def initialize(options = nil)
12
- super(options)
13
- extend Strategy::LocalCache
14
- end
15
-
16
- def clear(options = nil)
17
- end
18
-
19
- def cleanup(options = nil)
20
- end
21
-
22
- def increment(name, amount = 1, options = nil)
23
- end
24
-
25
- def decrement(name, amount = 1, options = nil)
26
- end
27
-
28
- def delete_matched(matcher, options = nil)
29
- end
30
-
31
- protected
32
- def read_entry(key, options) # :nodoc:
33
- end
34
-
35
- def write_entry(key, entry, options) # :nodoc:
36
- true
37
- end
38
-
39
- def delete_entry(key, options) # :nodoc:
40
- false
41
- end
42
- end
43
- end
44
- end
@@ -1,169 +0,0 @@
1
- require 'active_support/core_ext/object/duplicable'
2
- require 'active_support/core_ext/string/inflections'
3
-
4
- module ActiveSupport
5
- module Cache
6
- module Strategy
7
- # Caches that implement LocalCache will be backed by an in-memory cache for the
8
- # duration of a block. Repeated calls to the cache for the same key will hit the
9
- # in-memory cache for faster access.
10
- module LocalCache
11
- # Simple memory backed cache. This cache is not thread safe and is intended only
12
- # for serving as a temporary memory cache for a single thread.
13
- class LocalStore < Store
14
- def initialize
15
- super
16
- @data = {}
17
- end
18
-
19
- # Don't allow synchronizing since it isn't thread safe,
20
- def synchronize # :nodoc:
21
- yield
22
- end
23
-
24
- def clear(options = nil)
25
- @data.clear
26
- end
27
-
28
- def read_entry(key, options)
29
- @data[key]
30
- end
31
-
32
- def write_entry(key, value, options)
33
- @data[key] = value
34
- true
35
- end
36
-
37
- def delete_entry(key, options)
38
- !!@data.delete(key)
39
- end
40
- end
41
-
42
- # Use a local cache for the duration of block.
43
- def with_local_cache
44
- save_val = Thread.current[thread_local_key]
45
- begin
46
- Thread.current[thread_local_key] = LocalStore.new
47
- yield
48
- ensure
49
- Thread.current[thread_local_key] = save_val
50
- end
51
- end
52
-
53
- #--
54
- # This class wraps up local storage for middlewares. Only the middleware method should
55
- # construct them.
56
- class Middleware # :nodoc:
57
- attr_reader :name, :thread_local_key
58
-
59
- def initialize(name, thread_local_key)
60
- @name = name
61
- @thread_local_key = thread_local_key
62
- @app = nil
63
- end
64
-
65
- def new(app)
66
- @app = app
67
- self
68
- end
69
-
70
- def call(env)
71
- Thread.current[thread_local_key] = LocalStore.new
72
- @app.call(env)
73
- ensure
74
- Thread.current[thread_local_key] = nil
75
- end
76
- end
77
-
78
- # Middleware class can be inserted as a Rack handler to be local cache for the
79
- # duration of request.
80
- def middleware
81
- @middleware ||= Middleware.new(
82
- "ActiveSupport::Cache::Strategy::LocalCache",
83
- thread_local_key)
84
- end
85
-
86
- def clear(options = nil) # :nodoc:
87
- local_cache.clear(options) if local_cache
88
- super
89
- end
90
-
91
- def cleanup(options = nil) # :nodoc:
92
- local_cache.clear(options) if local_cache
93
- super
94
- end
95
-
96
- def increment(name, amount = 1, options = nil) # :nodoc:
97
- value = bypass_local_cache{super}
98
- if local_cache
99
- local_cache.mute do
100
- if value
101
- local_cache.write(name, value, options)
102
- else
103
- local_cache.delete(name, options)
104
- end
105
- end
106
- end
107
- value
108
- end
109
-
110
- def decrement(name, amount = 1, options = nil) # :nodoc:
111
- value = bypass_local_cache{super}
112
- if local_cache
113
- local_cache.mute do
114
- if value
115
- local_cache.write(name, value, options)
116
- else
117
- local_cache.delete(name, options)
118
- end
119
- end
120
- end
121
- value
122
- end
123
-
124
- protected
125
- def read_entry(key, options) # :nodoc:
126
- if local_cache
127
- entry = local_cache.read_entry(key, options)
128
- unless entry
129
- entry = super
130
- local_cache.write_entry(key, entry, options)
131
- end
132
- entry
133
- else
134
- super
135
- end
136
- end
137
-
138
- def write_entry(key, entry, options) # :nodoc:
139
- local_cache.write_entry(key, entry, options) if local_cache
140
- super
141
- end
142
-
143
- def delete_entry(key, options) # :nodoc:
144
- local_cache.delete_entry(key, options) if local_cache
145
- super
146
- end
147
-
148
- private
149
- def thread_local_key
150
- @thread_local_key ||= "#{self.class.name.underscore}_local_cache_#{object_id}".gsub(/[\/-]/, '_').to_sym
151
- end
152
-
153
- def local_cache
154
- Thread.current[thread_local_key]
155
- end
156
-
157
- def bypass_local_cache
158
- save_cache = Thread.current[thread_local_key]
159
- begin
160
- Thread.current[thread_local_key] = nil
161
- yield
162
- ensure
163
- Thread.current[thread_local_key] = save_cache
164
- end
165
- end
166
- end
167
- end
168
- end
169
- end
@@ -1,626 +0,0 @@
1
- require 'active_support/concern'
2
- require 'active_support/descendants_tracker'
3
- require 'active_support/core_ext/array/wrap'
4
- require 'active_support/core_ext/class/attribute'
5
- require 'active_support/core_ext/kernel/reporting'
6
- require 'active_support/core_ext/kernel/singleton_class'
7
- require 'active_support/core_ext/object/inclusion'
8
-
9
- module ActiveSupport
10
- # \Callbacks are code hooks that are run at key points in an object's lifecycle.
11
- # The typical use case is to have a base class define a set of callbacks relevant
12
- # to the other functionality it supplies, so that subclasses can install callbacks
13
- # that enhance or modify the base functionality without needing to override
14
- # or redefine methods of the base class.
15
- #
16
- # Mixing in this module allows you to define the events in the object's lifecycle
17
- # that will support callbacks (via +ClassMethods.define_callbacks+), set the instance
18
- # methods, procs, or callback objects to be called (via +ClassMethods.set_callback+),
19
- # and run the installed callbacks at the appropriate times (via +run_callbacks+).
20
- #
21
- # Three kinds of callbacks are supported: before callbacks, run before a certain event;
22
- # after callbacks, run after the event; and around callbacks, blocks that surround the
23
- # event, triggering it when they yield. Callback code can be contained in instance
24
- # methods, procs or lambdas, or callback objects that respond to certain predetermined
25
- # methods. See +ClassMethods.set_callback+ for details.
26
- #
27
- # ==== Example
28
- #
29
- # class Record
30
- # include ActiveSupport::Callbacks
31
- # define_callbacks :save
32
- #
33
- # def save
34
- # run_callbacks :save do
35
- # puts "- save"
36
- # end
37
- # end
38
- # end
39
- #
40
- # class PersonRecord < Record
41
- # set_callback :save, :before, :saving_message
42
- # def saving_message
43
- # puts "saving..."
44
- # end
45
- #
46
- # set_callback :save, :after do |object|
47
- # puts "saved"
48
- # end
49
- # end
50
- #
51
- # person = PersonRecord.new
52
- # person.save
53
- #
54
- # Output:
55
- # saving...
56
- # - save
57
- # saved
58
- #
59
- module Callbacks
60
- extend Concern
61
-
62
- included do
63
- extend ActiveSupport::DescendantsTracker
64
- end
65
-
66
- # Runs the callbacks for the given event.
67
- #
68
- # Calls the before and around callbacks in the order they were set, yields
69
- # the block (if given one), and then runs the after callbacks in reverse order.
70
- # Optionally accepts a key, which will be used to compile an optimized callback
71
- # method for each key. See +ClassMethods.define_callbacks+ for more information.
72
- #
73
- # If the callback chain was halted, returns +false+. Otherwise returns the result
74
- # of the block, or +true+ if no block is given.
75
- #
76
- # run_callbacks :save do
77
- # save
78
- # end
79
- #
80
- def run_callbacks(kind, *args, &block)
81
- send("_run_#{kind}_callbacks", *args, &block)
82
- end
83
-
84
- private
85
-
86
- # A hook invoked everytime a before callback is halted.
87
- # This can be overriden in AS::Callback implementors in order
88
- # to provide better debugging/logging.
89
- def halted_callback_hook(filter)
90
- end
91
-
92
- class Callback #:nodoc:#
93
- @@_callback_sequence = 0
94
-
95
- attr_accessor :chain, :filter, :kind, :options, :per_key, :klass, :raw_filter
96
-
97
- def initialize(chain, filter, kind, options, klass)
98
- @chain, @kind, @klass = chain, kind, klass
99
- normalize_options!(options)
100
-
101
- @per_key = options.delete(:per_key)
102
- @raw_filter, @options = filter, options
103
- @filter = _compile_filter(filter)
104
- @compiled_options = _compile_options(options)
105
- @callback_id = next_id
106
-
107
- _compile_per_key_options
108
- end
109
-
110
- def clone(chain, klass)
111
- obj = super()
112
- obj.chain = chain
113
- obj.klass = klass
114
- obj.per_key = @per_key.dup
115
- obj.options = @options.dup
116
- obj.per_key[:if] = @per_key[:if].dup
117
- obj.per_key[:unless] = @per_key[:unless].dup
118
- obj.options[:if] = @options[:if].dup
119
- obj.options[:unless] = @options[:unless].dup
120
- obj
121
- end
122
-
123
- def normalize_options!(options)
124
- options[:if] = Array.wrap(options[:if])
125
- options[:unless] = Array.wrap(options[:unless])
126
-
127
- options[:per_key] ||= {}
128
- options[:per_key][:if] = Array.wrap(options[:per_key][:if])
129
- options[:per_key][:unless] = Array.wrap(options[:per_key][:unless])
130
- end
131
-
132
- def name
133
- chain.name
134
- end
135
-
136
- def next_id
137
- @@_callback_sequence += 1
138
- end
139
-
140
- def matches?(_kind, _filter)
141
- @kind == _kind && @filter == _filter
142
- end
143
-
144
- def _update_filter(filter_options, new_options)
145
- filter_options[:if].push(new_options[:unless]) if new_options.key?(:unless)
146
- filter_options[:unless].push(new_options[:if]) if new_options.key?(:if)
147
- end
148
-
149
- def recompile!(_options, _per_key)
150
- _update_filter(self.options, _options)
151
- _update_filter(self.per_key, _per_key)
152
-
153
- @callback_id = next_id
154
- @filter = _compile_filter(@raw_filter)
155
- @compiled_options = _compile_options(@options)
156
- _compile_per_key_options
157
- end
158
-
159
- def _compile_per_key_options
160
- key_options = _compile_options(@per_key)
161
-
162
- @klass.class_eval <<-RUBY_EVAL, __FILE__, __LINE__ + 1
163
- def _one_time_conditions_valid_#{@callback_id}?
164
- true if #{key_options}
165
- end
166
- RUBY_EVAL
167
- end
168
-
169
- # This will supply contents for before and around filters, and no
170
- # contents for after filters (for the forward pass).
171
- def start(key=nil, object=nil)
172
- return if key && !object.send("_one_time_conditions_valid_#{@callback_id}?")
173
-
174
- # options[0] is the compiled form of supplied conditions
175
- # options[1] is the "end" for the conditional
176
- #
177
- case @kind
178
- when :before
179
- # if condition # before_save :filter_name, :if => :condition
180
- # filter_name
181
- # end
182
- <<-RUBY_EVAL
183
- if !halted && #{@compiled_options}
184
- # This double assignment is to prevent warnings in 1.9.3 as
185
- # the `result` variable is not always used except if the
186
- # terminator code refers to it.
187
- result = result = #{@filter}
188
- halted = (#{chain.config[:terminator]})
189
- if halted
190
- halted_callback_hook(#{@raw_filter.inspect.inspect})
191
- end
192
- end
193
- RUBY_EVAL
194
- when :around
195
- # Compile around filters with conditions into proxy methods
196
- # that contain the conditions.
197
- #
198
- # For `around_save :filter_name, :if => :condition':
199
- #
200
- # def _conditional_callback_save_17
201
- # if condition
202
- # filter_name do
203
- # yield self
204
- # end
205
- # else
206
- # yield self
207
- # end
208
- # end
209
- #
210
- name = "_conditional_callback_#{@kind}_#{next_id}"
211
- @klass.class_eval <<-RUBY_EVAL, __FILE__, __LINE__ + 1
212
- def #{name}(halted)
213
- if #{@compiled_options} && !halted
214
- #{@filter} do
215
- yield self
216
- end
217
- else
218
- yield self
219
- end
220
- end
221
- RUBY_EVAL
222
- "#{name}(halted) do"
223
- end
224
- end
225
-
226
- # This will supply contents for around and after filters, but not
227
- # before filters (for the backward pass).
228
- def end(key=nil, object=nil)
229
- return if key && !object.send("_one_time_conditions_valid_#{@callback_id}?")
230
-
231
- case @kind
232
- when :after
233
- # after_save :filter_name, :if => :condition
234
- <<-RUBY_EVAL
235
- if #{@compiled_options}
236
- #{@filter}
237
- end
238
- RUBY_EVAL
239
- when :around
240
- <<-RUBY_EVAL
241
- value
242
- end
243
- RUBY_EVAL
244
- end
245
- end
246
-
247
- private
248
-
249
- # Options support the same options as filters themselves (and support
250
- # symbols, string, procs, and objects), so compile a conditional
251
- # expression based on the options
252
- def _compile_options(options)
253
- conditions = ["true"]
254
-
255
- unless options[:if].empty?
256
- conditions << Array.wrap(_compile_filter(options[:if]))
257
- end
258
-
259
- unless options[:unless].empty?
260
- conditions << Array.wrap(_compile_filter(options[:unless])).map {|f| "!#{f}"}
261
- end
262
-
263
- conditions.flatten.join(" && ")
264
- end
265
-
266
- # Filters support:
267
- #
268
- # Arrays:: Used in conditions. This is used to specify
269
- # multiple conditions. Used internally to
270
- # merge conditions from skip_* filters
271
- # Symbols:: A method to call
272
- # Strings:: Some content to evaluate
273
- # Procs:: A proc to call with the object
274
- # Objects:: An object with a before_foo method on it to call
275
- #
276
- # All of these objects are compiled into methods and handled
277
- # the same after this point:
278
- #
279
- # Arrays:: Merged together into a single filter
280
- # Symbols:: Already methods
281
- # Strings:: class_eval'ed into methods
282
- # Procs:: define_method'ed into methods
283
- # Objects::
284
- # a method is created that calls the before_foo method
285
- # on the object.
286
- #
287
- def _compile_filter(filter)
288
- method_name = "_callback_#{@kind}_#{next_id}"
289
- case filter
290
- when Array
291
- filter.map {|f| _compile_filter(f)}
292
- when Symbol
293
- filter
294
- when String
295
- "(#{filter})"
296
- when Proc
297
- @klass.send(:define_method, method_name, &filter)
298
- return method_name if filter.arity <= 0
299
-
300
- method_name << (filter.arity == 1 ? "(self)" : " self, Proc.new ")
301
- else
302
- @klass.send(:define_method, "#{method_name}_object") { filter }
303
-
304
- _normalize_legacy_filter(kind, filter)
305
- scopes = Array.wrap(chain.config[:scope])
306
- method_to_call = scopes.map{ |s| s.is_a?(Symbol) ? send(s) : s }.join("_")
307
-
308
- @klass.class_eval <<-RUBY_EVAL, __FILE__, __LINE__ + 1
309
- def #{method_name}(&blk)
310
- #{method_name}_object.send(:#{method_to_call}, self, &blk)
311
- end
312
- RUBY_EVAL
313
-
314
- method_name
315
- end
316
- end
317
-
318
- def _normalize_legacy_filter(kind, filter)
319
- if !filter.respond_to?(kind) && filter.respond_to?(:filter)
320
- filter.singleton_class.class_eval <<-RUBY_EVAL, __FILE__, __LINE__ + 1
321
- def #{kind}(context, &block) filter(context, &block) end
322
- RUBY_EVAL
323
- elsif filter.respond_to?(:before) && filter.respond_to?(:after) && kind == :around
324
- def filter.around(context)
325
- should_continue = before(context)
326
- yield if should_continue
327
- after(context)
328
- end
329
- end
330
- end
331
- end
332
-
333
- # An Array with a compile method
334
- class CallbackChain < Array #:nodoc:#
335
- attr_reader :name, :config
336
-
337
- def initialize(name, config)
338
- @name = name
339
- @config = {
340
- :terminator => "false",
341
- :rescuable => false,
342
- :scope => [ :kind ]
343
- }.merge(config)
344
- end
345
-
346
- def compile(key=nil, object=nil)
347
- method = []
348
- method << "value = nil"
349
- method << "halted = false"
350
-
351
- each do |callback|
352
- method << callback.start(key, object)
353
- end
354
-
355
- if config[:rescuable]
356
- method << "rescued_error = nil"
357
- method << "begin"
358
- end
359
-
360
- method << "value = yield if block_given? && !halted"
361
-
362
- if config[:rescuable]
363
- method << "rescue Exception => e"
364
- method << "rescued_error = e"
365
- method << "end"
366
- end
367
-
368
- reverse_each do |callback|
369
- method << callback.end(key, object)
370
- end
371
-
372
- method << "raise rescued_error if rescued_error" if config[:rescuable]
373
- method << "halted ? false : (block_given? ? value : true)"
374
- method.compact.join("\n")
375
- end
376
- end
377
-
378
- module ClassMethods
379
- # Generate the internal runner method called by +run_callbacks+.
380
- def __define_runner(symbol) #:nodoc:
381
- runner_method = "_run_#{symbol}_callbacks"
382
- unless private_method_defined?(runner_method)
383
- class_eval <<-RUBY_EVAL, __FILE__, __LINE__ + 1
384
- def #{runner_method}(key = nil, &blk)
385
- self.class.__run_callback(key, :#{symbol}, self, &blk)
386
- end
387
- private :#{runner_method}
388
- RUBY_EVAL
389
- end
390
- end
391
-
392
- # This method calls the callback method for the given key.
393
- # If this called first time it creates a new callback method for the key,
394
- # calculating which callbacks can be omitted because of per_key conditions.
395
- #
396
- def __run_callback(key, kind, object, &blk) #:nodoc:
397
- name = __callback_runner_name(key, kind)
398
- unless object.respond_to?(name, true)
399
- str = object.send("_#{kind}_callbacks").compile(key, object)
400
- class_eval <<-RUBY_EVAL, __FILE__, __LINE__ + 1
401
- def #{name}() #{str} end
402
- protected :#{name}
403
- RUBY_EVAL
404
- end
405
- object.send(name, &blk)
406
- end
407
-
408
- def __reset_runner(symbol)
409
- name = __callback_runner_name(nil, symbol)
410
- undef_method(name) if method_defined?(name)
411
- end
412
-
413
- def __callback_runner_name(key, kind)
414
- "_run__#{self.name.hash.abs}__#{kind}__#{key.hash.abs}__callbacks"
415
- end
416
-
417
- # This is used internally to append, prepend and skip callbacks to the
418
- # CallbackChain.
419
- #
420
- def __update_callbacks(name, filters = [], block = nil) #:nodoc:
421
- type = filters.first.in?([:before, :after, :around]) ? filters.shift : :before
422
- options = filters.last.is_a?(Hash) ? filters.pop : {}
423
- filters.unshift(block) if block
424
-
425
- ([self] + ActiveSupport::DescendantsTracker.descendants(self)).reverse.each do |target|
426
- chain = target.send("_#{name}_callbacks")
427
- yield target, chain.dup, type, filters, options
428
- target.__reset_runner(name)
429
- end
430
- end
431
-
432
- # Install a callback for the given event.
433
- #
434
- # set_callback :save, :before, :before_meth
435
- # set_callback :save, :after, :after_meth, :if => :condition
436
- # set_callback :save, :around, lambda { |r| stuff; result = yield; stuff }
437
- #
438
- # The second arguments indicates whether the callback is to be run +:before+,
439
- # +:after+, or +:around+ the event. If omitted, +:before+ is assumed. This
440
- # means the first example above can also be written as:
441
- #
442
- # set_callback :save, :before_meth
443
- #
444
- # The callback can specified as a symbol naming an instance method; as a proc,
445
- # lambda, or block; as a string to be instance evaluated; or as an object that
446
- # responds to a certain method determined by the <tt>:scope</tt> argument to
447
- # +define_callback+.
448
- #
449
- # If a proc, lambda, or block is given, its body is evaluated in the context
450
- # of the current object. It can also optionally accept the current object as
451
- # an argument.
452
- #
453
- # Before and around callbacks are called in the order that they are set; after
454
- # callbacks are called in the reverse order.
455
- #
456
- # Around callbacks can access the return value from the event, if it
457
- # wasn't halted, from the +yield+ call.
458
- #
459
- # ===== Options
460
- #
461
- # * <tt>:if</tt> - A symbol naming an instance method or a proc; the callback
462
- # will be called only when it returns a true value.
463
- # * <tt>:unless</tt> - A symbol naming an instance method or a proc; the callback
464
- # will be called only when it returns a false value.
465
- # * <tt>:prepend</tt> - If true, the callback will be prepended to the existing
466
- # chain rather than appended.
467
- # * <tt>:per_key</tt> - A hash with <tt>:if</tt> and <tt>:unless</tt> options;
468
- # see "Per-key conditions" below.
469
- #
470
- # ===== Per-key conditions
471
- #
472
- # When creating or skipping callbacks, you can specify conditions that
473
- # are always the same for a given key. For instance, in Action Pack,
474
- # we convert :only and :except conditions into per-key conditions.
475
- #
476
- # before_filter :authenticate, :except => "index"
477
- #
478
- # becomes
479
- #
480
- # set_callback :process_action, :before, :authenticate, :per_key => {:unless => proc {|c| c.action_name == "index"}}
481
- #
482
- # Per-key conditions are evaluated only once per use of a given key.
483
- # In the case of the above example, you would do:
484
- #
485
- # run_callbacks(:process_action, action_name) { ... dispatch stuff ... }
486
- #
487
- # In that case, each action_name would get its own compiled callback
488
- # method that took into consideration the per_key conditions. This
489
- # is a speed improvement for ActionPack.
490
- #
491
- def set_callback(name, *filter_list, &block)
492
- mapped = nil
493
-
494
- __update_callbacks(name, filter_list, block) do |target, chain, type, filters, options|
495
- mapped ||= filters.map do |filter|
496
- Callback.new(chain, filter, type, options.dup, self)
497
- end
498
-
499
- filters.each do |filter|
500
- chain.delete_if {|c| c.matches?(type, filter) }
501
- end
502
-
503
- options[:prepend] ? chain.unshift(*(mapped.reverse)) : chain.push(*mapped)
504
-
505
- target.send("_#{name}_callbacks=", chain)
506
- end
507
- end
508
-
509
- # Skip a previously set callback. Like +set_callback+, <tt>:if</tt> or <tt>:unless</tt>
510
- # options may be passed in order to control when the callback is skipped.
511
- #
512
- # class Writer < Person
513
- # skip_callback :validate, :before, :check_membership, :if => lambda { self.age > 18 }
514
- # end
515
- #
516
- def skip_callback(name, *filter_list, &block)
517
- __update_callbacks(name, filter_list, block) do |target, chain, type, filters, options|
518
- filters.each do |filter|
519
- filter = chain.find {|c| c.matches?(type, filter) }
520
-
521
- if filter && options.any?
522
- new_filter = filter.clone(chain, self)
523
- chain.insert(chain.index(filter), new_filter)
524
- new_filter.recompile!(options, options[:per_key] || {})
525
- end
526
-
527
- chain.delete(filter)
528
- end
529
- target.send("_#{name}_callbacks=", chain)
530
- end
531
- end
532
-
533
- # Remove all set callbacks for the given event.
534
- #
535
- def reset_callbacks(symbol)
536
- callbacks = send("_#{symbol}_callbacks")
537
-
538
- ActiveSupport::DescendantsTracker.descendants(self).each do |target|
539
- chain = target.send("_#{symbol}_callbacks").dup
540
- callbacks.each { |c| chain.delete(c) }
541
- target.send("_#{symbol}_callbacks=", chain)
542
- target.__reset_runner(symbol)
543
- end
544
-
545
- self.send("_#{symbol}_callbacks=", callbacks.dup.clear)
546
-
547
- __reset_runner(symbol)
548
- end
549
-
550
- # Define sets of events in the object lifecycle that support callbacks.
551
- #
552
- # define_callbacks :validate
553
- # define_callbacks :initialize, :save, :destroy
554
- #
555
- # ===== Options
556
- #
557
- # * <tt>:terminator</tt> - Determines when a before filter will halt the callback
558
- # chain, preventing following callbacks from being called and the event from being
559
- # triggered. This is a string to be eval'ed. The result of the callback is available
560
- # in the <tt>result</tt> variable.
561
- #
562
- # define_callbacks :validate, :terminator => "result == false"
563
- #
564
- # In this example, if any before validate callbacks returns +false+,
565
- # other callbacks are not executed. Defaults to "false", meaning no value
566
- # halts the chain.
567
- #
568
- # * <tt>:rescuable</tt> - By default, after filters are not executed if
569
- # the given block or a before filter raises an error. By setting this option
570
- # to <tt>true</tt> exception raised by given block is stored and after
571
- # executing all the after callbacks the stored exception is raised.
572
- #
573
- # * <tt>:scope</tt> - Indicates which methods should be executed when an object
574
- # is used as a callback.
575
- #
576
- # class Audit
577
- # def before(caller)
578
- # puts 'Audit: before is called'
579
- # end
580
- #
581
- # def before_save(caller)
582
- # puts 'Audit: before_save is called'
583
- # end
584
- # end
585
- #
586
- # class Account
587
- # include ActiveSupport::Callbacks
588
- #
589
- # define_callbacks :save
590
- # set_callback :save, :before, Audit.new
591
- #
592
- # def save
593
- # run_callbacks :save do
594
- # puts 'save in main'
595
- # end
596
- # end
597
- # end
598
- #
599
- # In the above case whenever you save an account the method <tt>Audit#before</tt> will
600
- # be called. On the other hand
601
- #
602
- # define_callbacks :save, :scope => [:kind, :name]
603
- #
604
- # would trigger <tt>Audit#before_save</tt> instead. That's constructed by calling
605
- # <tt>#{kind}_#{name}</tt> on the given instance. In this case "kind" is "before" and
606
- # "name" is "save". In this context +:kind+ and +:name+ have special meanings: +:kind+
607
- # refers to the kind of callback (before/after/around) and +:name+ refers to the
608
- # method on which callbacks are being defined.
609
- #
610
- # A declaration like
611
- #
612
- # define_callbacks :save, :scope => [:name]
613
- #
614
- # would call <tt>Audit#save</tt>.
615
- #
616
- def define_callbacks(*callbacks)
617
- config = callbacks.last.is_a?(Hash) ? callbacks.pop : {}
618
- callbacks.each do |callback|
619
- class_attribute "_#{callback}_callbacks"
620
- send("_#{callback}_callbacks=", CallbackChain.new(callback, config))
621
- __define_runner(callback)
622
- end
623
- end
624
- end
625
- end
626
- end