axiom 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (531) hide show
  1. data/.gitignore +1 -1
  2. data/.rspec +1 -0
  3. data/.ruby-gemset +1 -0
  4. data/.travis.yml +11 -20
  5. data/Gemfile +5 -2
  6. data/Gemfile.devtools +26 -28
  7. data/Guardfile +18 -9
  8. data/README.md +20 -39
  9. data/axiom.gemspec +17 -18
  10. data/benchmarks/memory.rb +14 -14
  11. data/benchmarks/speed.rb +14 -14
  12. data/config/devtools.yml +2 -0
  13. data/config/flay.yml +1 -1
  14. data/config/flog.yml +1 -1
  15. data/config/reek.yml +3 -3
  16. data/config/rubocop.yml +62 -0
  17. data/lib/axiom.rb +17 -20
  18. data/lib/axiom/aggregate.rb +2 -5
  19. data/lib/axiom/aggregate/count.rb +4 -4
  20. data/lib/axiom/aggregate/maximum.rb +3 -3
  21. data/lib/axiom/aggregate/mean.rb +9 -9
  22. data/lib/axiom/aggregate/minimum.rb +3 -3
  23. data/lib/axiom/aggregate/standard_deviation.rb +5 -4
  24. data/lib/axiom/aggregate/sum.rb +4 -4
  25. data/lib/axiom/aggregate/variance.rb +15 -12
  26. data/lib/axiom/algebra/extension.rb +2 -2
  27. data/lib/axiom/algebra/projection.rb +3 -3
  28. data/lib/axiom/algebra/rename/aliases.rb +6 -6
  29. data/lib/axiom/algebra/restriction.rb +1 -1
  30. data/lib/axiom/algebra/summarization.rb +5 -7
  31. data/lib/axiom/algebra/summarization/summaries.rb +2 -2
  32. data/lib/axiom/algebra/union.rb +1 -1
  33. data/lib/axiom/attribute.rb +24 -33
  34. data/lib/axiom/attribute/boolean.rb +10 -20
  35. data/lib/axiom/attribute/class.rb +5 -5
  36. data/lib/axiom/attribute/date.rb +5 -19
  37. data/lib/axiom/attribute/date_time.rb +5 -19
  38. data/lib/axiom/attribute/decimal.rb +5 -5
  39. data/lib/axiom/attribute/float.rb +5 -7
  40. data/lib/axiom/attribute/integer.rb +5 -5
  41. data/lib/axiom/attribute/numeric.rb +15 -39
  42. data/lib/axiom/attribute/object.rb +5 -5
  43. data/lib/axiom/attribute/string.rb +16 -63
  44. data/lib/axiom/attribute/time.rb +5 -19
  45. data/lib/axiom/function.rb +14 -2
  46. data/lib/axiom/function/binary.rb +17 -0
  47. data/lib/axiom/function/connective.rb +6 -3
  48. data/lib/axiom/function/connective/conjunction.rb +2 -2
  49. data/lib/axiom/function/connective/disjunction.rb +2 -2
  50. data/lib/axiom/function/numeric.rb +13 -0
  51. data/lib/axiom/function/numeric/absolute.rb +1 -1
  52. data/lib/axiom/function/numeric/division.rb +18 -2
  53. data/lib/axiom/function/numeric/exponentiation.rb +1 -1
  54. data/lib/axiom/function/numeric/modulo.rb +1 -1
  55. data/lib/axiom/function/numeric/square_root.rb +19 -3
  56. data/lib/axiom/function/predicate.rb +6 -3
  57. data/lib/axiom/function/predicate/exclusion.rb +2 -2
  58. data/lib/axiom/function/predicate/inclusion.rb +2 -2
  59. data/lib/axiom/function/proposition.rb +12 -9
  60. data/lib/axiom/function/string/length.rb +6 -3
  61. data/lib/axiom/function/unary.rb +12 -0
  62. data/lib/axiom/relation.rb +31 -50
  63. data/lib/axiom/relation/base.rb +3 -3
  64. data/lib/axiom/relation/empty.rb +3 -32
  65. data/lib/axiom/relation/header.rb +31 -15
  66. data/lib/axiom/relation/keys.rb +4 -4
  67. data/lib/axiom/relation/materialized.rb +2 -1
  68. data/lib/axiom/relation/operation/limit.rb +51 -0
  69. data/lib/axiom/relation/operation/order.rb +21 -28
  70. data/lib/axiom/relation/operation/order/direction_set.rb +1 -1
  71. data/lib/axiom/relation/proxy.rb +2 -2
  72. data/lib/axiom/relation/variable.rb +117 -0
  73. data/lib/axiom/support/equalizer.rb +9 -2
  74. data/lib/axiom/support/evaluator.rb +4 -1
  75. data/lib/axiom/tuple.rb +2 -2
  76. data/lib/axiom/version.rb +1 -1
  77. data/spec/integration/axiom/algebra/join_spec.rb +2 -2
  78. data/spec/integration/axiom/algebra/product_spec.rb +2 -2
  79. data/spec/integration/axiom/algebra/projection_spec.rb +6 -6
  80. data/spec/integration/axiom/algebra/summarization_spec.rb +9 -9
  81. data/spec/integration/axiom/relation/efficient_enumerable_spec.rb +18 -18
  82. data/spec/integration/axiom/relation/mutable_enumerator_spec.rb +51 -0
  83. data/spec/integration/axiom/relation/variable/thread_safe_spec.rb +45 -0
  84. data/spec/integration/axiom/relation/writable_relations_spec.rb +14 -14
  85. data/spec/shared/invertible_method_behaviour.rb +1 -1
  86. data/spec/spec_helper.rb +23 -15
  87. data/spec/support/config_alias.rb +2 -0
  88. data/spec/unit/axiom/aggregate/call_spec.rb +5 -5
  89. data/spec/unit/axiom/aggregate/class_methods/finalize_spec.rb +3 -3
  90. data/spec/unit/axiom/aggregate/count/class_methods/call_spec.rb +3 -3
  91. data/spec/unit/axiom/aggregate/count/class_methods/type_spec.rb +11 -0
  92. data/spec/unit/axiom/aggregate/count/methods/count_spec.rb +1 -1
  93. data/spec/unit/axiom/aggregate/default_spec.rb +2 -2
  94. data/spec/unit/axiom/aggregate/finalize_spec.rb +3 -3
  95. data/spec/unit/axiom/aggregate/maximum/class_methods/call_spec.rb +3 -3
  96. data/spec/unit/axiom/aggregate/maximum/methods/maximum_spec.rb +2 -2
  97. data/spec/unit/axiom/aggregate/maximum/type_spec.rb +4 -4
  98. data/spec/unit/axiom/aggregate/mean/class_methods/call_spec.rb +6 -6
  99. data/spec/unit/axiom/aggregate/mean/class_methods/default_spec.rb +1 -1
  100. data/spec/unit/axiom/aggregate/mean/class_methods/finalize_spec.rb +4 -4
  101. data/spec/unit/axiom/aggregate/mean/class_methods/type_spec.rb +11 -0
  102. data/spec/unit/axiom/aggregate/mean/methods/mean_spec.rb +2 -2
  103. data/spec/unit/axiom/aggregate/minimum/class_methods/call_spec.rb +3 -3
  104. data/spec/unit/axiom/aggregate/minimum/methods/minimum_spec.rb +2 -2
  105. data/spec/unit/axiom/aggregate/minimum/type_spec.rb +4 -4
  106. data/spec/unit/axiom/aggregate/standard_deviation/class_methods/finalize_spec.rb +4 -4
  107. data/spec/unit/axiom/aggregate/standard_deviation/class_methods/type_spec.rb +11 -0
  108. data/spec/unit/axiom/aggregate/standard_deviation/methods/standard_deviation_spec.rb +2 -2
  109. data/spec/unit/axiom/aggregate/sum/class_methods/call_spec.rb +3 -3
  110. data/spec/unit/axiom/aggregate/sum/default_spec.rb +3 -3
  111. data/spec/unit/axiom/aggregate/sum/methods/sum_spec.rb +1 -1
  112. data/spec/unit/axiom/aggregate/sum/type_spec.rb +4 -4
  113. data/spec/unit/axiom/aggregate/variance/class_methods/call_spec.rb +9 -9
  114. data/spec/unit/axiom/aggregate/variance/class_methods/default_spec.rb +1 -1
  115. data/spec/unit/axiom/aggregate/variance/class_methods/finalize_spec.rb +11 -3
  116. data/spec/unit/axiom/aggregate/variance/class_methods/type_spec.rb +11 -0
  117. data/spec/unit/axiom/aggregate/variance/methods/variance_spec.rb +2 -2
  118. data/spec/unit/axiom/algebra/difference/delete_spec.rb +6 -6
  119. data/spec/unit/axiom/algebra/difference/each_spec.rb +6 -6
  120. data/spec/unit/axiom/algebra/difference/insert_spec.rb +5 -5
  121. data/spec/unit/axiom/algebra/difference/methods/difference_spec.rb +5 -5
  122. data/spec/unit/axiom/algebra/extension/class_methods/new_spec.rb +4 -4
  123. data/spec/unit/axiom/algebra/extension/delete_spec.rb +11 -11
  124. data/spec/unit/axiom/algebra/extension/each_spec.rb +7 -7
  125. data/spec/unit/axiom/algebra/extension/eql_spec.rb +5 -5
  126. data/spec/unit/axiom/algebra/extension/extensions_spec.rb +3 -3
  127. data/spec/unit/axiom/algebra/extension/hash_spec.rb +3 -3
  128. data/spec/unit/axiom/algebra/extension/header_spec.rb +4 -4
  129. data/spec/unit/axiom/algebra/extension/insert_spec.rb +11 -11
  130. data/spec/unit/axiom/algebra/extension/methods/extend_spec.rb +6 -6
  131. data/spec/unit/axiom/algebra/extension/operand_spec.rb +4 -4
  132. data/spec/unit/axiom/algebra/intersection/delete_spec.rb +6 -6
  133. data/spec/unit/axiom/algebra/intersection/each_spec.rb +6 -6
  134. data/spec/unit/axiom/algebra/intersection/insert_spec.rb +5 -5
  135. data/spec/unit/axiom/algebra/intersection/methods/intersect_spec.rb +5 -5
  136. data/spec/unit/axiom/algebra/join/class_methods/new_spec.rb +5 -5
  137. data/spec/unit/axiom/algebra/join/delete_spec.rb +8 -8
  138. data/spec/unit/axiom/algebra/join/each_spec.rb +15 -15
  139. data/spec/unit/axiom/algebra/join/insert_spec.rb +8 -8
  140. data/spec/unit/axiom/algebra/join/join_header_spec.rb +4 -4
  141. data/spec/unit/axiom/algebra/join/methods/join_spec.rb +6 -6
  142. data/spec/unit/axiom/algebra/product/class_methods/new_spec.rb +6 -6
  143. data/spec/unit/axiom/algebra/product/delete_spec.rb +4 -4
  144. data/spec/unit/axiom/algebra/product/each_spec.rb +8 -8
  145. data/spec/unit/axiom/algebra/product/insert_spec.rb +4 -4
  146. data/spec/unit/axiom/algebra/product/methods/product_spec.rb +4 -4
  147. data/spec/unit/axiom/algebra/projection/delete_spec.rb +11 -11
  148. data/spec/unit/axiom/algebra/projection/each_spec.rb +7 -7
  149. data/spec/unit/axiom/algebra/projection/eql_spec.rb +5 -5
  150. data/spec/unit/axiom/algebra/projection/hash_spec.rb +4 -4
  151. data/spec/unit/axiom/algebra/projection/header_spec.rb +3 -3
  152. data/spec/unit/axiom/algebra/projection/insert_spec.rb +14 -14
  153. data/spec/unit/axiom/algebra/projection/methods/project_spec.rb +5 -5
  154. data/spec/unit/axiom/algebra/projection/methods/remove_spec.rb +5 -5
  155. data/spec/unit/axiom/algebra/rename/aliases/class_methods/coerce_spec.rb +2 -2
  156. data/spec/unit/axiom/algebra/rename/aliases/each_spec.rb +4 -4
  157. data/spec/unit/axiom/algebra/rename/aliases/element_reader_spec.rb +2 -2
  158. data/spec/unit/axiom/algebra/rename/aliases/to_hash_spec.rb +2 -2
  159. data/spec/unit/axiom/algebra/rename/aliases/union_spec.rb +1 -1
  160. data/spec/unit/axiom/algebra/rename/aliases_spec.rb +2 -2
  161. data/spec/unit/axiom/algebra/rename/delete_spec.rb +6 -6
  162. data/spec/unit/axiom/algebra/rename/directions_spec.rb +4 -4
  163. data/spec/unit/axiom/algebra/rename/each_spec.rb +6 -6
  164. data/spec/unit/axiom/algebra/rename/eql_spec.rb +5 -5
  165. data/spec/unit/axiom/algebra/rename/hash_spec.rb +3 -3
  166. data/spec/unit/axiom/algebra/rename/header_spec.rb +3 -3
  167. data/spec/unit/axiom/algebra/rename/insert_spec.rb +6 -6
  168. data/spec/unit/axiom/algebra/rename/methods/rename_spec.rb +4 -4
  169. data/spec/unit/axiom/algebra/restriction/delete_spec.rb +9 -9
  170. data/spec/unit/axiom/algebra/restriction/each_spec.rb +12 -12
  171. data/spec/unit/axiom/algebra/restriction/eql_spec.rb +4 -4
  172. data/spec/unit/axiom/algebra/restriction/hash_spec.rb +3 -3
  173. data/spec/unit/axiom/algebra/restriction/insert_spec.rb +9 -9
  174. data/spec/unit/axiom/algebra/restriction/methods/restrict_spec.rb +12 -15
  175. data/spec/unit/axiom/algebra/restriction/predicate_spec.rb +4 -4
  176. data/spec/unit/axiom/algebra/summarization/class_methods/new_spec.rb +6 -6
  177. data/spec/unit/axiom/algebra/summarization/delete_spec.rb +3 -3
  178. data/spec/unit/axiom/algebra/summarization/each_spec.rb +5 -5
  179. data/spec/unit/axiom/algebra/summarization/eql_spec.rb +3 -3
  180. data/spec/unit/axiom/algebra/summarization/hash_spec.rb +2 -2
  181. data/spec/unit/axiom/algebra/summarization/header_spec.rb +3 -3
  182. data/spec/unit/axiom/algebra/summarization/insert_spec.rb +3 -3
  183. data/spec/unit/axiom/algebra/summarization/methods/summarize_spec.rb +15 -15
  184. data/spec/unit/axiom/algebra/summarization/summaries/summarize_by_spec.rb +6 -6
  185. data/spec/unit/axiom/algebra/summarization/summaries/to_hash_spec.rb +2 -2
  186. data/spec/unit/axiom/algebra/summarization/summarize_per_spec.rb +3 -3
  187. data/spec/unit/axiom/algebra/summarization/summarizers_spec.rb +3 -3
  188. data/spec/unit/axiom/algebra/summarization/summary/call_spec.rb +4 -4
  189. data/spec/unit/axiom/algebra/summarization/summary/summarize_by_spec.rb +9 -6
  190. data/spec/unit/axiom/algebra/union/delete_spec.rb +6 -6
  191. data/spec/unit/axiom/algebra/union/each_spec.rb +9 -9
  192. data/spec/unit/axiom/algebra/union/insert_spec.rb +5 -5
  193. data/spec/unit/axiom/algebra/union/methods/union_spec.rb +5 -5
  194. data/spec/unit/axiom/aliasable/inheritable_alias_spec.rb +6 -6
  195. data/spec/unit/axiom/attribute/{date/class_methods/primitive_spec.rb → boolean/class_methods/type_spec.rb} +3 -3
  196. data/spec/unit/axiom/attribute/boolean/{valid_value_predicate_spec.rb → include_predicate_spec.rb} +2 -2
  197. data/spec/unit/axiom/attribute/call_spec.rb +8 -4
  198. data/spec/unit/axiom/attribute/{time/class_methods/primitive_spec.rb → class/class_methods/type_spec.rb} +3 -3
  199. data/spec/unit/axiom/attribute/class_methods/coerce_spec.rb +6 -6
  200. data/spec/unit/axiom/attribute/class_methods/infer_type_spec.rb +15 -15
  201. data/spec/unit/axiom/attribute/class_methods/name_from_spec.rb +4 -4
  202. data/spec/unit/axiom/attribute/class_methods/new_spec.rb +1 -1
  203. data/spec/unit/axiom/attribute/{float/class_methods/primitive_spec.rb → date/class_methods/type_spec.rb} +3 -3
  204. data/spec/unit/axiom/attribute/{class/class_methods/primitive_spec.rb → date_time/class_methods/type_spec.rb} +3 -3
  205. data/spec/unit/axiom/attribute/decimal/class_methods/type_spec.rb +13 -0
  206. data/spec/unit/axiom/attribute/eql_spec.rb +5 -1
  207. data/spec/unit/axiom/attribute/equality_operator_spec.rb +5 -1
  208. data/spec/unit/axiom/attribute/float/class_methods/type_spec.rb +13 -0
  209. data/spec/unit/axiom/attribute/hash_spec.rb +6 -2
  210. data/spec/unit/axiom/attribute/{valid_value_predicate_spec.rb → include_predicate_spec.rb} +4 -8
  211. data/spec/unit/axiom/attribute/integer/class_methods/type_spec.rb +13 -0
  212. data/spec/unit/axiom/attribute/name_spec.rb +5 -1
  213. data/spec/unit/axiom/attribute/numeric/class_methods/type_spec.rb +13 -0
  214. data/spec/unit/axiom/attribute/numeric/eql_spec.rb +2 -2
  215. data/spec/unit/axiom/attribute/numeric/equality_operator_spec.rb +2 -2
  216. data/spec/unit/axiom/attribute/numeric/hash_spec.rb +6 -6
  217. data/spec/unit/axiom/attribute/numeric/{valid_value_predicate_spec.rb → include_predicate_spec.rb} +3 -3
  218. data/spec/unit/axiom/attribute/object/class_methods/type_spec.rb +13 -0
  219. data/spec/unit/axiom/attribute/optional_predicate_spec.rb +31 -0
  220. data/spec/unit/axiom/attribute/rename_spec.rb +9 -5
  221. data/spec/unit/axiom/attribute/required_predicate_spec.rb +8 -4
  222. data/spec/unit/axiom/attribute/string/class_methods/type_spec.rb +13 -0
  223. data/spec/unit/axiom/attribute/string/eql_spec.rb +5 -5
  224. data/spec/unit/axiom/attribute/string/equality_operator_spec.rb +5 -5
  225. data/spec/unit/axiom/attribute/string/hash_spec.rb +9 -9
  226. data/spec/unit/axiom/attribute/string/{valid_value_predicate_spec.rb → include_predicate_spec.rb} +3 -3
  227. data/spec/unit/axiom/attribute/time/class_methods/type_spec.rb +13 -0
  228. data/spec/unit/axiom/attribute/type_spec.rb +4 -4
  229. data/spec/unit/axiom/equalizer/class_method/new_spec.rb +11 -11
  230. data/spec/unit/axiom/equalizer/methods/eql_spec.rb +1 -1
  231. data/spec/unit/axiom/evaluator/context/add_spec.rb +5 -5
  232. data/spec/unit/axiom/evaluator/context/element_reader_spec.rb +5 -5
  233. data/spec/unit/axiom/evaluator/context/functions_spec.rb +1 -1
  234. data/spec/unit/axiom/evaluator/context/method_missing_spec.rb +5 -5
  235. data/spec/unit/axiom/evaluator/context/respond_to_predicate_spec.rb +3 -3
  236. data/spec/unit/axiom/evaluator/context/send_spec.rb +9 -9
  237. data/spec/unit/axiom/evaluator/context/yield_spec.rb +3 -3
  238. data/spec/unit/axiom/function/binary/call_spec.rb +4 -4
  239. data/spec/unit/axiom/function/binary/equality_operator_spec.rb +6 -6
  240. data/spec/unit/axiom/function/binary/invertible/class_methods/included_spec.rb +5 -5
  241. data/spec/unit/axiom/function/binary/invertible/inverse_spec.rb +5 -5
  242. data/spec/unit/axiom/function/binary/rename_spec.rb +9 -9
  243. data/spec/unit/axiom/function/binary/type_spec.rb +53 -0
  244. data/spec/unit/axiom/function/class_methods/extract_value_spec.rb +5 -5
  245. data/spec/unit/axiom/function/class_methods/rename_attributes_spec.rb +3 -3
  246. data/spec/unit/axiom/function/class_methods/type_spec.rb +12 -0
  247. data/spec/unit/axiom/function/comparable/class_methods/included_spec.rb +5 -5
  248. data/spec/unit/axiom/function/connective/class_methods/type_spec.rb +11 -0
  249. data/spec/unit/axiom/function/connective/conjunction/methods/and_spec.rb +5 -5
  250. data/spec/unit/axiom/function/connective/disjunction/methods/or_spec.rb +5 -5
  251. data/spec/unit/axiom/function/connective/negation/class_methods/operation_spec.rb +1 -1
  252. data/spec/unit/axiom/function/connective/negation/inverse_spec.rb +1 -1
  253. data/spec/unit/axiom/function/connective/negation/methods/not_spec.rb +6 -6
  254. data/spec/unit/axiom/function/numeric/absolute/class_methods/operation_spec.rb +1 -1
  255. data/spec/unit/axiom/function/numeric/absolute/methods/absolute_spec.rb +2 -2
  256. data/spec/unit/axiom/function/numeric/addition/class_methods/inverse_spec.rb +1 -1
  257. data/spec/unit/axiom/function/numeric/addition/methods/add_spec.rb +4 -4
  258. data/spec/unit/axiom/function/numeric/class_methods/type_spec.rb +11 -0
  259. data/spec/unit/axiom/function/numeric/division/class_methods/inverse_spec.rb +1 -1
  260. data/spec/unit/axiom/function/numeric/division/class_methods/type_spec.rb +11 -0
  261. data/spec/unit/axiom/function/numeric/division/methods/divide_spec.rb +4 -4
  262. data/spec/unit/axiom/function/numeric/division/type_spec.rb +1 -1
  263. data/spec/unit/axiom/function/numeric/exponentiation/inverse_spec.rb +1 -1
  264. data/spec/unit/axiom/function/numeric/exponentiation/methods/exponent_spec.rb +4 -4
  265. data/spec/unit/axiom/function/numeric/modulo/methods/modulo_spec.rb +4 -4
  266. data/spec/unit/axiom/function/numeric/multiplication/class_methods/inverse_spec.rb +1 -1
  267. data/spec/unit/axiom/function/numeric/multiplication/methods/multiply_spec.rb +4 -4
  268. data/spec/unit/axiom/function/numeric/square_root/class_methods/type_spec.rb +11 -0
  269. data/spec/unit/axiom/function/numeric/square_root/methods/square_root_spec.rb +2 -2
  270. data/spec/unit/axiom/function/numeric/square_root/type_spec.rb +1 -1
  271. data/spec/unit/axiom/function/numeric/subtraction/class_methods/inverse_spec.rb +1 -1
  272. data/spec/unit/axiom/function/numeric/subtraction/methods/subtract_spec.rb +4 -4
  273. data/spec/unit/axiom/function/numeric/unary_minus/class_methods/inverse_spec.rb +1 -1
  274. data/spec/unit/axiom/function/numeric/unary_minus/class_methods/operation_spec.rb +1 -1
  275. data/spec/unit/axiom/function/numeric/unary_minus/methods/unary_minus_spec.rb +2 -2
  276. data/spec/unit/axiom/function/numeric/unary_plus/class_methods/inverse_spec.rb +1 -1
  277. data/spec/unit/axiom/function/numeric/unary_plus/class_methods/operation_spec.rb +1 -1
  278. data/spec/unit/axiom/function/numeric/unary_plus/methods/unary_plus_spec.rb +2 -2
  279. data/spec/unit/axiom/function/predicate/call_spec.rb +5 -5
  280. data/spec/unit/axiom/function/predicate/class_methods/type_spec.rb +11 -0
  281. data/spec/unit/axiom/function/predicate/enumerable/call_spec.rb +11 -11
  282. data/spec/unit/axiom/function/predicate/enumerable/class_methods/compare_method_spec.rb +1 -1
  283. data/spec/unit/axiom/function/predicate/equality/class_methods/inverse_spec.rb +1 -1
  284. data/spec/unit/axiom/function/predicate/equality/class_methods/reverse_spec.rb +1 -1
  285. data/spec/unit/axiom/function/predicate/equality/inverse_spec.rb +1 -1
  286. data/spec/unit/axiom/function/predicate/exclusion/class_methods/call_spec.rb +4 -4
  287. data/spec/unit/axiom/function/predicate/exclusion/class_methods/inverse_spec.rb +1 -1
  288. data/spec/unit/axiom/function/predicate/exclusion/inverse_spec.rb +3 -3
  289. data/spec/unit/axiom/function/predicate/exclusion/methods/exclude_spec.rb +1 -1
  290. data/spec/unit/axiom/function/predicate/greater_than/class_methods/inverse_spec.rb +1 -1
  291. data/spec/unit/axiom/function/predicate/greater_than/class_methods/reverse_spec.rb +1 -1
  292. data/spec/unit/axiom/function/predicate/greater_than/inverse_spec.rb +1 -1
  293. data/spec/unit/axiom/function/predicate/greater_than_or_equal_to/class_methods/inverse_spec.rb +1 -1
  294. data/spec/unit/axiom/function/predicate/greater_than_or_equal_to/class_methods/reverse_spec.rb +1 -1
  295. data/spec/unit/axiom/function/predicate/greater_than_or_equal_to/inverse_spec.rb +1 -1
  296. data/spec/unit/axiom/function/predicate/inclusion/class_methods/call_spec.rb +4 -4
  297. data/spec/unit/axiom/function/predicate/inclusion/class_methods/inverse_spec.rb +1 -1
  298. data/spec/unit/axiom/function/predicate/inclusion/inverse_spec.rb +3 -3
  299. data/spec/unit/axiom/function/predicate/inclusion/methods/include_spec.rb +1 -1
  300. data/spec/unit/axiom/function/predicate/inequality/class_methods/inverse_spec.rb +1 -1
  301. data/spec/unit/axiom/function/predicate/inequality/class_methods/reverse_spec.rb +1 -1
  302. data/spec/unit/axiom/function/predicate/inequality/inverse_spec.rb +1 -1
  303. data/spec/unit/axiom/function/predicate/less_than/class_methods/inverse_spec.rb +1 -1
  304. data/spec/unit/axiom/function/predicate/less_than/class_methods/reverse_spec.rb +1 -1
  305. data/spec/unit/axiom/function/predicate/less_than/inverse_spec.rb +1 -1
  306. data/spec/unit/axiom/function/predicate/less_than_or_equal_to/class_methods/inverse_spec.rb +1 -1
  307. data/spec/unit/axiom/function/predicate/less_than_or_equal_to/class_methods/reverse_spec.rb +1 -1
  308. data/spec/unit/axiom/function/predicate/less_than_or_equal_to/inverse_spec.rb +1 -1
  309. data/spec/unit/axiom/function/predicate/match/class_methods/inverse_spec.rb +1 -1
  310. data/spec/unit/axiom/function/predicate/match/inverse_spec.rb +2 -2
  311. data/spec/unit/axiom/function/predicate/no_match/class_methods/inverse_spec.rb +1 -1
  312. data/spec/unit/axiom/function/predicate/no_match/inverse_spec.rb +2 -2
  313. data/spec/unit/axiom/function/proposition/call_spec.rb +2 -2
  314. data/spec/unit/axiom/function/proposition/class_methods/new_spec.rb +4 -4
  315. data/spec/unit/axiom/function/proposition/class_methods/type_spec.rb +11 -0
  316. data/spec/unit/axiom/function/proposition/contradiction/and_spec.rb +2 -2
  317. data/spec/unit/axiom/function/proposition/contradiction/class_methods/inverse_spec.rb +1 -1
  318. data/spec/unit/axiom/function/proposition/contradiction/inverse_spec.rb +1 -1
  319. data/spec/unit/axiom/function/proposition/contradiction/or_spec.rb +2 -2
  320. data/spec/unit/axiom/function/proposition/inverse_spec.rb +6 -6
  321. data/spec/unit/axiom/function/proposition/rename_spec.rb +1 -1
  322. data/spec/unit/axiom/function/proposition/tautology/and_spec.rb +2 -2
  323. data/spec/unit/axiom/function/proposition/tautology/class_methods/inverse_spec.rb +1 -1
  324. data/spec/unit/axiom/function/proposition/tautology/inverse_spec.rb +1 -1
  325. data/spec/unit/axiom/function/proposition/tautology/or_spec.rb +2 -2
  326. data/spec/unit/axiom/function/rename_spec.rb +1 -1
  327. data/spec/unit/axiom/function/string/length/class_methods/type_spec.rb +11 -0
  328. data/spec/unit/axiom/function/string/length/methods/length_spec.rb +1 -1
  329. data/spec/unit/axiom/function/type_spec.rb +8 -1
  330. data/spec/unit/axiom/function/unary/call_spec.rb +7 -7
  331. data/spec/unit/axiom/function/unary/callable/call_spec.rb +4 -4
  332. data/spec/unit/axiom/function/unary/callable/included_spec.rb +1 -1
  333. data/spec/unit/axiom/function/unary/equality_operator_spec.rb +5 -5
  334. data/spec/unit/axiom/function/unary/hash_spec.rb +5 -5
  335. data/spec/unit/axiom/function/unary/invertible/class_methods/included_spec.rb +5 -5
  336. data/spec/unit/axiom/function/unary/invertible/inverse_spec.rb +2 -2
  337. data/spec/unit/axiom/function/unary/rename_spec.rb +7 -7
  338. data/spec/unit/axiom/function/unary/type_spec.rb +26 -0
  339. data/spec/unit/axiom/operation/binary/eql_spec.rb +4 -4
  340. data/spec/unit/axiom/operation/binary/hash_spec.rb +2 -2
  341. data/spec/unit/axiom/operation/binary/left_spec.rb +2 -2
  342. data/spec/unit/axiom/operation/binary/right_spec.rb +2 -2
  343. data/spec/unit/axiom/operation/unary/eql_spec.rb +2 -2
  344. data/spec/unit/axiom/operation/unary/hash_spec.rb +1 -1
  345. data/spec/unit/axiom/operation/unary/operand_spec.rb +2 -2
  346. data/spec/unit/axiom/relation/base/class_methods/new_spec.rb +20 -8
  347. data/spec/unit/axiom/relation/base/eql_spec.rb +12 -12
  348. data/spec/unit/axiom/relation/base/hash_spec.rb +4 -4
  349. data/spec/unit/axiom/relation/base/name_spec.rb +5 -34
  350. data/spec/unit/axiom/relation/class_methods/coerce_spec.rb +11 -5
  351. data/spec/unit/axiom/relation/class_methods/new_spec.rb +15 -7
  352. data/spec/unit/axiom/relation/directions_spec.rb +2 -2
  353. data/spec/unit/axiom/relation/each_spec.rb +10 -10
  354. data/spec/unit/axiom/relation/element_reader_spec.rb +4 -4
  355. data/spec/unit/axiom/relation/empty/class_methods/new_spec.rb +6 -20
  356. data/spec/unit/axiom/relation/empty/each_spec.rb +7 -22
  357. data/spec/unit/axiom/relation/empty/empty_predicate_spec.rb +1 -1
  358. data/spec/unit/axiom/relation/empty/header_spec.rb +3 -3
  359. data/spec/unit/axiom/relation/empty/size_spec.rb +1 -1
  360. data/spec/unit/axiom/relation/empty_predicate_spec.rb +2 -2
  361. data/spec/unit/axiom/relation/eql_spec.rb +10 -10
  362. data/spec/unit/axiom/relation/equality_operator_spec.rb +24 -14
  363. data/spec/unit/axiom/relation/hash_spec.rb +3 -3
  364. data/spec/unit/axiom/relation/header/call_spec.rb +5 -5
  365. data/spec/unit/axiom/relation/header/class_methods/coerce_spec.rb +13 -13
  366. data/spec/unit/axiom/relation/header/class_methods/new_spec.rb +4 -4
  367. data/spec/unit/axiom/relation/header/context_spec.rb +27 -0
  368. data/spec/unit/axiom/relation/header/difference_spec.rb +19 -19
  369. data/spec/unit/axiom/relation/header/each_spec.rb +6 -6
  370. data/spec/unit/axiom/relation/header/empty_predicate_spec.rb +1 -1
  371. data/spec/unit/axiom/relation/header/eql_spec.rb +6 -6
  372. data/spec/unit/axiom/relation/header/equality_operator_spec.rb +8 -8
  373. data/spec/unit/axiom/relation/header/extend_spec.rb +9 -9
  374. data/spec/unit/axiom/relation/header/hash_spec.rb +3 -3
  375. data/spec/unit/axiom/relation/header/intersect_spec.rb +19 -19
  376. data/spec/unit/axiom/relation/header/keys_spec.rb +5 -5
  377. data/spec/unit/axiom/relation/header/project_spec.rb +11 -11
  378. data/spec/unit/axiom/relation/header/rename_spec.rb +6 -6
  379. data/spec/unit/axiom/relation/header/to_ary_spec.rb +3 -3
  380. data/spec/unit/axiom/relation/header/union_spec.rb +20 -20
  381. data/spec/unit/axiom/relation/header_spec.rb +2 -2
  382. data/spec/unit/axiom/relation/include_predicate_spec.rb +4 -4
  383. data/spec/unit/axiom/relation/keys/class_methods/coerce_spec.rb +4 -4
  384. data/spec/unit/axiom/relation/keys/class_methods/new_spec.rb +5 -5
  385. data/spec/unit/axiom/relation/keys/difference_spec.rb +7 -7
  386. data/spec/unit/axiom/relation/keys/each_spec.rb +6 -6
  387. data/spec/unit/axiom/relation/keys/empty_predicate_spec.rb +1 -1
  388. data/spec/unit/axiom/relation/keys/extend_spec.rb +7 -7
  389. data/spec/unit/axiom/relation/keys/intersect_spec.rb +6 -6
  390. data/spec/unit/axiom/relation/keys/project_spec.rb +8 -8
  391. data/spec/unit/axiom/relation/keys/rename_spec.rb +5 -5
  392. data/spec/unit/axiom/relation/keys/to_ary_spec.rb +3 -3
  393. data/spec/unit/axiom/relation/keys/union_spec.rb +8 -8
  394. data/spec/unit/axiom/relation/materialize_spec.rb +3 -3
  395. data/spec/unit/axiom/relation/materialized/class_methods/new_spec.rb +19 -7
  396. data/spec/unit/axiom/relation/materialized/directions_spec.rb +4 -4
  397. data/spec/unit/axiom/relation/materialized/empty_predicate_spec.rb +2 -2
  398. data/spec/unit/axiom/relation/materialized/materialize_spec.rb +2 -2
  399. data/spec/unit/axiom/relation/materialized/materialized_predicate_spec.rb +1 -1
  400. data/spec/unit/axiom/relation/materialized/size_spec.rb +1 -1
  401. data/spec/unit/axiom/relation/materialized_predicate_spec.rb +1 -1
  402. data/spec/unit/axiom/relation/operation/binary/class_methods/included_spec.rb +5 -5
  403. data/spec/unit/axiom/relation/operation/binary/class_methods/new_spec.rb +3 -3
  404. data/spec/unit/axiom/relation/operation/binary/header_spec.rb +5 -5
  405. data/spec/unit/axiom/relation/operation/combination/class_methods/combine_tuples_spec.rb +18 -11
  406. data/spec/unit/axiom/relation/operation/combination/header_spec.rb +5 -5
  407. data/spec/unit/axiom/relation/operation/deletion/initialize_spec.rb +2 -2
  408. data/spec/unit/axiom/relation/operation/deletion/methods/delete_spec.rb +5 -5
  409. data/spec/unit/axiom/relation/operation/insertion/initialize_spec.rb +2 -2
  410. data/spec/unit/axiom/relation/operation/insertion/methods/insert_spec.rb +5 -5
  411. data/spec/unit/axiom/relation/operation/limit/class_methods/new_spec.rb +2 -2
  412. data/spec/unit/axiom/relation/operation/limit/delete_spec.rb +4 -4
  413. data/spec/unit/axiom/relation/operation/limit/directions_spec.rb +4 -4
  414. data/spec/unit/axiom/relation/operation/limit/each_spec.rb +7 -7
  415. data/spec/unit/axiom/relation/operation/limit/eql_spec.rb +6 -6
  416. data/spec/unit/axiom/relation/operation/limit/hash_spec.rb +4 -4
  417. data/spec/unit/axiom/relation/operation/limit/insert_spec.rb +4 -4
  418. data/spec/unit/axiom/relation/operation/limit/limit_spec.rb +4 -4
  419. data/spec/unit/axiom/relation/operation/limit/methods/first_spec.rb +6 -6
  420. data/spec/unit/axiom/relation/operation/limit/methods/last_spec.rb +6 -6
  421. data/spec/unit/axiom/relation/operation/limit/methods/one_spec.rb +63 -0
  422. data/spec/unit/axiom/relation/operation/limit/methods/take_spec.rb +4 -4
  423. data/spec/unit/axiom/relation/operation/offset/class_methods/new_spec.rb +2 -2
  424. data/spec/unit/axiom/relation/operation/offset/delete_spec.rb +4 -4
  425. data/spec/unit/axiom/relation/operation/offset/directions_spec.rb +4 -4
  426. data/spec/unit/axiom/relation/operation/offset/each_spec.rb +7 -7
  427. data/spec/unit/axiom/relation/operation/offset/eql_spec.rb +6 -6
  428. data/spec/unit/axiom/relation/operation/offset/hash_spec.rb +4 -4
  429. data/spec/unit/axiom/relation/operation/offset/insert_spec.rb +4 -4
  430. data/spec/unit/axiom/relation/operation/offset/methods/drop_spec.rb +4 -4
  431. data/spec/unit/axiom/relation/operation/offset/offset_spec.rb +4 -4
  432. data/spec/unit/axiom/relation/operation/order/ascending/class_methods/reverse_spec.rb +1 -1
  433. data/spec/unit/axiom/relation/operation/order/ascending/reverse_spec.rb +1 -1
  434. data/spec/unit/axiom/relation/operation/order/class_methods/new_spec.rb +117 -15
  435. data/spec/unit/axiom/relation/operation/order/delete_spec.rb +11 -11
  436. data/spec/unit/axiom/relation/operation/order/descending/class_methods/reverse_spec.rb +1 -1
  437. data/spec/unit/axiom/relation/operation/order/descending/reverse_spec.rb +1 -1
  438. data/spec/unit/axiom/relation/operation/order/direction/attribute_spec.rb +1 -1
  439. data/spec/unit/axiom/relation/operation/order/direction/call_spec.rb +5 -5
  440. data/spec/unit/axiom/relation/operation/order/direction/class_methods/coerce_spec.rb +3 -3
  441. data/spec/unit/axiom/relation/operation/order/direction/eql_predicate_spec.rb +1 -1
  442. data/spec/unit/axiom/relation/operation/order/direction/name_spec.rb +1 -1
  443. data/spec/unit/axiom/relation/operation/order/direction/rename_spec.rb +6 -6
  444. data/spec/unit/axiom/relation/operation/order/direction/reverse_spec.rb +4 -4
  445. data/spec/unit/axiom/relation/operation/order/direction_set/attributes_spec.rb +3 -3
  446. data/spec/unit/axiom/relation/operation/order/direction_set/class_methods/coerce_spec.rb +11 -11
  447. data/spec/unit/axiom/relation/operation/order/direction_set/class_methods/new_spec.rb +2 -2
  448. data/spec/unit/axiom/relation/operation/order/direction_set/eql_spec.rb +2 -2
  449. data/spec/unit/axiom/relation/operation/order/direction_set/equality_operator_spec.rb +7 -7
  450. data/spec/unit/axiom/relation/operation/order/direction_set/hash_spec.rb +1 -1
  451. data/spec/unit/axiom/relation/operation/order/direction_set/project_spec.rb +5 -5
  452. data/spec/unit/axiom/relation/operation/order/direction_set/rename_spec.rb +6 -6
  453. data/spec/unit/axiom/relation/operation/order/direction_set/reverse_spec.rb +5 -5
  454. data/spec/unit/axiom/relation/operation/order/direction_set/sort_tuples_spec.rb +12 -12
  455. data/spec/unit/axiom/relation/operation/order/direction_set/to_ary_spec.rb +3 -3
  456. data/spec/unit/axiom/relation/operation/order/directions_spec.rb +4 -4
  457. data/spec/unit/axiom/relation/operation/order/each_spec.rb +7 -7
  458. data/spec/unit/axiom/relation/operation/order/eql_spec.rb +5 -5
  459. data/spec/unit/axiom/relation/operation/order/hash_spec.rb +1 -1
  460. data/spec/unit/axiom/relation/operation/order/header_spec.rb +4 -4
  461. data/spec/unit/axiom/relation/operation/order/insert_spec.rb +11 -11
  462. data/spec/unit/axiom/relation/operation/order/methods/sort_by_spec.rb +127 -20
  463. data/spec/unit/axiom/relation/operation/order/methods/sort_spec.rb +19 -0
  464. data/spec/unit/axiom/relation/operation/reverse/class_methods/new_spec.rb +2 -2
  465. data/spec/unit/axiom/relation/operation/reverse/directions_spec.rb +4 -4
  466. data/spec/unit/axiom/relation/operation/reverse/each_spec.rb +7 -7
  467. data/spec/unit/axiom/relation/operation/reverse/methods/reverse_spec.rb +3 -3
  468. data/spec/unit/axiom/relation/operation/set/class_methods/included_spec.rb +5 -5
  469. data/spec/unit/axiom/relation/operation/set/class_methods/new_spec.rb +6 -6
  470. data/spec/unit/axiom/relation/operation/set/header_spec.rb +5 -5
  471. data/spec/unit/axiom/relation/operation/unary/header_spec.rb +5 -5
  472. data/spec/unit/axiom/relation/proxy/each_spec.rb +8 -8
  473. data/spec/unit/axiom/relation/proxy/hash_spec.rb +4 -4
  474. data/spec/unit/axiom/relation/proxy/method_missing_spec.rb +4 -4
  475. data/spec/unit/axiom/relation/proxy/respond_to_predicate_spec.rb +4 -4
  476. data/spec/unit/axiom/relation/replace_spec.rb +6 -6
  477. data/spec/unit/axiom/relation/variable/class_methods/new_spec.rb +35 -0
  478. data/spec/unit/axiom/relation/variable/delete_spec.rb +18 -0
  479. data/spec/unit/axiom/relation/variable/insert_spec.rb +18 -0
  480. data/spec/unit/axiom/relation/variable/materialized/delete_spec.rb +18 -0
  481. data/spec/unit/axiom/relation/variable/materialized/insert_spec.rb +18 -0
  482. data/spec/unit/axiom/relation/variable/materialized/replace_spec.rb +18 -0
  483. data/spec/unit/axiom/relation/variable/replace_spec.rb +18 -0
  484. data/spec/unit/axiom/tuple/call_spec.rb +3 -4
  485. data/spec/unit/axiom/tuple/class_methods/coerce_spec.rb +6 -6
  486. data/spec/unit/axiom/tuple/data_spec.rb +2 -2
  487. data/spec/unit/axiom/tuple/eql_spec.rb +5 -5
  488. data/spec/unit/axiom/tuple/equality_operator_spec.rb +6 -6
  489. data/spec/unit/axiom/tuple/extend_spec.rb +12 -12
  490. data/spec/unit/axiom/tuple/hash_spec.rb +3 -3
  491. data/spec/unit/axiom/tuple/header_spec.rb +3 -3
  492. data/spec/unit/axiom/tuple/join_spec.rb +6 -6
  493. data/spec/unit/axiom/tuple/predicate_spec.rb +5 -5
  494. data/spec/unit/axiom/tuple/project_spec.rb +5 -5
  495. data/spec/unit/axiom/tuple/to_ary_spec.rb +3 -3
  496. data/spec/unit/axiom/visitable/accept_spec.rb +1 -1
  497. data/spec/unit/range/to_inclusive_spec.rb +1 -1
  498. data/spec/unit/time/pred_spec.rb +1 -1
  499. metadata +92 -614
  500. checksums.yaml +0 -7
  501. data/.rvmrc +0 -1
  502. data/lib/axiom/function/numeric/binary.rb +0 -26
  503. data/lib/axiom/function/numeric/unary.rb +0 -26
  504. data/spec/support/ice_nine_config.rb +0 -6
  505. data/spec/unit/axiom/aggregate/count/type_spec.rb +0 -12
  506. data/spec/unit/axiom/aggregate/mean/type_spec.rb +0 -12
  507. data/spec/unit/axiom/aggregate/standard_deviation/type_spec.rb +0 -12
  508. data/spec/unit/axiom/aggregate/type_spec.rb +0 -13
  509. data/spec/unit/axiom/aggregate/variance/type_spec.rb +0 -12
  510. data/spec/unit/axiom/attribute/boolean/class_methods/primitive_spec.rb +0 -13
  511. data/spec/unit/axiom/attribute/date/range_spec.rb +0 -11
  512. data/spec/unit/axiom/attribute/date_time/class_methods/primitive_spec.rb +0 -13
  513. data/spec/unit/axiom/attribute/date_time/range_spec.rb +0 -11
  514. data/spec/unit/axiom/attribute/decimal/class_methods/primitive_spec.rb +0 -13
  515. data/spec/unit/axiom/attribute/float/size_spec.rb +0 -21
  516. data/spec/unit/axiom/attribute/integer/class_methods/primitive_spec.rb +0 -13
  517. data/spec/unit/axiom/attribute/numeric/class_methods/primitive_spec.rb +0 -13
  518. data/spec/unit/axiom/attribute/numeric/size_spec.rb +0 -33
  519. data/spec/unit/axiom/attribute/object/class_methods/primitive_spec.rb +0 -13
  520. data/spec/unit/axiom/attribute/string/class_methods/primitive_spec.rb +0 -13
  521. data/spec/unit/axiom/attribute/string/max_length_spec.rb +0 -20
  522. data/spec/unit/axiom/attribute/string/min_length_spec.rb +0 -20
  523. data/spec/unit/axiom/attribute/time/range_spec.rb +0 -11
  524. data/spec/unit/axiom/attribute/valid_primitive_predicate_spec.rb +0 -30
  525. data/spec/unit/axiom/function/connective/type_spec.rb +0 -12
  526. data/spec/unit/axiom/function/numeric/binary/type_spec.rb +0 -33
  527. data/spec/unit/axiom/function/numeric/unary/type_spec.rb +0 -21
  528. data/spec/unit/axiom/function/predicate/type_spec.rb +0 -14
  529. data/spec/unit/axiom/function/proposition/type_spec.rb +0 -12
  530. data/spec/unit/axiom/function/string/length/type_spec.rb +0 -11
  531. data/spec/unit/axiom/relation/one_spec.rb +0 -36
