veritas 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/.gemtest +0 -0
- data/.rvmrc +1 -0
- data/.travis.yml +8 -0
- data/Gemfile +20 -10
- data/Guardfile +22 -0
- data/README.rdoc +5 -6
- data/Rakefile +4 -2
- data/TODO +18 -23
- data/config/flay.yml +1 -1
- data/config/flog.yml +1 -1
- data/config/roodi.yml +1 -1
- data/config/site.reek +3 -3
- data/lib/veritas/aggregate/count.rb +55 -0
- data/lib/veritas/aggregate/maximum.rb +59 -0
- data/lib/veritas/aggregate/mean.rb +81 -0
- data/lib/veritas/aggregate/minimum.rb +59 -0
- data/lib/veritas/aggregate/standard_deviation.rb +58 -0
- data/lib/veritas/aggregate/sum.rb +81 -0
- data/lib/veritas/aggregate/variance.rb +81 -0
- data/lib/veritas/aggregate.rb +116 -0
- data/lib/veritas/algebra/difference.rb +3 -1
- data/lib/veritas/algebra/extension.rb +12 -10
- data/lib/veritas/algebra/intersection.rb +3 -1
- data/lib/veritas/algebra/join.rb +17 -15
- data/lib/veritas/algebra/product.rb +4 -2
- data/lib/veritas/algebra/projection.rb +4 -3
- data/lib/veritas/algebra/rename/aliases.rb +6 -4
- data/lib/veritas/algebra/rename.rb +12 -3
- data/lib/veritas/algebra/restriction.rb +13 -12
- data/lib/veritas/algebra/summarization/summaries.rb +59 -0
- data/lib/veritas/algebra/summarization/summary.rb +83 -0
- data/lib/veritas/algebra/summarization.rb +88 -75
- data/lib/veritas/algebra/union.rb +4 -2
- data/lib/veritas/attribute/boolean.rb +5 -3
- data/lib/veritas/attribute/class.rb +2 -0
- data/lib/veritas/attribute/comparable.rb +11 -5
- data/lib/veritas/attribute/date.rb +2 -0
- data/lib/veritas/attribute/date_time.rb +2 -0
- data/lib/veritas/attribute/decimal.rb +2 -0
- data/lib/veritas/attribute/float.rb +4 -0
- data/lib/veritas/attribute/integer.rb +2 -0
- data/lib/veritas/attribute/numeric.rb +6 -4
- data/lib/veritas/attribute/object.rb +7 -4
- data/lib/veritas/attribute/orderable.rb +2 -0
- data/lib/veritas/attribute/string.rb +39 -13
- data/lib/veritas/attribute/time.rb +2 -0
- data/lib/veritas/attribute.rb +92 -36
- data/lib/veritas/core_ext/date.rb +2 -0
- data/lib/veritas/core_ext/range.rb +2 -0
- data/lib/veritas/core_ext/time.rb +2 -0
- data/lib/veritas/function/binary.rb +107 -0
- data/lib/veritas/function/comparable.rb +55 -0
- data/lib/veritas/{logic → function}/connective/conjunction.rb +24 -6
- data/lib/veritas/{logic → function}/connective/disjunction.rb +24 -6
- data/lib/veritas/{logic → function}/connective/negation.rb +34 -13
- data/lib/veritas/function/connective.rb +21 -0
- data/lib/veritas/function/numeric/absolute.rb +62 -0
- data/lib/veritas/function/numeric/addition.rb +62 -0
- data/lib/veritas/function/numeric/binary.rb +26 -0
- data/lib/veritas/function/numeric/division.rb +71 -0
- data/lib/veritas/function/numeric/exponentiation.rb +68 -0
- data/lib/veritas/function/numeric/modulo.rb +53 -0
- data/lib/veritas/function/numeric/multiplication.rb +62 -0
- data/lib/veritas/function/numeric/square_root.rb +86 -0
- data/lib/veritas/function/numeric/subtraction.rb +62 -0
- data/lib/veritas/function/numeric/unary.rb +23 -0
- data/lib/veritas/function/numeric/unary_minus.rb +74 -0
- data/lib/veritas/function/numeric/unary_plus.rb +76 -0
- data/lib/veritas/function/numeric.rb +11 -0
- data/lib/veritas/{logic → function}/predicate/enumerable.rb +4 -2
- data/lib/veritas/{logic → function}/predicate/equality.rb +5 -3
- data/lib/veritas/{logic → function}/predicate/exclusion.rb +5 -5
- data/lib/veritas/{logic → function}/predicate/greater_than.rb +5 -3
- data/lib/veritas/{logic → function}/predicate/greater_than_or_equal_to.rb +5 -3
- data/lib/veritas/{logic → function}/predicate/inclusion.rb +5 -5
- data/lib/veritas/{logic → function}/predicate/inequality.rb +4 -2
- data/lib/veritas/{logic → function}/predicate/less_than.rb +5 -3
- data/lib/veritas/{logic → function}/predicate/less_than_or_equal_to.rb +5 -3
- data/lib/veritas/{logic → function}/predicate/match.rb +17 -3
- data/lib/veritas/{logic → function}/predicate/no_match.rb +5 -3
- data/lib/veritas/function/predicate.rb +26 -0
- data/lib/veritas/{logic → function}/proposition/contradiction.rb +7 -4
- data/lib/veritas/{logic → function}/proposition/tautology.rb +7 -4
- data/lib/veritas/{logic → function}/proposition.rb +29 -4
- data/lib/veritas/function/string/length.rb +68 -0
- data/lib/veritas/{logic/connective → function}/unary.rb +48 -12
- data/lib/veritas/function.rb +128 -0
- data/lib/veritas/relation/base.rb +38 -0
- data/lib/veritas/relation/empty.rb +2 -0
- data/lib/veritas/relation/header.rb +14 -37
- data/lib/veritas/relation/materialized.rb +9 -0
- data/lib/veritas/relation/operation/binary.rb +3 -2
- data/lib/veritas/relation/operation/combination.rb +2 -0
- data/lib/veritas/relation/operation/limit.rb +11 -1
- data/lib/veritas/relation/operation/offset.rb +11 -1
- data/lib/veritas/relation/operation/order/direction.rb +2 -0
- data/lib/veritas/relation/operation/order/direction_set.rb +5 -3
- data/lib/veritas/relation/operation/order.rb +15 -7
- data/lib/veritas/relation/operation/reverse.rb +4 -2
- data/lib/veritas/relation/operation/set.rb +2 -0
- data/lib/veritas/relation/operation/unary.rb +3 -2
- data/lib/veritas/relation.rb +9 -6
- data/lib/veritas/support/abstract_class.rb +2 -0
- data/lib/veritas/support/aliasable.rb +2 -0
- data/lib/veritas/support/evaluator.rb +37 -16
- data/lib/veritas/support/immutable.rb +5 -5
- data/lib/veritas/support/operation/binary.rb +2 -0
- data/lib/veritas/support/operation/unary.rb +2 -0
- data/lib/veritas/support/visitable.rb +2 -0
- data/lib/veritas/tuple.rb +13 -9
- data/lib/veritas/version.rb +3 -1
- data/lib/veritas.rb +60 -25
- data/spec/integration/veritas/algebra/join_spec.rb +2 -0
- data/spec/integration/veritas/algebra/product_spec.rb +2 -0
- data/spec/integration/veritas/algebra/projection_spec.rb +2 -0
- data/spec/integration/veritas/algebra/summarization_spec.rb +9 -9
- data/spec/integration/veritas/relation/efficient_enumerable_spec.rb +2 -0
- data/spec/shared/command_method_behavior.rb +2 -0
- data/spec/shared/each_method_behaviour.rb +2 -0
- data/spec/shared/hash_method_behavior.rb +2 -0
- data/spec/shared/idempotent_method_behavior.rb +2 -0
- data/spec/spec_helper.rb +13 -0
- data/spec/unit/date/pred_spec.rb +2 -0
- data/spec/unit/range/overlaps_spec.rb +2 -0
- data/spec/unit/range/to_inclusive_spec.rb +2 -0
- data/spec/unit/time/pred_spec.rb +2 -0
- data/spec/unit/veritas/abstract_class/class_methods/new_spec.rb +2 -0
- data/spec/unit/veritas/aggregate/call_spec.rb +43 -0
- data/spec/unit/veritas/{logic/proposition → aggregate}/class_methods/call_spec.rb +3 -1
- data/spec/unit/veritas/aggregate/class_methods/default_spec.rb +11 -0
- data/spec/unit/veritas/aggregate/class_methods/finalize_spec.rb +12 -0
- data/spec/unit/veritas/aggregate/count/class_methods/call_spec.rb +30 -0
- data/spec/unit/veritas/aggregate/count/class_methods/default_spec.rb +13 -0
- data/spec/unit/veritas/aggregate/count/methods/count_spec.rb +14 -0
- data/spec/unit/veritas/aggregate/count/type_spec.rb +12 -0
- data/spec/unit/veritas/aggregate/default_spec.rb +17 -0
- data/spec/unit/veritas/aggregate/finalize_spec.rb +18 -0
- data/spec/unit/veritas/aggregate/maximum/class_methods/call_spec.rb +36 -0
- data/spec/unit/veritas/aggregate/maximum/class_methods/default_spec.rb +13 -0
- data/spec/unit/veritas/aggregate/maximum/methods/maximum_spec.rb +16 -0
- data/spec/unit/veritas/aggregate/maximum/type_spec.rb +20 -0
- data/spec/unit/veritas/aggregate/mean/class_methods/call_spec.rb +30 -0
- data/spec/unit/veritas/aggregate/mean/class_methods/default_spec.rb +15 -0
- data/spec/unit/veritas/aggregate/mean/class_methods/finalize_spec.rb +16 -0
- data/spec/unit/veritas/aggregate/mean/methods/mean_spec.rb +16 -0
- data/spec/unit/veritas/aggregate/mean/type_spec.rb +12 -0
- data/spec/unit/veritas/aggregate/minimum/class_methods/call_spec.rb +36 -0
- data/spec/unit/veritas/aggregate/minimum/class_methods/default_spec.rb +13 -0
- data/spec/unit/veritas/aggregate/minimum/methods/minimum_spec.rb +16 -0
- data/spec/unit/veritas/aggregate/minimum/type_spec.rb +20 -0
- data/spec/unit/veritas/aggregate/standard_deviation/class_methods/finalize_spec.rb +34 -0
- data/spec/unit/veritas/aggregate/standard_deviation/methods/standard_deviation_spec.rb +16 -0
- data/spec/unit/veritas/aggregate/standard_deviation/type_spec.rb +12 -0
- data/spec/unit/veritas/aggregate/sum/class_methods/call_spec.rb +30 -0
- data/spec/unit/veritas/aggregate/sum/class_methods/default_spec.rb +13 -0
- data/spec/unit/veritas/aggregate/sum/default_spec.rb +27 -0
- data/spec/unit/veritas/aggregate/sum/methods/sum_spec.rb +14 -0
- data/spec/unit/veritas/aggregate/sum/type_spec.rb +20 -0
- data/spec/unit/veritas/aggregate/type_spec.rb +13 -0
- data/spec/unit/veritas/aggregate/variance/class_methods/call_spec.rb +30 -0
- data/spec/unit/veritas/aggregate/variance/class_methods/default_spec.rb +15 -0
- data/spec/unit/veritas/aggregate/variance/class_methods/finalize_spec.rb +26 -0
- data/spec/unit/veritas/aggregate/variance/methods/variance_spec.rb +16 -0
- data/spec/unit/veritas/aggregate/variance/type_spec.rb +12 -0
- data/spec/unit/veritas/algebra/difference/each_spec.rb +2 -0
- data/spec/unit/veritas/algebra/difference/methods/difference_spec.rb +2 -0
- data/spec/unit/veritas/algebra/extension/class_methods/new_spec.rb +2 -0
- data/spec/unit/veritas/algebra/extension/each_spec.rb +2 -0
- data/spec/unit/veritas/algebra/extension/eql_spec.rb +2 -0
- data/spec/unit/veritas/algebra/extension/extensions_spec.rb +2 -0
- data/spec/unit/veritas/algebra/extension/hash_spec.rb +2 -0
- data/spec/unit/veritas/algebra/extension/header_spec.rb +2 -0
- data/spec/unit/veritas/algebra/extension/methods/extend_spec.rb +2 -0
- data/spec/unit/veritas/algebra/extension/operand_spec.rb +2 -0
- data/spec/unit/veritas/algebra/intersection/each_spec.rb +2 -0
- data/spec/unit/veritas/algebra/intersection/methods/intersect_spec.rb +2 -0
- data/spec/unit/veritas/algebra/join/class_methods/new_spec.rb +2 -0
- data/spec/unit/veritas/algebra/join/each_spec.rb +2 -0
- data/spec/unit/veritas/algebra/join/methods/join_spec.rb +3 -14
- data/spec/unit/veritas/algebra/product/class_methods/new_spec.rb +2 -0
- data/spec/unit/veritas/algebra/product/each_spec.rb +2 -0
- data/spec/unit/veritas/algebra/product/methods/product_spec.rb +2 -0
- data/spec/unit/veritas/algebra/projection/each_spec.rb +2 -0
- data/spec/unit/veritas/algebra/projection/eql_spec.rb +2 -0
- data/spec/unit/veritas/algebra/projection/hash_spec.rb +2 -0
- data/spec/unit/veritas/algebra/projection/header_spec.rb +2 -0
- data/spec/unit/veritas/algebra/projection/methods/project_spec.rb +2 -0
- data/spec/unit/veritas/algebra/projection/methods/remove_spec.rb +2 -0
- data/spec/unit/veritas/algebra/rename/aliases/class_methods/coerce_spec.rb +2 -0
- data/spec/unit/veritas/algebra/rename/aliases/class_methods/new_spec.rb +2 -0
- data/spec/unit/veritas/algebra/rename/aliases/each_spec.rb +2 -0
- data/spec/unit/veritas/algebra/rename/aliases/element_reference_spec.rb +2 -0
- data/spec/unit/veritas/algebra/rename/aliases/empty_spec.rb +2 -0
- data/spec/unit/veritas/algebra/rename/aliases/eql_spec.rb +2 -0
- data/spec/unit/veritas/algebra/rename/aliases/equal_value_spec.rb +2 -0
- data/spec/unit/veritas/algebra/rename/aliases/hash_spec.rb +2 -0
- data/spec/unit/veritas/algebra/rename/aliases/to_hash_spec.rb +2 -0
- data/spec/unit/veritas/algebra/rename/aliases/union_spec.rb +2 -0
- data/spec/unit/veritas/algebra/rename/aliases_spec.rb +2 -0
- data/spec/unit/veritas/algebra/rename/directions_spec.rb +4 -2
- data/spec/unit/veritas/algebra/rename/each_spec.rb +2 -0
- data/spec/unit/veritas/algebra/rename/eql_spec.rb +2 -0
- data/spec/unit/veritas/algebra/rename/hash_spec.rb +2 -0
- data/spec/unit/veritas/algebra/rename/header_spec.rb +2 -0
- data/spec/unit/veritas/algebra/rename/methods/rename_spec.rb +2 -0
- data/spec/unit/veritas/algebra/restriction/each_spec.rb +36 -6
- data/spec/unit/veritas/algebra/restriction/eql_spec.rb +2 -0
- data/spec/unit/veritas/algebra/restriction/hash_spec.rb +2 -0
- data/spec/unit/veritas/algebra/restriction/methods/restrict_spec.rb +9 -26
- data/spec/unit/veritas/algebra/restriction/predicate_spec.rb +2 -0
- data/spec/unit/veritas/algebra/summarization/class_methods/new_spec.rb +30 -0
- data/spec/unit/veritas/algebra/summarization/each_spec.rb +2 -0
- data/spec/unit/veritas/algebra/summarization/eql_spec.rb +2 -0
- data/spec/unit/veritas/algebra/summarization/hash_spec.rb +2 -0
- data/spec/unit/veritas/algebra/summarization/header_spec.rb +4 -2
- data/spec/unit/veritas/algebra/summarization/methods/summarize_spec.rb +19 -10
- data/spec/unit/veritas/algebra/summarization/summaries/summarize_by_spec.rb +26 -0
- data/spec/unit/veritas/algebra/summarization/summaries/to_hash_spec.rb +16 -0
- data/spec/unit/veritas/algebra/summarization/{summarize_by_spec.rb → summarize_per_spec.rb} +6 -4
- data/spec/unit/veritas/algebra/summarization/summarizers_spec.rb +3 -1
- data/spec/unit/veritas/algebra/summarization/summary/call_spec.rb +43 -0
- data/spec/unit/veritas/algebra/summarization/summary/summarize_by_spec.rb +20 -0
- data/spec/unit/veritas/algebra/union/each_spec.rb +2 -0
- data/spec/unit/veritas/algebra/union/methods/union_spec.rb +2 -0
- data/spec/unit/veritas/aliasable/fixtures/classes.rb +2 -0
- data/spec/unit/veritas/aliasable/inheritable_alias_spec.rb +3 -1
- data/spec/unit/veritas/attribute/boolean/class_methods/primitive_spec.rb +2 -0
- data/spec/unit/veritas/attribute/boolean/valid_value_spec.rb +2 -0
- data/spec/unit/veritas/attribute/call_spec.rb +2 -0
- data/spec/unit/veritas/attribute/class/class_methods/primitive_spec.rb +2 -0
- data/spec/unit/veritas/attribute/class_methods/coerce_spec.rb +36 -0
- data/spec/unit/veritas/attribute/class_methods/descendants_spec.rb +27 -0
- data/spec/unit/veritas/attribute/class_methods/infer_type_spec.rb +121 -0
- data/spec/unit/veritas/attribute/class_methods/inherited_spec.rb +25 -0
- data/spec/unit/veritas/attribute/class_methods/name_from_spec.rb +2 -0
- data/spec/unit/veritas/attribute/class_methods/new_spec.rb +2 -0
- data/spec/unit/veritas/attribute/comparable/comparable_spec.rb +3 -3
- data/spec/unit/veritas/attribute/comparable/fixtures/classes.rb +2 -0
- data/spec/unit/veritas/attribute/date/class_methods/primitive_spec.rb +2 -0
- data/spec/unit/veritas/attribute/date/range_spec.rb +2 -0
- data/spec/unit/veritas/attribute/date_time/class_methods/primitive_spec.rb +2 -0
- data/spec/unit/veritas/attribute/date_time/range_spec.rb +2 -0
- data/spec/unit/veritas/attribute/decimal/class_methods/primitive_spec.rb +2 -0
- data/spec/unit/veritas/attribute/eql_spec.rb +2 -0
- data/spec/unit/veritas/attribute/equal_value_spec.rb +2 -0
- data/spec/unit/veritas/attribute/float/class_methods/primitive_spec.rb +2 -0
- data/spec/unit/veritas/attribute/float/size_spec.rb +21 -0
- data/spec/unit/veritas/attribute/hash_spec.rb +2 -0
- data/spec/unit/veritas/attribute/inspect_spec.rb +2 -0
- data/spec/unit/veritas/attribute/integer/class_methods/primitive_spec.rb +2 -0
- data/spec/unit/veritas/attribute/joinable_spec.rb +2 -0
- data/spec/unit/veritas/attribute/name_spec.rb +2 -0
- data/spec/unit/veritas/attribute/numeric/class_methods/primitive_spec.rb +2 -0
- data/spec/unit/veritas/attribute/numeric/joinable_spec.rb +2 -0
- data/spec/unit/veritas/attribute/numeric/size_spec.rb +4 -2
- data/spec/unit/veritas/attribute/numeric/valid_value_spec.rb +2 -0
- data/spec/unit/veritas/attribute/object/class_methods/primitive_spec.rb +2 -0
- data/spec/unit/veritas/attribute/options_spec.rb +2 -0
- data/spec/unit/veritas/attribute/orderable/asc_spec.rb +2 -0
- data/spec/unit/veritas/attribute/orderable/desc_spec.rb +2 -0
- data/spec/unit/veritas/attribute/orderable/fixtures/classes.rb +2 -0
- data/spec/unit/veritas/attribute/rename_spec.rb +2 -0
- data/spec/unit/veritas/attribute/required_spec.rb +2 -0
- data/spec/unit/veritas/attribute/string/class_methods/primitive_spec.rb +2 -0
- data/spec/unit/veritas/attribute/string/joinable_spec.rb +5 -3
- data/spec/unit/veritas/attribute/string/max_length_spec.rb +20 -0
- data/spec/unit/veritas/attribute/string/min_length_spec.rb +20 -0
- data/spec/unit/veritas/attribute/string/valid_value_spec.rb +3 -1
- data/spec/unit/veritas/attribute/time/class_methods/primitive_spec.rb +2 -0
- data/spec/unit/veritas/attribute/time/range_spec.rb +2 -0
- data/spec/unit/veritas/attribute/type_spec.rb +12 -0
- data/spec/unit/veritas/attribute/valid_primitive_spec.rb +2 -0
- data/spec/unit/veritas/attribute/valid_value_spec.rb +2 -0
- data/spec/unit/veritas/evaluator/context/add_spec.rb +46 -0
- data/spec/unit/veritas/evaluator/context/element_reference_spec.rb +14 -0
- data/spec/unit/veritas/evaluator/context/functions_spec.rb +16 -0
- data/spec/unit/veritas/{logic/connective → function}/binary/call_spec.rb +10 -8
- data/spec/unit/veritas/{logic/connective → function}/binary/equal_value_spec.rb +3 -1
- data/spec/unit/veritas/{logic/connective → function}/binary/fixtures/classes.rb +5 -1
- data/spec/unit/veritas/function/binary/invertible/inverse_spec.rb +39 -0
- data/spec/unit/veritas/{logic/connective → function}/binary/rename_spec.rb +3 -1
- data/spec/unit/veritas/{logic/expression → function}/class_methods/call_spec.rb +3 -1
- data/spec/unit/veritas/{logic/predicate → function}/class_methods/extract_value_spec.rb +3 -1
- data/spec/unit/veritas/function/class_methods/rename_attributes_spec.rb +29 -0
- data/spec/unit/veritas/{logic/predicate → function}/comparable/class_methods/call_spec.rb +3 -1
- data/spec/unit/veritas/{logic/predicate → function}/comparable/fixtures/classes.rb +3 -1
- data/spec/unit/veritas/function/comparable/inspect_spec.rb +15 -0
- data/spec/unit/veritas/{logic → function}/connective/conjunction/class_methods/call_spec.rb +3 -1
- data/spec/unit/veritas/{logic → function}/connective/conjunction/inspect_spec.rb +3 -1
- data/spec/unit/veritas/function/connective/conjunction/inverse_spec.rb +24 -0
- data/spec/unit/veritas/{logic → function}/connective/conjunction/methods/and_spec.rb +4 -2
- data/spec/unit/veritas/{logic → function}/connective/conjunction/methods/fixtures/classes.rb +3 -1
- data/spec/unit/veritas/{logic → function}/connective/disjunction/class_methods/call_spec.rb +3 -1
- data/spec/unit/veritas/{logic → function}/connective/disjunction/inspect_spec.rb +3 -1
- data/spec/unit/veritas/function/connective/disjunction/inverse_spec.rb +24 -0
- data/spec/unit/veritas/{logic → function}/connective/disjunction/methods/fixtures/classes.rb +3 -1
- data/spec/unit/veritas/{logic → function}/connective/disjunction/methods/or_spec.rb +4 -2
- data/spec/unit/veritas/function/connective/inspect_spec.rb +12 -0
- data/spec/unit/veritas/{logic → function}/connective/negation/class_methods/call_spec.rb +3 -1
- data/spec/unit/veritas/{logic → function}/connective/negation/inspect_spec.rb +4 -2
- data/spec/unit/veritas/{logic → function}/connective/negation/inverse_spec.rb +3 -1
- data/spec/unit/veritas/function/connective/negation/methods/fixtures/classes.rb +8 -0
- data/spec/unit/veritas/function/connective/negation/methods/not_spec.rb +39 -0
- data/spec/unit/veritas/function/connective/type_spec.rb +12 -0
- data/spec/unit/veritas/function/eql_spec.rb +14 -0
- data/spec/unit/veritas/function/equal_value_spec.rb +14 -0
- data/spec/unit/veritas/function/fixtures/classes.rb +6 -0
- data/spec/unit/veritas/{logic/expression → function}/hash_spec.rb +5 -3
- data/spec/unit/veritas/{logic/expression → function}/inspect_spec.rb +5 -3
- data/spec/unit/veritas/function/numeric/absolute/class_methods/call_spec.rb +21 -0
- data/spec/unit/veritas/function/numeric/absolute/inspect_spec.rb +11 -0
- data/spec/unit/veritas/function/numeric/absolute/methods/absolute_spec.rb +16 -0
- data/spec/unit/veritas/function/numeric/addition/class_methods/call_spec.rb +13 -0
- data/spec/unit/veritas/function/numeric/addition/class_methods/inverse_spec.rb +11 -0
- data/spec/unit/veritas/function/numeric/addition/class_methods/operation_spec.rb +11 -0
- data/spec/unit/veritas/function/numeric/addition/inspect_spec.rb +11 -0
- data/spec/unit/veritas/function/numeric/addition/methods/add_spec.rb +19 -0
- data/spec/unit/veritas/function/numeric/binary/type_spec.rb +33 -0
- data/spec/unit/veritas/function/numeric/division/class_methods/call_spec.rb +13 -0
- data/spec/unit/veritas/function/numeric/division/class_methods/inverse_spec.rb +11 -0
- data/spec/unit/veritas/function/numeric/division/class_methods/operation_spec.rb +11 -0
- data/spec/unit/veritas/function/numeric/division/inspect_spec.rb +11 -0
- data/spec/unit/veritas/function/numeric/division/methods/divide_spec.rb +19 -0
- data/spec/unit/veritas/function/numeric/division/type_spec.rb +11 -0
- data/spec/unit/veritas/function/numeric/exponentiation/class_methods/call_spec.rb +13 -0
- data/spec/unit/veritas/function/numeric/exponentiation/class_methods/operation_spec.rb +11 -0
- data/spec/unit/veritas/function/numeric/exponentiation/inspect_spec.rb +11 -0
- data/spec/unit/veritas/function/numeric/exponentiation/inverse_spec.rb +18 -0
- data/spec/unit/veritas/function/numeric/exponentiation/methods/exponent_spec.rb +19 -0
- data/spec/unit/veritas/function/numeric/modulo/class_methods/call_spec.rb +13 -0
- data/spec/unit/veritas/function/numeric/modulo/class_methods/operation_spec.rb +11 -0
- data/spec/unit/veritas/function/numeric/modulo/inspect_spec.rb +11 -0
- data/spec/unit/veritas/function/numeric/modulo/methods/modulo_spec.rb +19 -0
- data/spec/unit/veritas/function/numeric/multiplication/class_methods/call_spec.rb +13 -0
- data/spec/unit/veritas/function/numeric/multiplication/class_methods/inverse_spec.rb +11 -0
- data/spec/unit/veritas/function/numeric/multiplication/class_methods/operation_spec.rb +11 -0
- data/spec/unit/veritas/function/numeric/multiplication/inspect_spec.rb +11 -0
- data/spec/unit/veritas/function/numeric/multiplication/methods/multiply_spec.rb +19 -0
- data/spec/unit/veritas/function/numeric/square_root/class_methods/call_spec.rb +12 -0
- data/spec/unit/veritas/function/numeric/square_root/inspect_spec.rb +11 -0
- data/spec/unit/veritas/function/numeric/square_root/inverse_spec.rb +14 -0
- data/spec/unit/veritas/function/numeric/square_root/methods/square_root_spec.rb +16 -0
- data/spec/unit/veritas/function/numeric/square_root/type_spec.rb +11 -0
- data/spec/unit/veritas/function/numeric/subtraction/class_methods/call_spec.rb +13 -0
- data/spec/unit/veritas/function/numeric/subtraction/class_methods/inverse_spec.rb +11 -0
- data/spec/unit/veritas/function/numeric/subtraction/class_methods/operation_spec.rb +11 -0
- data/spec/unit/veritas/function/numeric/subtraction/inspect_spec.rb +11 -0
- data/spec/unit/veritas/function/numeric/subtraction/methods/subtract_spec.rb +19 -0
- data/spec/unit/veritas/function/numeric/unary/type_spec.rb +21 -0
- data/spec/unit/veritas/function/numeric/unary_minus/class_methods/call_spec.rb +21 -0
- data/spec/unit/veritas/function/numeric/unary_minus/class_methods/inverse_spec.rb +11 -0
- data/spec/unit/veritas/function/numeric/unary_minus/inspect_spec.rb +11 -0
- data/spec/unit/veritas/function/numeric/unary_minus/methods/unary_minus_spec.rb +16 -0
- data/spec/unit/veritas/function/numeric/unary_plus/class_methods/call_spec.rb +21 -0
- data/spec/unit/veritas/function/numeric/unary_plus/class_methods/inverse_spec.rb +11 -0
- data/spec/unit/veritas/function/numeric/unary_plus/inspect_spec.rb +11 -0
- data/spec/unit/veritas/function/numeric/unary_plus/methods/unary_plus_spec.rb +16 -0
- data/spec/unit/veritas/{logic → function}/predicate/call_spec.rb +3 -1
- data/spec/unit/veritas/{logic → function}/predicate/class_methods/call_spec.rb +3 -1
- data/spec/unit/veritas/{logic → function}/predicate/enumerable/class_methods/compare_method_spec.rb +3 -1
- data/spec/unit/veritas/{logic → function}/predicate/eql_spec.rb +3 -1
- data/spec/unit/veritas/{logic/predicate/inequality → function/predicate/equality}/class_methods/call_spec.rb +5 -3
- data/spec/unit/veritas/function/predicate/equality/class_methods/inverse_spec.rb +11 -0
- data/spec/unit/veritas/{logic → function}/predicate/equality/class_methods/operation_spec.rb +3 -1
- data/spec/unit/veritas/{logic → function}/predicate/equality/class_methods/reverse_spec.rb +3 -1
- data/spec/unit/veritas/{logic/predicate/greater_than_or_equal_to → function/predicate/equality}/inspect_spec.rb +4 -2
- data/spec/unit/veritas/{logic/predicate/greater_than → function/predicate/equality}/inverse_spec.rb +4 -2
- data/spec/unit/veritas/{logic → function}/predicate/equality/methods/eq_spec.rb +4 -2
- data/spec/unit/veritas/{logic → function}/predicate/equality/methods/fixtures/classes.rb +3 -1
- data/spec/unit/veritas/{logic → function}/predicate/exclusion/class_methods/call_spec.rb +3 -1
- data/spec/unit/veritas/function/predicate/exclusion/class_methods/inverse_spec.rb +11 -0
- data/spec/unit/veritas/{logic/predicate/inclusion → function/predicate/exclusion}/inspect_spec.rb +2 -2
- data/spec/unit/veritas/{logic/predicate/inclusion → function/predicate/exclusion}/inverse_spec.rb +4 -2
- data/spec/unit/veritas/{logic → function}/predicate/exclusion/methods/exclude_spec.rb +4 -2
- data/spec/unit/veritas/{logic → function}/predicate/exclusion/methods/fixtures/classes.rb +3 -1
- data/spec/unit/veritas/{logic → function}/predicate/fixtures/classes.rb +3 -1
- data/spec/unit/veritas/{logic → function}/predicate/greater_than/class_methods/call_spec.rb +3 -1
- data/spec/unit/veritas/function/predicate/greater_than/class_methods/inverse_spec.rb +11 -0
- data/spec/unit/veritas/{logic → function}/predicate/greater_than/class_methods/operation_spec.rb +3 -1
- data/spec/unit/veritas/function/predicate/greater_than/class_methods/reverse_spec.rb +11 -0
- data/spec/unit/veritas/{logic/predicate/equality → function/predicate/greater_than}/inspect_spec.rb +4 -2
- data/spec/unit/veritas/{logic/predicate/less_than → function/predicate/greater_than}/inverse_spec.rb +4 -2
- data/spec/unit/veritas/{logic → function}/predicate/greater_than/methods/fixtures/classes.rb +3 -1
- data/spec/unit/veritas/{logic → function}/predicate/greater_than/methods/gt_spec.rb +4 -2
- data/spec/unit/veritas/{logic → function}/predicate/greater_than_or_equal_to/class_methods/call_spec.rb +3 -1
- data/spec/unit/veritas/function/predicate/greater_than_or_equal_to/class_methods/inverse_spec.rb +11 -0
- data/spec/unit/veritas/{logic → function}/predicate/greater_than_or_equal_to/class_methods/operation_spec.rb +3 -1
- data/spec/unit/veritas/function/predicate/greater_than_or_equal_to/class_methods/reverse_spec.rb +11 -0
- data/spec/unit/veritas/function/predicate/greater_than_or_equal_to/inspect_spec.rb +12 -0
- data/spec/unit/veritas/{logic → function}/predicate/greater_than_or_equal_to/inverse_spec.rb +4 -2
- data/spec/unit/veritas/{logic → function}/predicate/greater_than_or_equal_to/methods/fixtures/classes.rb +3 -1
- data/spec/unit/veritas/{logic → function}/predicate/greater_than_or_equal_to/methods/gte_spec.rb +4 -2
- data/spec/unit/veritas/{logic → function}/predicate/hash_spec.rb +3 -1
- data/spec/unit/veritas/{logic → function}/predicate/inclusion/class_methods/call_spec.rb +3 -1
- data/spec/unit/veritas/function/predicate/inclusion/class_methods/inverse_spec.rb +11 -0
- data/spec/unit/veritas/{logic/predicate/exclusion → function/predicate/inclusion}/inspect_spec.rb +2 -2
- data/spec/unit/veritas/{logic/predicate/exclusion → function/predicate/inclusion}/inverse_spec.rb +4 -2
- data/spec/unit/veritas/{logic → function}/predicate/inclusion/methods/fixtures/classes.rb +3 -1
- data/spec/unit/veritas/{logic → function}/predicate/inclusion/methods/include_spec.rb +4 -2
- data/spec/unit/veritas/{logic/predicate/equality → function/predicate/inequality}/class_methods/call_spec.rb +5 -3
- data/spec/unit/veritas/function/predicate/inequality/class_methods/inverse_spec.rb +11 -0
- data/spec/unit/veritas/{logic → function}/predicate/inequality/class_methods/operation_spec.rb +3 -1
- data/spec/unit/veritas/function/predicate/inequality/class_methods/reverse_spec.rb +11 -0
- data/spec/unit/veritas/{logic → function}/predicate/inequality/inspect_spec.rb +4 -2
- data/spec/unit/veritas/{logic/predicate/equality → function/predicate/inequality}/inverse_spec.rb +4 -2
- data/spec/unit/veritas/{logic → function}/predicate/inequality/methods/fixtures/classes.rb +3 -1
- data/spec/unit/veritas/{logic → function}/predicate/inequality/methods/ne_spec.rb +4 -2
- data/spec/unit/veritas/{logic → function}/predicate/inspect_spec.rb +3 -1
- data/spec/unit/veritas/function/predicate/inverse_spec.rb +17 -0
- data/spec/unit/veritas/{logic → function}/predicate/less_than/class_methods/call_spec.rb +3 -1
- data/spec/unit/veritas/function/predicate/less_than/class_methods/inverse_spec.rb +11 -0
- data/spec/unit/veritas/{logic → function}/predicate/less_than/class_methods/operation_spec.rb +3 -1
- data/spec/unit/veritas/function/predicate/less_than/class_methods/reverse_spec.rb +11 -0
- data/spec/unit/veritas/{logic/predicate/greater_than → function/predicate/less_than}/inspect_spec.rb +4 -2
- data/spec/unit/veritas/{logic/predicate/inequality → function/predicate/less_than}/inverse_spec.rb +4 -2
- data/spec/unit/veritas/{logic → function}/predicate/less_than/methods/fixtures/classes.rb +3 -1
- data/spec/unit/veritas/{logic → function}/predicate/less_than/methods/lt_spec.rb +4 -2
- data/spec/unit/veritas/{logic → function}/predicate/less_than_or_equal_to/class_methods/call_spec.rb +3 -1
- data/spec/unit/veritas/function/predicate/less_than_or_equal_to/class_methods/inverse_spec.rb +11 -0
- data/spec/unit/veritas/{logic → function}/predicate/less_than_or_equal_to/class_methods/operation_spec.rb +3 -1
- data/spec/unit/veritas/function/predicate/less_than_or_equal_to/class_methods/reverse_spec.rb +11 -0
- data/spec/unit/veritas/function/predicate/less_than_or_equal_to/inspect_spec.rb +12 -0
- data/spec/unit/veritas/function/predicate/less_than_or_equal_to/inverse_spec.rb +22 -0
- data/spec/unit/veritas/{logic → function}/predicate/less_than_or_equal_to/methods/fixtures/classes.rb +3 -1
- data/spec/unit/veritas/{logic → function}/predicate/less_than_or_equal_to/methods/lte_spec.rb +4 -2
- data/spec/unit/veritas/{logic → function}/predicate/match/class_methods/call_spec.rb +3 -1
- data/spec/unit/veritas/function/predicate/match/class_methods/inverse_spec.rb +11 -0
- data/spec/unit/veritas/{logic → function}/predicate/match/class_methods/operation_spec.rb +3 -1
- data/spec/unit/veritas/{logic → function}/predicate/match/inspect_spec.rb +4 -2
- data/spec/unit/veritas/{logic → function}/predicate/match/inverse_spec.rb +4 -2
- data/spec/unit/veritas/{logic → function}/predicate/match/methods/fixtures/classes.rb +3 -1
- data/spec/unit/veritas/{logic → function}/predicate/match/methods/match_spec.rb +4 -2
- data/spec/unit/veritas/{logic → function}/predicate/no_match/class_methods/call_spec.rb +3 -1
- data/spec/unit/veritas/function/predicate/no_match/class_methods/inverse_spec.rb +11 -0
- data/spec/unit/veritas/{logic → function}/predicate/no_match/class_methods/operation_spec.rb +3 -1
- data/spec/unit/veritas/{logic → function}/predicate/no_match/inspect_spec.rb +4 -2
- data/spec/unit/veritas/{logic → function}/predicate/no_match/inverse_spec.rb +4 -2
- data/spec/unit/veritas/{logic → function}/predicate/no_match/methods/fixtures/classes.rb +3 -1
- data/spec/unit/veritas/{logic → function}/predicate/no_match/methods/no_match_spec.rb +4 -2
- data/spec/unit/veritas/function/predicate/type_spec.rb +14 -0
- data/spec/unit/veritas/{logic → function}/proposition/call_spec.rb +5 -3
- data/spec/unit/veritas/function/proposition/class_methods/call_spec.rb +11 -0
- data/spec/unit/veritas/{logic → function}/proposition/class_methods/new_spec.rb +5 -3
- data/spec/unit/veritas/{logic → function}/proposition/contradiction/and_spec.rb +3 -1
- data/spec/unit/veritas/{logic → function}/proposition/contradiction/class_methods/call_spec.rb +3 -1
- data/spec/unit/veritas/function/proposition/contradiction/class_methods/inverse_spec.rb +11 -0
- data/spec/unit/veritas/{logic → function}/proposition/contradiction/inspect_spec.rb +3 -1
- data/spec/unit/veritas/{logic → function}/proposition/contradiction/inverse_spec.rb +4 -2
- data/spec/unit/veritas/{logic → function}/proposition/contradiction/or_spec.rb +3 -1
- data/spec/unit/veritas/{logic → function}/proposition/eql_spec.rb +6 -4
- data/spec/unit/veritas/{logic → function}/proposition/equal_value_spec.rb +6 -4
- data/spec/unit/veritas/function/proposition/hash_spec.rb +14 -0
- data/spec/unit/veritas/function/proposition/inspect_spec.rb +16 -0
- data/spec/unit/veritas/{logic → function}/proposition/inverse_spec.rb +4 -2
- data/spec/unit/veritas/{logic/expression → function/proposition}/rename_spec.rb +4 -3
- data/spec/unit/veritas/{logic → function}/proposition/tautology/and_spec.rb +3 -1
- data/spec/unit/veritas/{logic → function}/proposition/tautology/class_methods/call_spec.rb +3 -1
- data/spec/unit/veritas/function/proposition/tautology/class_methods/inverse_spec.rb +11 -0
- data/spec/unit/veritas/{logic → function}/proposition/tautology/inspect_spec.rb +3 -1
- data/spec/unit/veritas/{logic → function}/proposition/tautology/inverse_spec.rb +4 -2
- data/spec/unit/veritas/{logic → function}/proposition/tautology/or_spec.rb +3 -1
- data/spec/unit/veritas/function/proposition/type_spec.rb +12 -0
- data/spec/unit/veritas/function/rename_spec.rb +14 -0
- data/spec/unit/veritas/function/string/length/class_methods/call_spec.rb +12 -0
- data/spec/unit/veritas/function/string/length/inspect_spec.rb +11 -0
- data/spec/unit/veritas/function/string/length/methods/length_spec.rb +14 -0
- data/spec/unit/veritas/function/string/length/type_spec.rb +11 -0
- data/spec/unit/veritas/function/type_spec.rb +13 -0
- data/spec/unit/veritas/{logic/connective → function}/unary/call_spec.rb +3 -1
- data/spec/unit/veritas/{logic/connective → function}/unary/equal_value_spec.rb +3 -1
- data/spec/unit/veritas/{logic/connective → function}/unary/fixtures/classes.rb +5 -1
- data/spec/unit/veritas/function/unary/invertible/inverse_spec.rb +37 -0
- data/spec/unit/veritas/{logic/connective → function}/unary/rename_spec.rb +4 -2
- data/spec/unit/veritas/immutable/class_methods/freeze_object_spec.rb +2 -0
- data/spec/unit/veritas/immutable/class_methods/new_spec.rb +2 -0
- data/spec/unit/veritas/immutable/dup_spec.rb +2 -0
- data/spec/unit/veritas/immutable/fixtures/classes.rb +6 -4
- data/spec/unit/veritas/immutable/freeze_spec.rb +2 -0
- data/spec/unit/veritas/immutable/memoize_spec.rb +28 -4
- data/spec/unit/veritas/immutable/memoized_spec.rb +2 -0
- data/spec/unit/veritas/immutable/memory/element_reference_spec.rb +2 -0
- data/spec/unit/veritas/immutable/memory/element_set_spec.rb +5 -3
- data/spec/unit/veritas/immutable/module_methods/included_spec.rb +2 -0
- data/spec/unit/veritas/immutable/module_methods/memoize_spec.rb +9 -1
- data/spec/unit/veritas/operation/binary/eql_spec.rb +2 -0
- data/spec/unit/veritas/operation/binary/hash_spec.rb +2 -0
- data/spec/unit/veritas/operation/binary/left_spec.rb +2 -0
- data/spec/unit/veritas/operation/binary/right_spec.rb +2 -0
- data/spec/unit/veritas/operation/unary/eql_spec.rb +2 -0
- data/spec/unit/veritas/operation/unary/hash_spec.rb +2 -0
- data/spec/unit/veritas/operation/unary/operand_spec.rb +2 -0
- data/spec/unit/veritas/relation/base/name_spec.rb +45 -0
- data/spec/unit/veritas/relation/class_methods/new_spec.rb +2 -0
- data/spec/unit/veritas/relation/directions_spec.rb +3 -1
- data/spec/unit/veritas/relation/each_spec.rb +2 -0
- data/spec/unit/veritas/relation/element_reference_spec.rb +2 -0
- data/spec/unit/veritas/relation/empty/each_spec.rb +2 -0
- data/spec/unit/veritas/relation/empty/empty_spec.rb +2 -0
- data/spec/unit/veritas/relation/empty/header_spec.rb +2 -0
- data/spec/unit/veritas/relation/empty_spec.rb +2 -0
- data/spec/unit/veritas/relation/eql_spec.rb +2 -0
- data/spec/unit/veritas/relation/equal_value_spec.rb +2 -0
- data/spec/unit/veritas/relation/hash_spec.rb +2 -0
- data/spec/unit/veritas/relation/header/class_methods/coerce_spec.rb +2 -0
- data/spec/unit/veritas/relation/header/class_methods/new_spec.rb +2 -0
- data/spec/unit/veritas/relation/header/difference_spec.rb +2 -0
- data/spec/unit/veritas/relation/header/each_spec.rb +2 -0
- data/spec/unit/veritas/relation/header/element_reference_spec.rb +2 -0
- data/spec/unit/veritas/relation/header/empty_spec.rb +2 -0
- data/spec/unit/veritas/relation/header/eql_spec.rb +2 -0
- data/spec/unit/veritas/relation/header/equal_value_spec.rb +2 -0
- data/spec/unit/veritas/relation/header/hash_spec.rb +5 -3
- data/spec/unit/veritas/relation/header/inspect_spec.rb +2 -0
- data/spec/unit/veritas/relation/header/intersect_spec.rb +2 -0
- data/spec/unit/veritas/relation/header/project_spec.rb +2 -0
- data/spec/unit/veritas/relation/header/rename_spec.rb +2 -0
- data/spec/unit/veritas/relation/header/to_ary_spec.rb +2 -0
- data/spec/unit/veritas/relation/header/union_spec.rb +2 -0
- data/spec/unit/veritas/relation/header_spec.rb +2 -0
- data/spec/unit/veritas/relation/materialize_spec.rb +2 -0
- data/spec/unit/veritas/relation/materialized/class_methods/new_spec.rb +2 -0
- data/spec/unit/veritas/relation/materialized/directions_spec.rb +27 -0
- data/spec/unit/veritas/relation/materialized/empty_spec.rb +2 -0
- data/spec/unit/veritas/relation/materialized/materialize_spec.rb +2 -0
- data/spec/unit/veritas/relation/materialized/size_spec.rb +2 -0
- data/spec/unit/veritas/relation/operation/binary/class_methods/new_spec.rb +2 -0
- data/spec/unit/veritas/relation/operation/binary/fixtures/classes.rb +2 -0
- data/spec/unit/veritas/relation/operation/binary/header_spec.rb +2 -0
- data/spec/unit/veritas/relation/operation/combination/class_methods/combine_tuples_spec.rb +2 -0
- data/spec/unit/veritas/relation/operation/combination/fixtures/classes.rb +2 -0
- data/spec/unit/veritas/relation/operation/combination/header_spec.rb +2 -0
- data/spec/unit/veritas/relation/operation/limit/class_methods/new_spec.rb +2 -0
- data/spec/unit/veritas/relation/operation/limit/directions_spec.rb +15 -0
- data/spec/unit/veritas/relation/operation/limit/each_spec.rb +2 -0
- data/spec/unit/veritas/relation/operation/limit/eql_spec.rb +2 -0
- data/spec/unit/veritas/relation/operation/limit/hash_spec.rb +2 -0
- data/spec/unit/veritas/relation/operation/limit/limit_spec.rb +2 -0
- data/spec/unit/veritas/relation/operation/limit/methods/first_spec.rb +2 -0
- data/spec/unit/veritas/relation/operation/limit/methods/last_spec.rb +2 -0
- data/spec/unit/veritas/relation/operation/limit/methods/take_spec.rb +2 -0
- data/spec/unit/veritas/relation/operation/offset/class_methods/new_spec.rb +2 -0
- data/spec/unit/veritas/relation/operation/offset/directions_spec.rb +15 -0
- data/spec/unit/veritas/relation/operation/offset/each_spec.rb +2 -0
- data/spec/unit/veritas/relation/operation/offset/eql_spec.rb +2 -0
- data/spec/unit/veritas/relation/operation/offset/hash_spec.rb +2 -0
- data/spec/unit/veritas/relation/operation/offset/methods/drop_spec.rb +2 -0
- data/spec/unit/veritas/relation/operation/offset/offset_spec.rb +2 -0
- data/spec/unit/veritas/relation/operation/order/ascending/class_methods/call_spec.rb +2 -0
- data/spec/unit/veritas/relation/operation/order/ascending/class_methods/reverse_spec.rb +2 -0
- data/spec/unit/veritas/relation/operation/order/ascending/reverse_spec.rb +2 -0
- data/spec/unit/veritas/relation/operation/order/class_methods/new_spec.rb +2 -0
- data/spec/unit/veritas/relation/operation/order/descending/class_methods/call_spec.rb +2 -0
- data/spec/unit/veritas/relation/operation/order/descending/class_methods/reverse_spec.rb +2 -0
- data/spec/unit/veritas/relation/operation/order/descending/reverse_spec.rb +2 -0
- data/spec/unit/veritas/relation/operation/order/direction/attribute_spec.rb +2 -0
- data/spec/unit/veritas/relation/operation/order/direction/call_spec.rb +2 -0
- data/spec/unit/veritas/relation/operation/order/direction/class_methods/coerce_spec.rb +2 -0
- data/spec/unit/veritas/relation/operation/order/direction/eql_spec.rb +2 -0
- data/spec/unit/veritas/relation/operation/order/direction/hash_spec.rb +2 -0
- data/spec/unit/veritas/relation/operation/order/direction/rename_spec.rb +2 -0
- data/spec/unit/veritas/relation/operation/order/direction/reverse_spec.rb +2 -0
- data/spec/unit/veritas/relation/operation/order/direction_set/attributes_spec.rb +2 -0
- data/spec/unit/veritas/relation/operation/order/direction_set/class_methods/coerce_spec.rb +2 -0
- data/spec/unit/veritas/relation/operation/order/direction_set/each_spec.rb +2 -0
- data/spec/unit/veritas/relation/operation/order/direction_set/empty_spec.rb +2 -0
- data/spec/unit/veritas/relation/operation/order/direction_set/eql_spec.rb +2 -0
- data/spec/unit/veritas/relation/operation/order/direction_set/equal_value_spec.rb +2 -0
- data/spec/unit/veritas/relation/operation/order/direction_set/hash_spec.rb +2 -0
- data/spec/unit/veritas/relation/operation/order/direction_set/project_spec.rb +2 -0
- data/spec/unit/veritas/relation/operation/order/direction_set/rename_spec.rb +2 -0
- data/spec/unit/veritas/relation/operation/order/direction_set/reverse_spec.rb +4 -0
- data/spec/unit/veritas/relation/operation/order/direction_set/sort_tuples_spec.rb +2 -0
- data/spec/unit/veritas/relation/operation/order/direction_set/to_ary_spec.rb +2 -0
- data/spec/unit/veritas/relation/operation/order/direction_set/union_spec.rb +2 -0
- data/spec/unit/veritas/relation/operation/order/directions_spec.rb +5 -3
- data/spec/unit/veritas/relation/operation/order/each_spec.rb +2 -0
- data/spec/unit/veritas/relation/operation/order/eql_spec.rb +2 -0
- data/spec/unit/veritas/relation/operation/order/hash_spec.rb +2 -0
- data/spec/unit/veritas/relation/operation/order/header_spec.rb +2 -0
- data/spec/unit/veritas/relation/operation/order/methods/order_spec.rb +2 -14
- data/spec/unit/veritas/relation/operation/reverse/class_methods/new_spec.rb +2 -0
- data/spec/unit/veritas/relation/operation/reverse/directions_spec.rb +17 -0
- data/spec/unit/veritas/relation/operation/reverse/each_spec.rb +2 -0
- data/spec/unit/veritas/relation/operation/reverse/methods/reverse_spec.rb +2 -0
- data/spec/unit/veritas/relation/operation/set/class_methods/new_spec.rb +2 -0
- data/spec/unit/veritas/relation/operation/set/fixtures/classes.rb +2 -0
- data/spec/unit/veritas/relation/operation/set/header_spec.rb +2 -0
- data/spec/unit/veritas/relation/operation/unary/fixtures/classes.rb +2 -0
- data/spec/unit/veritas/relation/operation/unary/header_spec.rb +2 -0
- data/spec/unit/veritas/tuple/class_methods/coerce_spec.rb +2 -0
- data/spec/unit/veritas/tuple/element_reference_spec.rb +2 -0
- data/spec/unit/veritas/tuple/eql_spec.rb +2 -0
- data/spec/unit/veritas/tuple/equal_value_spec.rb +2 -0
- data/spec/unit/veritas/tuple/extend_spec.rb +29 -4
- data/spec/unit/veritas/tuple/hash_spec.rb +3 -1
- data/spec/unit/veritas/tuple/header_spec.rb +2 -0
- data/spec/unit/veritas/tuple/inspect_spec.rb +2 -0
- data/spec/unit/veritas/tuple/join_spec.rb +2 -0
- data/spec/unit/veritas/tuple/project_spec.rb +2 -0
- data/spec/unit/veritas/tuple/to_ary_spec.rb +4 -0
- data/spec/unit/veritas/visitable/accept_spec.rb +2 -0
- data/tasks/metrics/ci.rake +7 -0
- data/tasks/{quality → metrics}/flay.rake +0 -0
- data/tasks/{quality → metrics}/flog.rake +0 -0
- data/tasks/{quality → metrics}/heckle.rake +25 -3
- data/tasks/{quality → metrics}/metric_fu.rake +3 -0
- data/tasks/{quality → metrics}/reek.rake +0 -0
- data/tasks/{quality → metrics}/roodi.rake +0 -0
- data/tasks/{quality → metrics}/yardstick.rake +0 -0
- data/tasks/spec.rake +1 -0
- data/veritas.gemspec +332 -580
- metadata +375 -584
- data/lib/veritas/logic/connective/binary.rb +0 -70
- data/lib/veritas/logic/connective.rb +0 -24
- data/lib/veritas/logic/expression.rb +0 -99
- data/lib/veritas/logic/predicate/comparable.rb +0 -57
- data/lib/veritas/logic/predicate.rb +0 -99
- data/spec/unit/veritas/algebra/projection/directions_spec.rb +0 -24
- data/spec/unit/veritas/algebra/summarization/class_methods/summarize_spec.rb +0 -26
- data/spec/unit/veritas/attribute/string/length_spec.rb +0 -20
- data/spec/unit/veritas/evaluator/expression/add_spec.rb +0 -21
- data/spec/unit/veritas/evaluator/expression/expressions_spec.rb +0 -13
- data/spec/unit/veritas/logic/connective/inspect_spec.rb +0 -10
- data/spec/unit/veritas/logic/connective/inverse_spec.rb +0 -26
- data/spec/unit/veritas/logic/connective/negation/methods/fixtures/classes.rb +0 -6
- data/spec/unit/veritas/logic/connective/negation/methods/not_spec.rb +0 -24
- data/spec/unit/veritas/logic/expression/eql_spec.rb +0 -12
- data/spec/unit/veritas/logic/expression/equal_value_spec.rb +0 -12
- data/spec/unit/veritas/logic/expression/fixtures/classes.rb +0 -4
- data/spec/unit/veritas/logic/expression/inverse_spec.rb +0 -16
- data/spec/unit/veritas/logic/predicate/comparable/inspect_spec.rb +0 -13
- data/spec/unit/veritas/logic/predicate/equal_value_spec.rb +0 -64
- data/spec/unit/veritas/logic/predicate/equality/class_methods/inverse_spec.rb +0 -9
- data/spec/unit/veritas/logic/predicate/exclusion/class_methods/inverse_spec.rb +0 -9
- data/spec/unit/veritas/logic/predicate/greater_than/class_methods/inverse_spec.rb +0 -9
- data/spec/unit/veritas/logic/predicate/greater_than/class_methods/reverse_spec.rb +0 -9
- data/spec/unit/veritas/logic/predicate/greater_than_or_equal_to/class_methods/inverse_spec.rb +0 -9
- data/spec/unit/veritas/logic/predicate/greater_than_or_equal_to/class_methods/reverse_spec.rb +0 -9
- data/spec/unit/veritas/logic/predicate/inclusion/class_methods/inverse_spec.rb +0 -9
- data/spec/unit/veritas/logic/predicate/inequality/class_methods/inverse_spec.rb +0 -9
- data/spec/unit/veritas/logic/predicate/inequality/class_methods/reverse_spec.rb +0 -9
- data/spec/unit/veritas/logic/predicate/inverse_spec.rb +0 -31
- data/spec/unit/veritas/logic/predicate/less_than/class_methods/inverse_spec.rb +0 -9
- data/spec/unit/veritas/logic/predicate/less_than/class_methods/reverse_spec.rb +0 -9
- data/spec/unit/veritas/logic/predicate/less_than/inspect_spec.rb +0 -10
- data/spec/unit/veritas/logic/predicate/less_than_or_equal_to/class_methods/inverse_spec.rb +0 -9
- data/spec/unit/veritas/logic/predicate/less_than_or_equal_to/class_methods/reverse_spec.rb +0 -9
- data/spec/unit/veritas/logic/predicate/less_than_or_equal_to/inspect_spec.rb +0 -10
- data/spec/unit/veritas/logic/predicate/less_than_or_equal_to/inverse_spec.rb +0 -20
- data/spec/unit/veritas/logic/predicate/match/class_methods/inverse_spec.rb +0 -9
- data/spec/unit/veritas/logic/predicate/no_match/class_methods/inverse_spec.rb +0 -9
- data/spec/unit/veritas/logic/predicate/rename_spec.rb +0 -45
- data/spec/unit/veritas/logic/proposition/contradiction/class_methods/inverse_spec.rb +0 -9
- data/spec/unit/veritas/logic/proposition/hash_spec.rb +0 -12
- data/spec/unit/veritas/logic/proposition/inspect_spec.rb +0 -14
- data/spec/unit/veritas/logic/proposition/tautology/class_methods/inverse_spec.rb +0 -9
- data/spec/unit/veritas/relation/header/index_spec.rb +0 -20
- data/spec/unit/veritas/relation/operation/binary/directions_spec.rb +0 -17
- data/spec/unit/veritas/relation/operation/unary/directions_spec.rb +0 -16
- data/tasks/quality/ci.rake +0 -2
data/.gemtest
ADDED
File without changes
|
data/.rvmrc
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
rvm use @$(basename `pwd`) --create
|
data/.travis.yml
ADDED
data/Gemfile
CHANGED
@@ -1,25 +1,35 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
1
3
|
source :rubygems
|
2
4
|
|
3
5
|
group :development do
|
4
|
-
gem 'backports', '~> 2.1
|
5
|
-
gem 'jeweler', '~> 1.
|
6
|
-
gem 'rake', '~> 0.
|
6
|
+
gem 'backports', '~> 2.2.1'
|
7
|
+
gem 'jeweler', '~> 1.6.0'
|
8
|
+
gem 'rake', '~> 0.9.0'
|
7
9
|
gem 'rspec', '~> 1.3.2'
|
8
|
-
gem 'yard', '~> 0.
|
10
|
+
gem 'yard', '~> 0.7.1'
|
9
11
|
end
|
10
12
|
|
11
|
-
group :
|
12
|
-
|
13
|
-
|
14
|
-
|
13
|
+
group :guard do
|
14
|
+
gem 'growl', '~> 1.0.3'
|
15
|
+
gem 'guard', '~> 0.3.4'
|
16
|
+
gem 'guard-bundler', '~> 0.1.3'
|
17
|
+
gem 'guard-ego', '~> 0.0.1'
|
18
|
+
gem 'guard-rspec', '~> 0.3.1'
|
15
19
|
end
|
16
20
|
|
17
21
|
group :benchmarks do
|
18
22
|
gem 'rbench', '~> 0.2.3'
|
19
23
|
end
|
20
24
|
|
25
|
+
platform :jruby do
|
26
|
+
group :jruby do
|
27
|
+
gem 'jruby-openssl', '~> 0.7.4'
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
21
31
|
platforms :mri_18 do
|
22
|
-
group :
|
32
|
+
group :metrics do
|
23
33
|
gem 'flay', '~> 1.4.2'
|
24
34
|
gem 'flog', '~> 2.5.1'
|
25
35
|
gem 'heckle', '~> 1.4.3'
|
@@ -30,6 +40,6 @@ platforms :mri_18 do
|
|
30
40
|
gem 'reek', '~> 1.2.8', :git => 'git://github.com/dkubb/reek.git'
|
31
41
|
gem 'roodi', '~> 2.1.0'
|
32
42
|
gem 'ruby2ruby', '= 1.2.2'
|
33
|
-
gem 'yardstick', '~> 0.
|
43
|
+
gem 'yardstick', '~> 0.4.0'
|
34
44
|
end
|
35
45
|
end
|
data/Guardfile
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
guard 'ego' do
|
4
|
+
watch('Guardfile')
|
5
|
+
end
|
6
|
+
|
7
|
+
guard 'bundler' do
|
8
|
+
watch('Gemfile')
|
9
|
+
end
|
10
|
+
|
11
|
+
guard 'rspec' do
|
12
|
+
# run all specs if the spec_helper or supporting files files are modified
|
13
|
+
watch('spec/spec_helper.rb') { 'spec' }
|
14
|
+
watch(%r{\Aspec/(?:lib|support|shared)/.+\.rb\z}) { 'spec' }
|
15
|
+
|
16
|
+
# run unit specs if associated lib code is modified
|
17
|
+
watch(%r{\Alib/(.+)\.rb\z}) { |m| Dir["spec/unit/#{m[1]}"] }
|
18
|
+
watch("lib/#{File.basename(File.expand_path('../', __FILE__))}.rb") { 'spec' }
|
19
|
+
|
20
|
+
# run a spec if it is modified
|
21
|
+
watch(%r{\Aspec/(?:unit|integration)/.+_spec\.rb\z})
|
22
|
+
end
|
data/README.rdoc
CHANGED
@@ -2,6 +2,8 @@
|
|
2
2
|
|
3
3
|
Simplifies querying of structured data using relational algebra
|
4
4
|
|
5
|
+
http://travis-ci.org/dkubb/veritas.png
|
6
|
+
|
5
7
|
== Usage
|
6
8
|
|
7
9
|
relation = Veritas::Relation.new([ [ :id, Integer ] ], [ [ 1 ] ])
|
@@ -34,11 +36,9 @@ Simplifies querying of structured data using relational algebra
|
|
34
36
|
new_relation = relation.difference(other) # OR relation - other
|
35
37
|
|
36
38
|
# restriction
|
37
|
-
new_relation = relation.restrict(relation.name.eq('other'))
|
38
39
|
new_relation = relation.restrict { |r| r[:a].eq('other').and(r[:b].gte(42)) }
|
39
40
|
|
40
41
|
# theta-join
|
41
|
-
new_relation = relation.join(other, relation[:a].gte(other[:b]))
|
42
42
|
new_relation = relation.join(other) { |r| r[:a].gte(r[:b]) }
|
43
43
|
|
44
44
|
# NOTE: theta-join is effectively restricting a product of the relations
|
@@ -48,7 +48,7 @@ Simplifies querying of structured data using relational algebra
|
|
48
48
|
new_relation = relation.extend { |r| r.add(:total) { |t| t[:unit_price] * t[:quantity] } }
|
49
49
|
|
50
50
|
# summarize
|
51
|
-
new_relation = relation.summarize(relation.project([ :name ])) { |r| r.add(:count, r[:name].count)
|
51
|
+
new_relation = relation.summarize(relation.project([ :name ])) { |r| r.add(:count, r[:name].count) }
|
52
52
|
new_relation = relation.summarize(relation.project([ :name ])) { |r| r.add(:count) { |acc, t| acc.to_i + 1 } }
|
53
53
|
|
54
54
|
# Non-Relational Operators
|
@@ -64,7 +64,6 @@ Simplifies querying of structured data using relational algebra
|
|
64
64
|
relation = relation.each { |tuple| ... }
|
65
65
|
|
66
66
|
# order by attribute and direction
|
67
|
-
new_relation = relation.order([ relation[:a].desc, relation[:b] ])
|
68
67
|
new_relation = relation.order { |r| [ r[:a].desc, r[:b] ] }
|
69
68
|
|
70
69
|
# reverse the relation (only allowed if ordered)
|
@@ -112,9 +111,9 @@ This is 100% complete now.
|
|
112
111
|
|
113
112
|
=== Phase 2: RDBMS Engines
|
114
113
|
|
115
|
-
The second phase of this project will be to add
|
114
|
+
The second phase of this project will be to add a RDBMS based engine, and move the in-memory matching to it's own engine. I'll also be working on a system where if the primary engine cannot carry out some operation, that it first look at alternate forms (eg. using a join instead of an intersection), and then fall-back to in-memory matching. I also want to look at re-arranging queries so that all the operations that can be performed natively are "pushed down" the hierarchy and then the in-memory matching is performed last.
|
116
115
|
|
117
|
-
This is
|
116
|
+
This is 90% complete. I have finished a first pass on the veritas-sql-compiler[https://github.com/dkubb/veritas-sql-compiler] which is a visitor that walks the AST and produces SQL for every operation except extend and summarize. To finish those I will need to add function support to veritas that are introspectable (i.e. not Proc objects). Once I can introspect them, then I can serialize them to SQL and other query languages.
|
118
117
|
|
119
118
|
=== Phase 3: DataMapper Integration
|
120
119
|
|
data/Rakefile
CHANGED
@@ -1,9 +1,11 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
1
3
|
require 'rake'
|
2
4
|
|
3
5
|
require File.expand_path('../lib/veritas/version', __FILE__)
|
4
6
|
|
5
7
|
begin
|
6
|
-
gem('jeweler', '~> 1.
|
8
|
+
gem('jeweler', '~> 1.6.0') if respond_to?(:gem, true)
|
7
9
|
require 'jeweler'
|
8
10
|
|
9
11
|
Jeweler::Tasks.new do |gem|
|
@@ -21,5 +23,5 @@ begin
|
|
21
23
|
|
22
24
|
FileList['tasks/**/*.rake'].each { |task| import task }
|
23
25
|
rescue LoadError
|
24
|
-
puts 'Jeweler (or a dependency) not available. Install it with: gem install jeweler -v 1.
|
26
|
+
puts 'Jeweler (or a dependency) not available. Install it with: gem install jeweler -v 1.6.0'
|
25
27
|
end
|
data/TODO
CHANGED
@@ -1,6 +1,3 @@
|
|
1
|
-
* Add Extension and Summarization Functions
|
2
|
-
* Overview: https://gist.github.com/584588
|
3
|
-
|
4
1
|
* Remove Order, Reverse, Limit and Offset from the Relation inheritance chain
|
5
2
|
* Instead make it so they are proxy classes that wrap Relations, but
|
6
3
|
proxy method calls to the Relation methods, and then wrap the return
|
@@ -8,12 +5,6 @@
|
|
8
5
|
* Also this will allow knowledge of #directions to be removed from
|
9
6
|
all the Relation classes. Only the Ranking classes will need to know
|
10
7
|
about directions.
|
11
|
-
* We can also do things like optimize away an Order that is not
|
12
|
-
wrapped by a Limit/Offset if it is wrapped in Join or Set relation.
|
13
|
-
We can do this because joining sorted relations results in
|
14
|
-
an undefined sort order depending on the algorithm used to join
|
15
|
-
the tuples. The correct approach to get unambiguous results is to
|
16
|
-
wrap the Join in an Order.
|
17
8
|
* The Reverse class will probably not be needed either. All we need is
|
18
9
|
for the #reverse method to create a new Order with the directions
|
19
10
|
reversed.
|
@@ -21,11 +12,7 @@
|
|
21
12
|
and instead wrap materialized relations in the Order object
|
22
13
|
if any.
|
23
14
|
|
24
|
-
*
|
25
|
-
* Ensure that Inclusion can have the left/right be an Array of
|
26
|
-
Attributes.
|
27
|
-
* Consider transforming the value provided to an Inclusion into
|
28
|
-
a Relation.
|
15
|
+
* Add Relation#nest and Relation#unnest
|
29
16
|
|
30
17
|
* Update Attributes so that constraints are modelled using predicates,
|
31
18
|
so that when "join-ability" is tested, the predicates can just be
|
@@ -35,11 +22,26 @@
|
|
35
22
|
caller. This will allow a "complex" predicate to set the errors
|
36
23
|
on tuples, while still allowing all the same objects to be used.
|
37
24
|
|
25
|
+
* Update memoization to take into account the arguments passed into
|
26
|
+
the method. It should memoize differently for different
|
27
|
+
methods. Perhaps it could have a special case for methods
|
28
|
+
with a 0-arity vs n-arity methods, but it needs to handle cases
|
29
|
+
like with #hash that accept no args, and #optimize that accepts
|
30
|
+
1 arg.
|
31
|
+
|
38
32
|
* Add Relation#antijoin
|
33
|
+
* Allows "NOT EXISTS/IN" type queries to be executes where every tuple
|
34
|
+
from the relation is returned that *does not* join with the tuples in
|
35
|
+
the operand.
|
39
36
|
|
40
|
-
*
|
37
|
+
* Inclusion/Exclusion improvements:
|
38
|
+
* Allow attribute/function expressions to exist within the enumerable part
|
39
|
+
of the Inclusion and Exclusion operations
|
40
|
+
* The #call method should propagate the Tuple down to each callable entry
|
41
|
+
in the Enumerable.
|
41
42
|
|
42
|
-
*
|
43
|
+
* Update context to return an object that allows aliasing of ruby-ish predicates
|
44
|
+
to specific operations, eg:
|
43
45
|
* Predicates:
|
44
46
|
* Alias #== to #eq (may break alot)
|
45
47
|
* Alias #!= to #ne (in 1.9 only)
|
@@ -51,10 +53,3 @@
|
|
51
53
|
* Direction:
|
52
54
|
* Alias #@+ to #asc
|
53
55
|
* Alias #@- to #desc
|
54
|
-
|
55
|
-
* Update memoization to take into account the arguments passed into
|
56
|
-
the method. It should memoize differently for different
|
57
|
-
methods. Perhaps it could have a special case for methods
|
58
|
-
with a 0-arity vs n-arity methods, but it needs to handle cases
|
59
|
-
like with #hash that accept no args, and #optimize that accepts
|
60
|
-
1 arg.
|
data/config/flay.yml
CHANGED
data/config/flog.yml
CHANGED
@@ -1,2 +1,2 @@
|
|
1
1
|
---
|
2
|
-
threshold:
|
2
|
+
threshold: 15.7
|
data/config/roodi.yml
CHANGED
@@ -11,7 +11,7 @@ EmptyRescueBodyCheck: { }
|
|
11
11
|
ForLoopCheck: { }
|
12
12
|
# TODO: decrease line_count to 5 to 10
|
13
13
|
MethodLineCountCheck: { line_count: 14 }
|
14
|
-
MethodNameCheck: { pattern: !ruby/regexp /\A(?:[a-z](?:_?[a-z])+[?!=]?|\[\]=?|==|<=>|[+*&|-])\z/ }
|
14
|
+
MethodNameCheck: { pattern: !ruby/regexp /\A(?:[a-z\d](?:_?[a-z\d])+[?!=]?|\[\]=?|==|<=>|[+*&|-])\z/ }
|
15
15
|
ModuleLineCountCheck: { line_count: 392 }
|
16
16
|
ModuleNameCheck: { pattern: !ruby/regexp /\A(?:[A-Z]+|[A-Z][a-z](?:[A-Z]?[a-z])+)\z/ }
|
17
17
|
# TODO: decrease parameter_count to 2 or less
|
data/config/site.reek
CHANGED
@@ -8,10 +8,10 @@ UncommunicativeParameterName:
|
|
8
8
|
- !ruby/regexp /[0-9]$/
|
9
9
|
- !ruby/regexp /[A-Z]/
|
10
10
|
LargeClass:
|
11
|
-
max_methods:
|
11
|
+
max_methods: 15 # TODO: decrease max_methods to 10-15 or less
|
12
12
|
exclude: []
|
13
13
|
enabled: true
|
14
|
-
max_instance_variables:
|
14
|
+
max_instance_variables: 5
|
15
15
|
UncommunicativeMethodName:
|
16
16
|
accept: []
|
17
17
|
exclude: []
|
@@ -91,6 +91,6 @@ ControlCouple:
|
|
91
91
|
exclude: []
|
92
92
|
enabled: true
|
93
93
|
LongYieldList:
|
94
|
-
max_params:
|
94
|
+
max_params: 2
|
95
95
|
exclude: []
|
96
96
|
enabled: true
|
@@ -0,0 +1,55 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
module Veritas
|
4
|
+
class Aggregate
|
5
|
+
|
6
|
+
# The count of a series of values
|
7
|
+
class Count < Aggregate
|
8
|
+
|
9
|
+
DEFAULT = 0
|
10
|
+
|
11
|
+
# Return the count for a series of values
|
12
|
+
#
|
13
|
+
# @example
|
14
|
+
# count = Count.call(count, value)
|
15
|
+
#
|
16
|
+
# @param [Integer] count
|
17
|
+
#
|
18
|
+
# @param [Object] _value
|
19
|
+
#
|
20
|
+
# @return [Integer]
|
21
|
+
#
|
22
|
+
# @api public
|
23
|
+
def self.call(count, value)
|
24
|
+
value.nil? ? count : count.succ
|
25
|
+
end
|
26
|
+
|
27
|
+
# Return the type returned from #call
|
28
|
+
#
|
29
|
+
# @return [Class<Attribute::Integer>]
|
30
|
+
#
|
31
|
+
# @api public
|
32
|
+
def type
|
33
|
+
Attribute::Integer
|
34
|
+
end
|
35
|
+
|
36
|
+
module Methods
|
37
|
+
|
38
|
+
# Return a count aggregate function
|
39
|
+
#
|
40
|
+
# @example
|
41
|
+
# count = attribute.count
|
42
|
+
#
|
43
|
+
# @param [Attribute]
|
44
|
+
#
|
45
|
+
# @return [Count]
|
46
|
+
#
|
47
|
+
# @api public
|
48
|
+
def count
|
49
|
+
Count.new(self)
|
50
|
+
end
|
51
|
+
|
52
|
+
end # module Methods
|
53
|
+
end # class Count
|
54
|
+
end # class Aggregate
|
55
|
+
end # module Veritas
|
@@ -0,0 +1,59 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
module Veritas
|
4
|
+
class Aggregate
|
5
|
+
|
6
|
+
# The maximum value in a sequence of numbers
|
7
|
+
class Maximum < Aggregate
|
8
|
+
|
9
|
+
DEFAULT = -Float::INFINITY
|
10
|
+
|
11
|
+
# Return the maximum value for a sequence of numbers
|
12
|
+
#
|
13
|
+
# @example
|
14
|
+
# maximum = Maximum.call(maximum, value)
|
15
|
+
#
|
16
|
+
# @param [Numeric] maximum
|
17
|
+
#
|
18
|
+
# @param [Numeric] value
|
19
|
+
#
|
20
|
+
# @return [Numeric]
|
21
|
+
#
|
22
|
+
# @api public
|
23
|
+
def self.call(maximum, value)
|
24
|
+
return maximum if value.nil?
|
25
|
+
value > maximum ? value : maximum
|
26
|
+
end
|
27
|
+
|
28
|
+
# Return the type returned from #call
|
29
|
+
#
|
30
|
+
# @return [Class<Attribute::Numeric>]
|
31
|
+
#
|
32
|
+
# @api public
|
33
|
+
def type
|
34
|
+
Attribute.infer_type(operand)
|
35
|
+
end
|
36
|
+
|
37
|
+
module Methods
|
38
|
+
extend Aliasable
|
39
|
+
|
40
|
+
inheritable_alias(:max => :maximum)
|
41
|
+
|
42
|
+
# Return a maximum aggregate function
|
43
|
+
#
|
44
|
+
# @example
|
45
|
+
# maximum = attribute.maximum
|
46
|
+
#
|
47
|
+
# @param [Attribute]
|
48
|
+
#
|
49
|
+
# @return [Maximum]
|
50
|
+
#
|
51
|
+
# @api public
|
52
|
+
def maximum
|
53
|
+
Maximum.new(self)
|
54
|
+
end
|
55
|
+
|
56
|
+
end # module Methods
|
57
|
+
end # class Maximum
|
58
|
+
end # class Aggregate
|
59
|
+
end # module Veritas
|
@@ -0,0 +1,81 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
module Veritas
|
4
|
+
class Aggregate
|
5
|
+
|
6
|
+
# The mean of a sequence of numbers
|
7
|
+
class Mean < Aggregate
|
8
|
+
|
9
|
+
DEFAULT = [ 0, nil ].freeze
|
10
|
+
|
11
|
+
# Return the count and mean for a sequence of numbers
|
12
|
+
#
|
13
|
+
# @example
|
14
|
+
# count, mean = Mean.call([ count, mean ], value)
|
15
|
+
#
|
16
|
+
# @param [Array(Integer, Numeric)] accumulator
|
17
|
+
#
|
18
|
+
# @param [Numeric] value
|
19
|
+
#
|
20
|
+
# @return [Array(Integer, Numeric)]
|
21
|
+
#
|
22
|
+
# @api public
|
23
|
+
def self.call(accumulator, value)
|
24
|
+
return accumulator if value.nil?
|
25
|
+
count, mean = accumulator
|
26
|
+
count = Count.call(count, value)
|
27
|
+
[ count, mean.nil? ? value.to_f : mean + ((value - mean) / count.to_f) ]
|
28
|
+
end
|
29
|
+
|
30
|
+
# Extract the mean from the accumulator
|
31
|
+
#
|
32
|
+
# @example
|
33
|
+
# mean = Mean.finalize(accumulator)
|
34
|
+
#
|
35
|
+
# @param [Array(Integer, Numeric)] accumulator
|
36
|
+
#
|
37
|
+
# @return [Float]
|
38
|
+
# returned for a non-empty set
|
39
|
+
# @return [nil]
|
40
|
+
# returned for an empty set
|
41
|
+
#
|
42
|
+
# @api public
|
43
|
+
def self.finalize(accumulator)
|
44
|
+
accumulator.last
|
45
|
+
end
|
46
|
+
|
47
|
+
# Return the type returned from #call
|
48
|
+
#
|
49
|
+
# @return [Class<Attribute::Float>]
|
50
|
+
#
|
51
|
+
# @api public
|
52
|
+
def type
|
53
|
+
Attribute::Float
|
54
|
+
end
|
55
|
+
|
56
|
+
module Methods
|
57
|
+
extend Aliasable
|
58
|
+
|
59
|
+
inheritable_alias(
|
60
|
+
:average => :mean,
|
61
|
+
:avg => :mean
|
62
|
+
)
|
63
|
+
|
64
|
+
# Return a mean aggregate function
|
65
|
+
#
|
66
|
+
# @example
|
67
|
+
# mean = attribute.mean
|
68
|
+
#
|
69
|
+
# @param [Attribute]
|
70
|
+
#
|
71
|
+
# @return [Mean]
|
72
|
+
#
|
73
|
+
# @api public
|
74
|
+
def mean
|
75
|
+
Mean.new(self)
|
76
|
+
end
|
77
|
+
|
78
|
+
end # module Methods
|
79
|
+
end # class Mean
|
80
|
+
end # class Aggregate
|
81
|
+
end # module Veritas
|
@@ -0,0 +1,59 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
module Veritas
|
4
|
+
class Aggregate
|
5
|
+
|
6
|
+
# The maximum value in a sequence of numbers
|
7
|
+
class Minimum < Aggregate
|
8
|
+
|
9
|
+
DEFAULT = Float::INFINITY
|
10
|
+
|
11
|
+
# Return the minimum value for a sequence of numbers
|
12
|
+
#
|
13
|
+
# @example
|
14
|
+
# minimum = Minimum.call(minimum, value)
|
15
|
+
#
|
16
|
+
# @param [Numeric] minimum
|
17
|
+
#
|
18
|
+
# @param [Numeric] value
|
19
|
+
#
|
20
|
+
# @return [Numeric]
|
21
|
+
#
|
22
|
+
# @api public
|
23
|
+
def self.call(minimum, value)
|
24
|
+
return minimum if value.nil?
|
25
|
+
value < minimum ? value : minimum
|
26
|
+
end
|
27
|
+
|
28
|
+
# Return the type returned from #call
|
29
|
+
#
|
30
|
+
# @return [Class<Attribute::Numeric>]
|
31
|
+
#
|
32
|
+
# @api public
|
33
|
+
def type
|
34
|
+
Attribute.infer_type(operand)
|
35
|
+
end
|
36
|
+
|
37
|
+
module Methods
|
38
|
+
extend Aliasable
|
39
|
+
|
40
|
+
inheritable_alias(:min => :minimum)
|
41
|
+
|
42
|
+
# Return a minimum aggregate function
|
43
|
+
#
|
44
|
+
# @example
|
45
|
+
# minimum = attribute.minimum
|
46
|
+
#
|
47
|
+
# @param [Attribute]
|
48
|
+
#
|
49
|
+
# @return [Minimum]
|
50
|
+
#
|
51
|
+
# @api public
|
52
|
+
def minimum
|
53
|
+
Minimum.new(self)
|
54
|
+
end
|
55
|
+
|
56
|
+
end # module Methods
|
57
|
+
end # class Minimum
|
58
|
+
end # class Aggregate
|
59
|
+
end # module Veritas
|
@@ -0,0 +1,58 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
module Veritas
|
4
|
+
class Aggregate
|
5
|
+
|
6
|
+
# The standard deviation of a sequence of numbers
|
7
|
+
class StandardDeviation < Variance
|
8
|
+
|
9
|
+
# Calculate the standard deviation from the accumulator
|
10
|
+
#
|
11
|
+
# @example
|
12
|
+
# standard_deviation = StandardDeviation.finalize(accumulator)
|
13
|
+
#
|
14
|
+
# @param [Array(Numeric, Integer, Numeric)] accumulator
|
15
|
+
#
|
16
|
+
# @return [Float]
|
17
|
+
# returned for a non-empty set
|
18
|
+
# @return [nil]
|
19
|
+
# returned for an empty set
|
20
|
+
#
|
21
|
+
# @api public
|
22
|
+
def self.finalize(*)
|
23
|
+
variance = super
|
24
|
+
Math.sqrt(variance) if variance
|
25
|
+
end
|
26
|
+
|
27
|
+
# Return the type returned from #call
|
28
|
+
#
|
29
|
+
# @return [Class<Attribute::Float>]
|
30
|
+
#
|
31
|
+
# @api public
|
32
|
+
def type
|
33
|
+
Attribute::Float
|
34
|
+
end
|
35
|
+
|
36
|
+
module Methods
|
37
|
+
extend Aliasable
|
38
|
+
|
39
|
+
inheritable_alias(:stddev => :standard_deviation)
|
40
|
+
|
41
|
+
# Return a standard deviation aggregate function
|
42
|
+
#
|
43
|
+
# @example
|
44
|
+
# standard_deviation = attribute.standard_deviation
|
45
|
+
#
|
46
|
+
# @param [Attribute]
|
47
|
+
#
|
48
|
+
# @return [StandardDeviation]
|
49
|
+
#
|
50
|
+
# @api public
|
51
|
+
def standard_deviation
|
52
|
+
StandardDeviation.new(self)
|
53
|
+
end
|
54
|
+
|
55
|
+
end # module Methods
|
56
|
+
end # class StandardDeviation
|
57
|
+
end # class Aggregate
|
58
|
+
end # module Veritas
|
@@ -0,0 +1,81 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
module Veritas
|
4
|
+
class Aggregate
|
5
|
+
|
6
|
+
# The sum of a sequence of numbers
|
7
|
+
class Sum < Aggregate
|
8
|
+
|
9
|
+
DEFAULT = 0
|
10
|
+
|
11
|
+
# Return the sum for a sequence of numbers
|
12
|
+
#
|
13
|
+
# @example
|
14
|
+
# sum = Sum.call(sum, value)
|
15
|
+
#
|
16
|
+
# @param [Numeric] sum
|
17
|
+
#
|
18
|
+
# @param [Object] value
|
19
|
+
#
|
20
|
+
# @return [Numeric]
|
21
|
+
#
|
22
|
+
# @api public
|
23
|
+
def self.call(sum, value)
|
24
|
+
return sum if value.nil?
|
25
|
+
sum + value
|
26
|
+
end
|
27
|
+
|
28
|
+
# Return the default sum
|
29
|
+
#
|
30
|
+
# @example when the operand is a float
|
31
|
+
# default = sum.default # => 0.0
|
32
|
+
#
|
33
|
+
# @example when the operand is a decimal
|
34
|
+
# default = sum.default # => BigDecimal('0.0')
|
35
|
+
#
|
36
|
+
# @example when the operand is an integer
|
37
|
+
# default = sum.default # => 0
|
38
|
+
#
|
39
|
+
# @return [Numeric]
|
40
|
+
#
|
41
|
+
# @todo refactor once functions know their return types
|
42
|
+
#
|
43
|
+
# @api public
|
44
|
+
def default
|
45
|
+
type = self.type
|
46
|
+
if type.equal?(Attribute::Float) then super.to_f
|
47
|
+
elsif type.equal?(Attribute::Decimal) then BigDecimal(super.to_s)
|
48
|
+
else
|
49
|
+
super
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
# Return the type returned from #call
|
54
|
+
#
|
55
|
+
# @return [Class<Attribute::Numeric>]
|
56
|
+
#
|
57
|
+
# @api public
|
58
|
+
def type
|
59
|
+
Attribute.infer_type(operand)
|
60
|
+
end
|
61
|
+
|
62
|
+
module Methods
|
63
|
+
|
64
|
+
# Return a sum aggregate function
|
65
|
+
#
|
66
|
+
# @example
|
67
|
+
# sum = attribute.sum
|
68
|
+
#
|
69
|
+
# @param [Attribute]
|
70
|
+
#
|
71
|
+
# @return [Sum]
|
72
|
+
#
|
73
|
+
# @api public
|
74
|
+
def sum
|
75
|
+
Sum.new(self)
|
76
|
+
end
|
77
|
+
|
78
|
+
end # module Methods
|
79
|
+
end # class Sum
|
80
|
+
end # class Aggregate
|
81
|
+
end # module Veritas
|