@@ -5,9 +5,9 @@ require 'spec_helper'
5
5
  describe Algebra::Restriction, '#eql?' do
6
6
  subject { object.eql?(other) }
7
7
 
8
- let(:operand) { Relation.new([ [ :id, Integer ] ], [ [ 1 ] ]) }
9
- let(:predicate) { proc { true } }
10
- let(:object) { described_class.new(operand, predicate) }
8
+ let(:operand) { Relation.new([[:id, Integer]], [[1]]) }
9
+ let(:predicate) { proc { true } }
10
+ let(:object) { described_class.new(operand, predicate) }
11
11
 
12
12
  context 'with the same object' do
13
13
  let(:other) { object }
@@ -40,7 +40,7 @@ describe Algebra::Restriction, '#eql?' do
40
40
  end
41
41
 
42
42
  context 'with an object having a different operand' do
43
- let(:other_operand) { Relation.new([ [ :id, Integer ] ], [ [ 2 ] ]) }
43
+ let(:other_operand) { Relation.new([[:id, Integer]], [[2]]) }
44
44
  let(:other_predicate) { predicate }
45
45
  let(:other) { described_class.new(other_operand, other_predicate) }
46
46
 
@@ -5,9 +5,9 @@ require 'spec_helper'
5
5
  describe Algebra::Restriction, '#hash' do
6
6
  subject { object.hash }
7
7
 
8
- let(:operand) { Relation.new([ [ :id, Integer ] ], [ [ 1 ] ]) }
9
- let(:predicate) { proc { true } }
10
- let(:object) { described_class.new(operand, predicate) }
8
+ let(:operand) { Relation.new([[:id, Integer]], [[1]]) }
9
+ let(:predicate) { proc { true } }
10
+ let(:object) { described_class.new(operand, predicate) }
11
11
 
12
12
  it_should_behave_like 'a hash method'
13
13
 
@@ -5,11 +5,11 @@ require 'spec_helper'
5
5
  describe Algebra::Restriction, '#insert' do
6
6
  subject { object.insert(other) }
7
7
 
8
- let(:object) { described_class.new(operand, predicate) }
9
- let(:operand) { Relation.new([ attribute ], LazyEnumerable.new([ [ 1 ] ])) }
10
- let(:other_relation) { Relation.new([ attribute ], LazyEnumerable.new([ [ 0 ], [ 2 ] ])) }
11
- let(:attribute) { Attribute::Integer.new(:id) }
12
- let(:predicate) { attribute.gte(1) }
8
+ let(:object) { described_class.new(operand, predicate) }
9
+ let(:operand) { Relation.new([attribute], LazyEnumerable.new([[1]])) }
10
+ let(:other_relation) { Relation.new([attribute], LazyEnumerable.new([[0], [2]])) }
11
+ let(:attribute) { Attribute::Integer.new(:id) }
12
+ let(:predicate) { attribute.gte(1) }
13
13
 
14
14
  shared_examples_for 'Algebra::Restrict#insert' do
15
15
  it { should be_instance_of(described_class) }
@@ -18,15 +18,15 @@ describe Algebra::Restriction, '#insert' do
18
18
 
19
19
  it 'passes expected relations into the insertion' do
20
20
  subject = self.subject.operand
21
- subject.left.should equal(operand)
21
+ subject.left.should be(operand)
22
22
  subject.right.should be_kind_of(described_class)
23
- subject.right.predicate.should equal(predicate)
23
+ subject.right.predicate.should be(predicate)
24
24
  end
25
25
 
26
- its(:predicate) { should equal(predicate) }
26
+ its(:predicate) { should be(predicate) }
27
27
 
28
28
  it 'filters out tuples from the other relation not matching the predicate' do
29
- should == [ [ 1 ], [ 2 ] ]
29
+ should == [[1], [2]]
30
30
  end
31
31
  end
32
32
 
@@ -3,11 +3,11 @@
3
3
  require 'spec_helper'
4
4
 
5
5
  describe Algebra::Restriction::Methods, '#restrict' do
6
- let(:object) { described_class.new(header, body) }
7
- let(:header) { [ [ :id, Integer ], [ :name, String ] ] }
8
- let(:body) { LazyEnumerable.new([ [ 1, 'Dan Kubb' ], [ 2, 'Alex Kubb' ] ]) }
9
- let(:described_class) { Relation }
10
- let(:tautology) { Function::Proposition::Tautology.instance }
6
+ let(:object) { described_class.new(header, body) }
7
+ let(:header) { [[:id, Integer], [:name, String]] }
8
+ let(:body) { LazyEnumerable.new([[1, 'Dan Kubb'], [2, 'Alex Kubb']]) }
9
+ let(:described_class) { Relation }
10
+ let(:tautology) { Function::Proposition::Tautology.instance }
11
11
 
12
12
  context 'with a predicate' do
13
13
  subject { object.restrict(predicate) }
@@ -17,7 +17,7 @@ describe Algebra::Restriction::Methods, '#restrict' do
17
17
  it { should be_instance_of(Algebra::Restriction) }
18
18
 
19
19
  it 'sets the predicate' do
20
- subject.predicate.should equal(predicate)
20
+ subject.predicate.should be(predicate)
21
21
  end
22
22
 
23
23
  it 'behaves the same as Enumerable#select' do
@@ -44,26 +44,23 @@ describe Algebra::Restriction::Methods, '#restrict' do
44
44
  context 'with a Hash' do
45
45
  subject { object.restrict(predicate) }
46
46
 
47
- let(:predicate) { { :id => 1, :name => 'Dan Kubb' } }
47
+ let(:predicate) { { id: 1, name: 'Dan Kubb' } }
48
48
 
49
49
  it { should be_instance_of(Algebra::Restriction) }
50
50
 
51
- # Hash order is not guaranteed except under 1.9+
52
- if RUBY_VERSION >= '1.9'
53
- it 'sets the predicate' do
54
- subject.predicate.should eql(tautology.and(object[:id].eq(1).and(object[:name].eq('Dan Kubb'))))
55
- end
51
+ it 'sets the predicate' do
52
+ subject.predicate.should eql(tautology.and(object[:id].eq(1).and(object[:name].eq('Dan Kubb'))))
56
53
  end
57
54
 
58
55
  it 'behaves the same as Enumerable#select' do
59
- should == object.select { |tuple| tuple[:id] == 1 and tuple[:name] == 'Dan Kubb' }
56
+ should == object.select { |tuple| tuple[:id] == 1 && tuple[:name] == 'Dan Kubb' }
60
57
  end
61
58
  end
62
59
 
63
60
  context 'with an Array' do
64
61
  subject { object.restrict(predicate) }
65
62
 
66
- let(:predicate) { [ [ :id, 1 ], [ :name, 'Dan Kubb' ] ] }
63
+ let(:predicate) { [[:id, 1], [:name, 'Dan Kubb']] }
67
64
 
68
65
  it { should be_instance_of(Algebra::Restriction) }
69
66
 
@@ -72,7 +69,7 @@ describe Algebra::Restriction::Methods, '#restrict' do
72
69
  end
73
70
 
74
71
  it 'behaves the same as Enumerable#select' do
75
- should == object.select { |tuple| tuple[:id] == 1 and tuple[:name] == 'Dan Kubb' }
72
+ should == object.select { |tuple| tuple[:id] == 1 && tuple[:name] == 'Dan Kubb' }
76
73
  end
77
74
  end
78
75
  end
@@ -5,11 +5,11 @@ require 'spec_helper'
5
5
  describe Algebra::Restriction, '#predicate' do
6
6
  subject { object.predicate }
7
7
 
8
- let(:relation) { Relation.new([ [ :id, Integer ] ], [ [ 1 ] ]) }
9
- let(:predicate) { relation[:id].ne(0) }
10
- let(:object) { described_class.new(relation, predicate) }
8
+ let(:relation) { Relation.new([[:id, Integer]], [[1]]) }
9
+ let(:predicate) { relation[:id].ne(0) }
10
+ let(:object) { described_class.new(relation, predicate) }
11
11
 
12
12
  it_should_behave_like 'an idempotent method'
13
13
 
14
- it { should equal(predicate) }
14
+ it { should be(predicate) }
15
15
  end
@@ -5,13 +5,13 @@ require 'spec_helper'
5
5
  describe Algebra::Summarization, '.new' do
6
6
  subject { object.new(operand, summarize_per, summarizers) }
7
7
 
8
- let(:header) { [ [ :id, Integer ], [ :name, String ] ] }
9
- let(:operand) { Relation.new(header, [ [ 1, 'John Doe' ], [ 2, 'Jane Doe' ] ]) }
10
- let(:summarizers) { {} }
11
- let(:object) { described_class }
8
+ let(:header) { [[:id, Integer], [:name, String]] }
9
+ let(:operand) { Relation.new(header, [[1, 'John Doe'], [2, 'Jane Doe']]) }
10
+ let(:summarizers) { {} }
11
+ let(:object) { described_class }
12
12
 
13
13
  context 'with a summarize_per that has a subset of the headers in the operand' do
14
- let(:summarize_per) { Relation.new([ [ :id, Integer ] ], [ [ 1 ], [ 2 ] ]) }
14
+ let(:summarize_per) { Relation.new([[:id, Integer]], [[1], [2]]) }
15
15
 
16
16
  it { should be_instance_of(object) }
17
17
  end
@@ -23,7 +23,7 @@ describe Algebra::Summarization, '.new' do
23
23
  end
24
24
 
25
25
  context 'with a summarize_per that has a superset of the headers in the operand' do
26
- let(:summarize_per) { Relation.new([ [ :id, Integer ], [ :name, String ] ], [ [ 1, 'Dan Kubb' ] ]) }
26
+ let(:summarize_per) { Relation.new([[:id, Integer], [:name, String]], [[1, 'Dan Kubb']]) }
27
27
 
28
28
  specify { expect { subject }.to raise_error(InvalidHeaderError, 'the summarize_per header must be a proper subset of the operand header') }
29
29
  end
@@ -6,10 +6,10 @@ describe Algebra::Summarization, '#delete' do
6
6
  subject { object.delete(other) }
7
7
 
8
8
  let(:object) { described_class.new(operand, summarize_by, summarizers) }
9
- let(:other) { stub('other') }
10
- let(:operand) { Relation.new([ [ :id, Integer ] ], []) }
9
+ let(:other) { double('other') }
10
+ let(:operand) { Relation.new([[:id, Integer]], []) }
11
11
  let(:summarize_by) { operand.project([]) }
12
- let(:summarizers) { { :test => 1 } }
12
+ let(:summarizers) { { test: 1 } }
13
13
 
14
14
  specify { expect { subject }.to raise_error(ImmutableRelationError, 'deleting from a summarization is impossible') }
15
15
  end
@@ -6,8 +6,8 @@ describe Algebra::Summarization, '#each' do
6
6
  subject { object.each { |tuple| yields << tuple } }
7
7
 
8
8
  let(:object) { described_class.new(operand, operand.project([]), summarizers) }
9
- let(:operand) { Relation.new([ [ :id, Integer ] ], [ [ 1 ], [ 2 ] ]) }
10
- let(:summarizers) { { :count => lambda { |acc, tuple| acc.to_i + 1 } } }
9
+ let(:operand) { Relation.new([[:id, Integer]], [[1], [2]]) }
10
+ let(:summarizers) { { count: ->(acc, tuple) { acc.to_i + 1 } } }
11
11
  let(:yields) { [] }
12
12
 
13
13
  it_should_behave_like 'an #each method'
@@ -23,8 +23,8 @@ describe Algebra::Summarization, '#each' do
23
23
  end
24
24
 
25
25
  it 'yields only tuples with the expected data' do
26
- expect { subject }.to change { yields.dup }.
27
- from([]).
28
- to([ [ 2 ] ])
26
+ expect { subject }.to change { yields.dup }
27
+ .from([])
28
+ .to([[2]])
29
29
  end
30
30
  end
@@ -5,9 +5,9 @@ require 'spec_helper'
5
5
  describe Algebra::Summarization, '#eql?' do
6
6
  subject { object.eql?(other) }
7
7
 
8
- let(:operand) { Relation.new([ [ :id, Integer ] ], [ [ 1 ], [ 2 ] ]) }
8
+ let(:operand) { Relation.new([[:id, Integer]], [[1], [2]]) }
9
9
  let(:summarize_by) { operand.project([]) }
10
- let(:summarizers) { { :count => lambda { |acc, tuple| acc.to_i + 1 } } }
10
+ let(:summarizers) { { count: ->(acc, tuple) { acc.to_i + 1 } } }
11
11
  let(:object) { described_class.new(operand, summarize_by, summarizers) }
12
12
 
13
13
  context 'with the same object' do
@@ -41,7 +41,7 @@ describe Algebra::Summarization, '#eql?' do
41
41
  end
42
42
 
43
43
  context 'with an object having a different operand' do
44
- let(:other_operand) { Relation.new([ [ :id, Integer ] ], [ [ 3 ] ]) }
44
+ let(:other_operand) { Relation.new([[:id, Integer]], [[3]]) }
45
45
  let(:other_summarize_by) { summarize_by }
46
46
  let(:other_summarizers) { summarizers }
47
47
  let(:other) { described_class.new(other_operand, other_summarize_by, other_summarizers) }
@@ -5,9 +5,9 @@ require 'spec_helper'
5
5
  describe Algebra::Summarization, '#hash' do
6
6
  subject { object.hash }
7
7
 
8
- let(:operand) { Relation.new([ [ :id, Integer ] ], [ [ 1 ], [ 2 ] ]) }
8
+ let(:operand) { Relation.new([[:id, Integer]], [[1], [2]]) }
9
9
  let(:summarize_by) { operand.project([]) }
10
- let(:summarizers) { { :count => lambda { |acc, tuple| acc.to_i + 1 } } }
10
+ let(:summarizers) { { count: ->(acc, tuple) { acc.to_i + 1 } } }
11
11
  let(:object) { described_class.new(operand, summarize_by, summarizers) }
12
12
 
13
13
  it_should_behave_like 'a hash method'
@@ -5,13 +5,13 @@ require 'spec_helper'
5
5
  describe Algebra::Summarization, '#header' do
6
6
  subject { object.header }
7
7
 
8
- let(:operand) { Relation.new([ [ :id, Integer ] ], [ [ 1 ], [ 2 ] ]) }
9
- let(:summarizers) { { :test => lambda { |acc, tuple| 1 } } }
8
+ let(:operand) { Relation.new([[:id, Integer]], [[1], [2]]) }
9
+ let(:summarizers) { { test: ->(acc, tuple) { 1 } } }
10
10
  let(:object) { described_class.new(operand, TABLE_DEE, summarizers) }
11
11
 
12
12
  it_should_behave_like 'an idempotent method'
13
13
 
14
14
  it { should be_instance_of(Relation::Header) }
15
15
 
16
- it { should == [ [ :test, Object ] ] }
16
+ it { should == [[:test, Object]] }
17
17
  end
@@ -6,10 +6,10 @@ describe Algebra::Summarization, '#insert' do
6
6
  subject { object.insert(other) }
7
7
 
8
8
  let(:object) { described_class.new(operand, summarize_by, summarizers) }
9
- let(:other) { stub('other') }
10
- let(:operand) { Relation.new([ [ :id, Integer ] ], []) }
9
+ let(:other) { double('other') }
10
+ let(:operand) { Relation.new([[:id, Integer]], []) }
11
11
  let(:summarize_by) { operand.project([]) }
12
- let(:summarizers) { { :test => 1 } }
12
+ let(:summarizers) { { test: 1 } }
13
13
 
14
14
  specify { expect { subject }.to raise_error(ImmutableRelationError, 'inserting into a summarization is impossible') }
15
15
  end
@@ -5,20 +5,20 @@ require 'spec_helper'
5
5
  describe Algebra::Summarization::Methods, '#summarize' do
6
6
  subject { object.summarize(summarize_with, &block) }
7
7
 
8
- let(:object) { described_class.new([ [ :id, Integer ], [ :name, String ] ], LazyEnumerable.new([ [ 1, 'Dan Kubb' ] ])) }
9
- let(:described_class) { Relation }
10
- let(:block) { lambda { |r| r.add(:test, r.id.count) } }
11
- let(:summarizers) { [ :test, function ] }
12
- let(:function) { object[:id].count }
8
+ let(:object) { described_class.new([[:id, Integer], [:name, String]], LazyEnumerable.new([[1, 'Dan Kubb']])) }
9
+ let(:described_class) { Relation }
10
+ let(:block) { ->(r) { r.add(:test, r.id.count) } }
11
+ let(:summarizers) { [:test, function] }
12
+ let(:function) { object[:id].count }
13
13
 
14
14
  context 'with no arguments' do
15
15
  subject { object.summarize(&block) }
16
16
 
17
17
  it { should be_instance_of(Algebra::Summarization) }
18
18
 
19
- its(:operand) { should equal(object) }
19
+ its(:operand) { should be(object) }
20
20
 
21
- its(:summarize_per) { should equal(TABLE_DEE) }
21
+ its(:summarize_per) { should be(TABLE_DEE) }
22
22
 
23
23
  its(:summarizers) { should eql(Attribute::Integer.new(:test) => function) }
24
24
  end
@@ -28,9 +28,9 @@ describe Algebra::Summarization::Methods, '#summarize' do
28
28
 
29
29
  it { should be_instance_of(Algebra::Summarization) }
30
30
 
31
- its(:operand) { should equal(object) }
31
+ its(:operand) { should be(object) }
32
32
 
33
- its(:summarize_per) { should equal(summarize_with) }
33
+ its(:summarize_per) { should be(summarize_with) }
34
34
 
35
35
  its(:summarizers) { should eql(Attribute::Integer.new(:test) => function) }
36
36
  end
@@ -40,7 +40,7 @@ describe Algebra::Summarization::Methods, '#summarize' do
40
40
 
41
41
  it { should be_instance_of(Algebra::Summarization) }
42
42
 
43
- its(:operand) { should equal(object) }
43
+ its(:operand) { should be(object) }
44
44
 
45
45
  its(:summarize_per) { should eql(object.project(summarize_with)) }
46
46
 
@@ -48,11 +48,11 @@ describe Algebra::Summarization::Methods, '#summarize' do
48
48
  end
49
49
 
50
50
  context 'with attributes' do
51
- let(:summarize_with) { [ :name ] }
51
+ let(:summarize_with) { [:name] }
52
52
 
53
53
  it { should be_instance_of(Algebra::Summarization) }
54
54
 
55
- its(:operand) { should equal(object) }
55
+ its(:operand) { should be(object) }
56
56
 
57
57
  its(:summarize_per) { should eql(object.project(summarize_with)) }
58
58
 
@@ -65,7 +65,7 @@ describe Algebra::Summarization::Methods, '#summarize' do
65
65
  let(:summarize_with) { object.project([]) }
66
66
  let(:summarizers) { { Attribute::Object.new(:test) => function } }
67
67
 
68
- its(:operand) { should equal(object) }
68
+ its(:operand) { should be(object) }
69
69
 
70
70
  its(:summarize_per) { should eql(summarize_with) }
71
71
 
@@ -73,8 +73,8 @@ describe Algebra::Summarization::Methods, '#summarize' do
73
73
  end
74
74
 
75
75
  context 'with a header containing an attribute used in the context block' do
76
- let(:summarize_with) { object.project([ :id ]) }
77
- let(:block) { lambda { |r| r.add(:count, r.id.count) } }
76
+ let(:summarize_with) { object.project([:id]) }
77
+ let(:block) { ->(r) { r.add(:count, r.id.count) } }
78
78
 
79
79
  specify { expect { subject }.to raise_error(NoMethodError) }
80
80
  end
@@ -5,12 +5,12 @@ require 'spec_helper'
5
5
  describe Algebra::Summarization::Summaries, '#summarize_by' do
6
6
  subject { object.summarize_by(tuple) }
7
7
 
8
- let(:object) { described_class.new(header, summarizers) }
9
- let(:summarizers) { { :count => summarizer } }
10
- let(:summarizer) { mock('Summarizer', :call => 1) }
11
- let(:header) { Relation::Header.coerce([ [ :id, Integer ] ]) }
12
- let(:tuple_header) { Relation::Header.coerce([ [ :id, Integer ], [ :name, String ] ]) }
13
- let(:tuple) { Tuple.new(tuple_header, [ 1, 'Dan Kubb' ]) }
8
+ let(:object) { described_class.new(header, summarizers) }
9
+ let(:summarizers) { { count: summarizer } }
10
+ let(:summarizer) { double('Summarizer', call: 1) }
11
+ let(:header) { Relation::Header.coerce([[:id, Integer]]) }
12
+ let(:tuple_header) { Relation::Header.coerce([[:id, Integer], [:name, String]]) }
13
+ let(:tuple) { Tuple.new(tuple_header, [1, 'Dan Kubb']) }
14
14
 
15
15
  it_should_behave_like 'a command method'
16
16
 
@@ -6,8 +6,8 @@ describe Algebra::Summarization::Summaries, '#to_hash' do
6
6
  subject { object.to_hash }
7
7
 
8
8
  let(:object) { described_class.new(header, summarizers) }
9
- let(:header) { mock('Header') }
10
- let(:summarizers) { { :count => mock('Summarizer') } }
9
+ let(:header) { double('Header') }
10
+ let(:summarizers) { { count: double('Summarizer') } }
11
11
 
12
12
  it 'matches the expected value' do
13
13
  key, value = subject.first
@@ -5,11 +5,11 @@ require 'spec_helper'
5
5
  describe Algebra::Summarization, '#summarize_per' do
6
6
  subject { object.summarize_per }
7
7
 
8
- let(:operand) { Relation.new([ [ :id, Integer ] ], [ [ 1 ], [ 2 ] ]) }
9
- let(:summarizers) { { :test => lambda { |acc, tuple| 1 } } }
8
+ let(:operand) { Relation.new([[:id, Integer]], [[1], [2]]) }
9
+ let(:summarizers) { { test: ->(acc, tuple) { 1 } } }
10
10
  let(:object) { described_class.new(operand, TABLE_DEE, summarizers) }
11
11
 
12
12
  it_should_behave_like 'an idempotent method'
13
13
 
14
- it { should equal(TABLE_DEE) }
14
+ it { should be(TABLE_DEE) }
15
15
  end
@@ -5,11 +5,11 @@ require 'spec_helper'
5
5
  describe Algebra::Summarization, '#summarizers' do
6
6
  subject { object.summarizers }
7
7
 
8
- let(:operand) { Relation.new([ [ :id, Integer ] ], [ [ 1 ], [ 2 ] ]) }
9
- let(:summarizers) { { :test => lambda { |acc, tuple| 1 } } }
8
+ let(:operand) { Relation.new([[:id, Integer]], [[1], [2]]) }
9
+ let(:summarizers) { { test: ->(acc, tuple) { 1 } } }
10
10
  let(:object) { described_class.new(operand, TABLE_DEE, summarizers) }
11
11
 
12
12
  it_should_behave_like 'an idempotent method'
13
13
 
14
- it { should equal(summarizers) }
14
+ it { should be(summarizers) }
15
15
  end
@@ -5,12 +5,12 @@ require 'spec_helper'
5
5
  describe Algebra::Summarization::Summary, '#call' do
6
6
  subject { object.call(tuple) }
7
7
 
8
- let(:object) { described_class.new(summarizer) }
9
- let(:header) { Relation::Header.coerce([ [ :id, Integer ] ]) }
10
- let(:tuple) { Tuple.new(header, [ 1 ]) }
8
+ let(:object) { described_class.new(summarizer) }
9
+ let(:header) { Relation::Header.coerce([[:id, Integer]]) }
10
+ let(:tuple) { Tuple.new(header, [1]) }
11
11
 
12
12
  context 'when the summarizer is a Proc' do
13
- let(:summarizer) { lambda { |accumulator, tuple| accumulator.to_i.succ } }
13
+ let(:summarizer) { ->(accumulator, tuple) { accumulator.to_i.succ } }
14
14
 
15
15
  context 'when there is no summary' do
16
16
  it { should be_nil }