alf 0.10.1 → 0.11.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +25 -0
- data/Gemfile +8 -8
- data/Gemfile.lock +22 -20
- data/Rakefile +1 -1
- data/alf.gemspec +31 -30
- data/alf.noespec +11 -9
- data/bin/alf +1 -1
- data/lib/alf/aggregator/avg.rb +39 -0
- data/lib/alf/aggregator/class_methods.rb +32 -14
- data/lib/alf/aggregator/collect.rb +32 -0
- data/lib/alf/aggregator/concat.rb +47 -0
- data/lib/alf/aggregator/count.rb +32 -0
- data/lib/alf/aggregator/{base.rb → instance_methods.rb} +54 -30
- data/lib/alf/aggregator/max.rb +32 -0
- data/lib/alf/aggregator/min.rb +32 -0
- data/lib/alf/aggregator/stddev.rb +25 -0
- data/lib/alf/aggregator/sum.rb +32 -0
- data/lib/alf/aggregator/variance.rb +45 -0
- data/lib/alf/aggregator.rb +51 -0
- data/lib/alf/environment/class_methods.rb +37 -35
- data/lib/alf/environment/folder.rb +26 -28
- data/lib/alf/environment/{base.rb → instance_methods.rb} +8 -19
- data/lib/alf/environment.rb +34 -0
- data/lib/alf/errors.rb +1 -0
- data/lib/alf/iterator/class_methods.rb +0 -2
- data/lib/alf/iterator/proxy.rb +7 -13
- data/lib/alf/iterator.rb +27 -0
- data/lib/alf/lispy/instance_methods.rb +14 -14
- data/lib/alf/lispy.rb +24 -0
- data/lib/alf/loader.rb +1 -1
- data/lib/alf/operator/binary.rb +4 -15
- data/lib/alf/operator/class_methods.rb +33 -83
- data/lib/alf/operator/instance_methods.rb +29 -0
- data/lib/alf/operator/non_relational/autonum.rb +17 -22
- data/lib/alf/operator/non_relational/clip.rb +18 -18
- data/lib/alf/operator/non_relational/coerce.rb +17 -19
- data/lib/alf/operator/non_relational/compact.rb +13 -57
- data/lib/alf/operator/non_relational/defaults.rb +20 -23
- data/lib/alf/operator/non_relational/generator.rb +14 -32
- data/lib/alf/operator/non_relational/sort.rb +16 -20
- data/lib/alf/operator/nullary.rb +0 -9
- data/lib/alf/operator/relational/extend.rb +17 -22
- data/lib/alf/operator/relational/group.rb +16 -27
- data/lib/alf/operator/relational/heading.rb +15 -25
- data/lib/alf/operator/relational/intersect.rb +14 -33
- data/lib/alf/operator/relational/join.rb +15 -103
- data/lib/alf/operator/relational/matching.rb +15 -42
- data/lib/alf/operator/relational/minus.rb +14 -33
- data/lib/alf/operator/relational/not_matching.rb +15 -42
- data/lib/alf/operator/relational/project.rb +20 -20
- data/lib/alf/operator/relational/quota.rb +19 -47
- data/lib/alf/operator/relational/rank.rb +19 -52
- data/lib/alf/operator/relational/rename.rb +16 -17
- data/lib/alf/operator/relational/restrict.rb +16 -18
- data/lib/alf/operator/relational/summarize.rb +19 -75
- data/lib/alf/operator/relational/ungroup.rb +16 -22
- data/lib/alf/operator/relational/union.rb +17 -29
- data/lib/alf/operator/relational/unwrap.rb +17 -19
- data/lib/alf/operator/relational/wrap.rb +18 -20
- data/lib/alf/operator/signature.rb +67 -96
- data/lib/alf/operator/unary.rb +4 -26
- data/lib/alf/operator.rb +68 -0
- data/lib/alf/reader/alf_file.rb +5 -5
- data/lib/alf/reader/class_methods.rb +47 -38
- data/lib/alf/reader/{base.rb → instance_methods.rb} +18 -40
- data/lib/alf/reader/rash.rb +3 -3
- data/lib/alf/reader.rb +37 -0
- data/lib/alf/relation/instance_methods.rb +17 -37
- data/lib/alf/relation.rb +28 -0
- data/lib/alf/renderer/{base.rb → instance_methods.rb} +13 -30
- data/lib/alf/renderer.rb +32 -0
- data/lib/alf/tools/coerce.rb +18 -7
- data/lib/alf/tools/miscellaneous.rb +56 -29
- data/lib/alf/tools/to_lispy.rb +37 -40
- data/lib/alf/tools/to_ruby_literal.rb +24 -7
- data/lib/alf/tools/tuple_handle.rb +27 -17
- data/lib/alf/tools.rb +14 -0
- data/lib/alf/types/attr_list.rb +135 -31
- data/lib/alf/types/attr_name.rb +56 -18
- data/lib/alf/types/boolean.rb +18 -5
- data/lib/alf/types/heading.rb +83 -59
- data/lib/alf/types/ordering.rb +117 -64
- data/lib/alf/types/renaming.rb +73 -33
- data/lib/alf/types/size.rb +57 -0
- data/lib/alf/types/summarization.rb +105 -43
- data/lib/alf/types/tuple_computation.rb +113 -38
- data/lib/alf/types/tuple_expression.rb +122 -31
- data/lib/alf/types/tuple_predicate.rb +64 -40
- data/lib/alf/types.rb +49 -0
- data/lib/alf/version.rb +6 -6
- data/lib/alf-csv/alf/csv/commons.rb +36 -0
- data/lib/alf-csv/alf/csv/reader.rb +33 -0
- data/lib/alf-csv/alf/csv/renderer.rb +38 -0
- data/lib/alf-csv/alf/csv.rb +3 -0
- data/lib/alf-engine/alf/engine/aggregate.rb +44 -0
- data/lib/alf-engine/alf/engine/autonum.rb +45 -0
- data/lib/{alf/operator → alf-engine/alf/engine}/cesure.rb +13 -13
- data/lib/alf-engine/alf/engine/clip.rb +53 -0
- data/lib/alf-engine/alf/engine/coerce.rb +46 -0
- data/lib/alf-engine/alf/engine/cog.rb +7 -0
- data/lib/alf-engine/alf/engine/compact/set.rb +23 -0
- data/lib/alf-engine/alf/engine/compact/uniq.rb +23 -0
- data/lib/alf-engine/alf/engine/compact.rb +26 -0
- data/lib/alf-engine/alf/engine/concat.rb +25 -0
- data/lib/alf-engine/alf/engine/defaults.rb +43 -0
- data/lib/alf-engine/alf/engine/filter.rb +41 -0
- data/lib/alf-engine/alf/engine/generator.rb +50 -0
- data/lib/alf-engine/alf/engine/group/hash.rb +40 -0
- data/lib/alf-engine/alf/engine/group.rb +7 -0
- data/lib/alf-engine/alf/engine/join/hash.rb +35 -0
- data/lib/alf-engine/alf/engine/join.rb +7 -0
- data/lib/alf-engine/alf/engine/materialize/array.rb +78 -0
- data/lib/alf-engine/alf/engine/materialize/hash.rb +122 -0
- data/lib/alf-engine/alf/engine/materialize.rb +8 -0
- data/lib/alf-engine/alf/engine/quota/cesure.rb +46 -0
- data/lib/alf-engine/alf/engine/quota.rb +7 -0
- data/lib/alf-engine/alf/engine/rank/cesure.rb +48 -0
- data/lib/alf-engine/alf/engine/rank.rb +7 -0
- data/lib/alf-engine/alf/engine/rename.rb +39 -0
- data/lib/alf-engine/alf/engine/semi/hash.rb +39 -0
- data/lib/alf-engine/alf/engine/semi.rb +7 -0
- data/lib/alf-engine/alf/engine/set_attr.rb +46 -0
- data/lib/alf-engine/alf/engine/sort/in_memory.rb +39 -0
- data/lib/alf-engine/alf/engine/sort.rb +28 -0
- data/lib/alf-engine/alf/engine/summarize/cesure.rb +51 -0
- data/lib/alf-engine/alf/engine/summarize/hash.rb +35 -0
- data/lib/alf-engine/alf/engine/summarize.rb +8 -0
- data/lib/alf-engine/alf/engine/ungroup.rb +29 -0
- data/lib/alf-engine/alf/engine/unwrap.rb +31 -0
- data/lib/alf-engine/alf/engine/wrap.rb +39 -0
- data/lib/alf-engine/alf/engine.rb +25 -0
- data/lib/{alf/extra/logs.rb → alf-logs/alf/logs/reader.rb} +14 -16
- data/lib/alf-logs/alf/logs.rb +1 -0
- data/lib/alf-sequel/alf/sequel/environment.rb +57 -0
- data/lib/alf-sequel/alf/sequel/iterator.rb +21 -0
- data/lib/alf-sequel/alf/sequel.rb +2 -0
- data/lib/{alf → alf-shell/alf/shell}/command/exec.rb +3 -4
- data/lib/{alf → alf-shell/alf/shell}/command/help.rb +3 -4
- data/lib/alf-shell/alf/shell/command/main/class_methods.rb +46 -0
- data/lib/{alf → alf-shell/alf/shell}/command/main.rb +9 -51
- data/lib/{alf → alf-shell/alf/shell}/command/show.rb +5 -7
- data/lib/alf-shell/alf/shell/command.rb +26 -0
- data/lib/{alf/command → alf-shell/alf/shell}/doc_manager.rb +3 -3
- data/lib/alf-shell/alf/shell/operator.rb +86 -0
- data/lib/alf-shell/alf/shell.rb +40 -0
- data/lib/{alf/extra/yaml.rb → alf-yaml/alf/yaml/renderer.rb} +5 -7
- data/lib/alf-yaml/alf/yaml.rb +1 -0
- data/lib/alf.rb +17 -358
- data/spec/{unit → integration}/lispy/test_relation.rb +0 -0
- data/spec/{unit → integration}/lispy/test_run.rb +0 -0
- data/spec/{unit → integration}/lispy/test_tuple.rb +0 -0
- data/spec/integration/{command → shell}/alf/alf.db +0 -0
- data/spec/integration/{command → shell}/alf/alf_e.cmd +0 -0
- data/spec/integration/{command → shell}/alf/alf_e.stdout +0 -0
- data/spec/integration/shell/alf/alf_env.cmd +1 -0
- data/spec/integration/{command → shell}/alf/alf_env.stdout +0 -0
- data/spec/integration/shell/alf/alf_env_sqlite.cmd +1 -0
- data/spec/integration/{command → shell}/alf/alf_env_sqlite.stdout +0 -0
- data/spec/integration/{command → shell}/alf/alf_help.cmd +0 -0
- data/spec/integration/{command → shell}/alf/alf_help.stdout +0 -0
- data/spec/integration/{command → shell}/alf/alf_implicit.alf +0 -0
- data/spec/integration/shell/alf/alf_implicit_exec.cmd +1 -0
- data/spec/integration/{command → shell}/alf/alf_implicit_exec.stdout +0 -0
- data/spec/integration/{command → shell}/alf/alf_r.cmd +0 -0
- data/spec/integration/{command → shell}/alf/alf_r.stdout +0 -0
- data/spec/integration/{command → shell}/alf/alf_version.cmd +0 -0
- data/spec/integration/{command → shell}/alf/alf_version.stdout +0 -0
- data/spec/integration/{command → shell}/alf/alf_yaml.cmd +0 -0
- data/spec/integration/{command → shell}/alf/alf_yaml.stdout +0 -0
- data/spec/integration/{command → shell}/alf/rel.rash +0 -0
- data/spec/integration/{command → shell}/autonum/autonum_0.cmd +0 -0
- data/spec/integration/{command → shell}/autonum/autonum_0.stdout +0 -0
- data/spec/integration/shell/autonum/autonum_1.cmd +1 -0
- data/spec/integration/{command → shell}/autonum/autonum_1.stdout +0 -0
- data/spec/integration/shell/clip/clip_0.cmd +1 -0
- data/spec/integration/{command → shell}/clip/clip_0.stdout +0 -0
- data/spec/integration/shell/clip/clip_1.cmd +1 -0
- data/spec/integration/{command → shell}/clip/clip_1.stdout +0 -0
- data/spec/integration/{command → shell}/coerce/coerce_1.cmd +0 -0
- data/spec/integration/{command → shell}/coerce/coerce_1.stdout +0 -0
- data/spec/integration/{command → shell}/compact/compact_0.cmd +0 -0
- data/spec/integration/{command → shell}/compact/compact_0.stdout +0 -0
- data/spec/integration/{command → shell}/defaults/defaults_0.cmd +0 -0
- data/spec/integration/{command → shell}/defaults/defaults_0.stdout +0 -0
- data/spec/integration/{command → shell}/defaults/defaults_1.cmd +0 -0
- data/spec/integration/{command → shell}/defaults/defaults_1.stdout +0 -0
- data/spec/integration/{command → shell}/defaults/defaults_2.cmd +0 -0
- data/spec/integration/{command → shell}/defaults/defaults_2.stdout +0 -0
- data/spec/integration/{command → shell}/extend/extend_0.cmd +0 -0
- data/spec/integration/{command → shell}/extend/extend_0.stdout +0 -0
- data/spec/integration/{command → shell}/generator/generator_1.cmd +0 -0
- data/spec/integration/{command → shell}/generator/generator_1.stdout +0 -0
- data/spec/integration/{command → shell}/generator/generator_2.cmd +0 -0
- data/spec/integration/{command → shell}/generator/generator_2.stdout +0 -0
- data/spec/integration/{command → shell}/generator/generator_3.cmd +0 -0
- data/spec/integration/{command → shell}/generator/generator_3.stdout +0 -0
- data/spec/integration/{command → shell}/group/group_0.cmd +0 -0
- data/spec/integration/{command → shell}/group/group_0.stdout +0 -0
- data/spec/integration/{command → shell}/group/group_1.cmd +0 -0
- data/spec/integration/{command → shell}/group/group_1.stdout +0 -0
- data/spec/integration/{command → shell}/help/help_1.cmd +0 -0
- data/spec/integration/{command → shell}/help/help_1.stdout +0 -0
- data/spec/integration/{command → shell}/intersect/intersect_0.cmd +0 -0
- data/spec/integration/{command → shell}/intersect/intersect_0.stdout +0 -0
- data/spec/integration/{command → shell}/join/join_0.cmd +0 -0
- data/spec/integration/{command → shell}/join/join_0.stdout +0 -0
- data/spec/integration/{command → shell}/matching/matching_0.cmd +0 -0
- data/spec/integration/{command → shell}/matching/matching_0.stdout +0 -0
- data/spec/integration/{command → shell}/minus/minus_0.cmd +0 -0
- data/spec/integration/{command → shell}/minus/minus_0.stdout +0 -0
- data/spec/integration/{command → shell}/not-matching/not-matching_0.cmd +0 -0
- data/spec/integration/{command → shell}/not-matching/not-matching_0.stdout +0 -0
- data/spec/integration/{command → shell}/project/project_0.cmd +0 -0
- data/spec/integration/{command → shell}/project/project_0.stdout +0 -0
- data/spec/integration/{command → shell}/project/project_1.cmd +0 -0
- data/spec/integration/{command → shell}/project/project_1.stdout +0 -0
- data/spec/integration/{command → shell}/quota/quota_0.cmd +0 -0
- data/spec/integration/{command → shell}/quota/quota_0.stdout +0 -0
- data/spec/integration/{command → shell}/rank/rank_1.cmd +0 -0
- data/spec/integration/{command → shell}/rank/rank_1.stdout +1 -1
- data/spec/integration/{command → shell}/rank/rank_2.cmd +0 -0
- data/spec/integration/{command → shell}/rank/rank_2.stdout +1 -1
- data/spec/integration/{command → shell}/rank/rank_3.cmd +0 -0
- data/spec/integration/{command → shell}/rank/rank_3.stdout +0 -0
- data/spec/integration/{command → shell}/rank/rank_4.cmd +0 -0
- data/spec/integration/{command → shell}/rank/rank_4.stdout +0 -0
- data/spec/integration/{command → shell}/rank/rank_5.cmd +0 -0
- data/spec/integration/{command → shell}/rank/rank_5.stdout +0 -0
- data/spec/integration/{command → shell}/rename/rename_0.cmd +0 -0
- data/spec/integration/{command → shell}/rename/rename_0.stdout +0 -0
- data/spec/integration/{command → shell}/restrict/restrict_0.cmd +0 -0
- data/spec/integration/{command → shell}/restrict/restrict_0.stdout +0 -0
- data/spec/integration/{command → shell}/restrict/restrict_1.cmd +0 -0
- data/spec/integration/{command → shell}/restrict/restrict_1.stdout +0 -0
- data/spec/integration/{command → shell}/show/show_base.cmd +0 -0
- data/spec/integration/{command → shell}/show/show_base.stdout +0 -0
- data/spec/integration/{command → shell}/show/show_base_sort_1.cmd +0 -0
- data/spec/integration/{command → shell}/show/show_base_sort_1.stdout +0 -0
- data/spec/integration/{command → shell}/show/show_base_sort_2.cmd +0 -0
- data/spec/integration/{command → shell}/show/show_base_sort_2.stdout +0 -0
- data/spec/integration/{command → shell}/show/show_conflictual.cmd +0 -0
- data/spec/integration/{command → shell}/show/show_conflictual.stdout +0 -0
- data/spec/integration/{command → shell}/show/show_csv.cmd +0 -0
- data/spec/integration/{command → shell}/show/show_csv.stdout +0 -0
- data/spec/integration/{command → shell}/show/show_ff.cmd +0 -0
- data/spec/integration/{command → shell}/show/show_ff.stdout +0 -0
- data/spec/integration/{command → shell}/show/show_rash.cmd +0 -0
- data/spec/integration/{command → shell}/show/show_rash.stdout +0 -0
- data/spec/integration/{command → shell}/show/show_rash_pretty.cmd +0 -0
- data/spec/integration/{command → shell}/show/show_rash_pretty.stdout +0 -0
- data/spec/integration/{command → shell}/show/show_yaml.cmd +0 -0
- data/spec/integration/{command → shell}/show/show_yaml.stdout +0 -0
- data/spec/integration/{command → shell}/sort/sort_0.cmd +0 -0
- data/spec/integration/{command → shell}/sort/sort_0.stdout +0 -0
- data/spec/integration/{command → shell}/sort/sort_1.cmd +0 -0
- data/spec/integration/{command → shell}/sort/sort_1.stdout +0 -0
- data/spec/integration/{command → shell}/sort/sort_2.cmd +0 -0
- data/spec/integration/{command → shell}/sort/sort_2.stdout +0 -0
- data/spec/integration/{command → shell}/sort/sort_3.cmd +0 -0
- data/spec/integration/{command → shell}/sort/sort_3.stdout +0 -0
- data/spec/integration/{command → shell}/summarize/summarize_0.cmd +0 -0
- data/spec/integration/{command → shell}/summarize/summarize_0.stdout +0 -0
- data/spec/integration/{command → shell}/ungroup/ungroup_0.cmd +0 -0
- data/spec/integration/{command → shell}/ungroup/ungroup_0.stdout +0 -0
- data/spec/integration/{command → shell}/union/union_0.cmd +0 -0
- data/spec/integration/{command → shell}/union/union_0.stdout +0 -0
- data/spec/integration/{command → shell}/unwrap/unwrap_0.cmd +0 -0
- data/spec/integration/{command → shell}/unwrap/unwrap_0.stdout +0 -0
- data/spec/integration/{command → shell}/wrap/wrap_0.cmd +0 -0
- data/spec/integration/{command → shell}/wrap/wrap_0.stdout +0 -0
- data/spec/{unit → integration}/test_lispy.rb +0 -0
- data/spec/integration/{test_command.rb → test_shell.rb} +3 -3
- data/spec/regression/heading/test_heading_with_date.rb +1 -1
- data/spec/shared/a_valid_type_implementation.rb +47 -0
- data/spec/shared/an_operator_class.rb +2 -6
- data/spec/spec_helper.rb +9 -1
- data/spec/unit/alf-core/aggregator/test_avg.rb +22 -0
- data/spec/unit/alf-core/aggregator/test_collect.rb +25 -0
- data/spec/unit/alf-core/aggregator/test_concat.rb +31 -0
- data/spec/unit/alf-core/aggregator/test_count.rb +17 -0
- data/spec/unit/alf-core/aggregator/test_max.rb +23 -0
- data/spec/unit/alf-core/aggregator/test_min.rb +23 -0
- data/spec/unit/alf-core/aggregator/test_stddev.rb +27 -0
- data/spec/unit/alf-core/aggregator/test_sum.rb +23 -0
- data/spec/unit/alf-core/aggregator/test_variance.rb +29 -0
- data/spec/unit/{assumptions → alf-core/assumptions}/test_file.rb +0 -0
- data/spec/unit/{assumptions → alf-core/assumptions}/test_instance_eval.rb +0 -0
- data/spec/unit/{assumptions → alf-core/assumptions}/test_scoping.rb +0 -0
- data/spec/unit/{assumptions → alf-core/assumptions}/test_set.rb +0 -0
- data/spec/unit/{environment → alf-core/environment}/examples/suppliers.rash +0 -0
- data/spec/unit/alf-core/environment/test_folder.rb +53 -0
- data/spec/unit/{operator → alf-core/operator}/non_relational/test_autonum.rb +18 -31
- data/spec/unit/alf-core/operator/non_relational/test_clip.rb +35 -0
- data/spec/unit/{operator → alf-core/operator}/non_relational/test_coerce.rb +11 -17
- data/spec/unit/{operator/non_relational/compact/test_sort_based.rb → alf-core/operator/non_relational/test_compact.rb} +16 -14
- data/spec/unit/{operator → alf-core/operator}/non_relational/test_defaults.rb +17 -32
- data/spec/unit/{operator → alf-core/operator}/non_relational/test_generator.rb +21 -39
- data/spec/unit/{operator → alf-core/operator}/non_relational/test_sort.rb +20 -26
- data/spec/unit/{operator → alf-core/operator}/relational/test_extend.rb +8 -14
- data/spec/unit/{operator → alf-core/operator}/relational/test_group.rb +12 -28
- data/spec/unit/alf-core/operator/relational/test_heading.rb +27 -0
- data/spec/unit/{operator → alf-core/operator}/relational/test_intersect.rb +22 -22
- data/spec/unit/{operator → alf-core/operator}/relational/test_join.rb +7 -7
- data/spec/unit/{operator → alf-core/operator}/relational/test_minus.rb +23 -23
- data/spec/unit/alf-core/operator/relational/test_project.rb +62 -0
- data/spec/unit/{operator → alf-core/operator}/relational/test_quota.rb +8 -15
- data/spec/unit/alf-core/operator/relational/test_rank.rb +48 -0
- data/spec/unit/{operator → alf-core/operator}/relational/test_rename.rb +8 -14
- data/spec/unit/alf-core/operator/relational/test_restrict.rb +45 -0
- data/spec/unit/{operator → alf-core/operator}/relational/test_summarize.rb +13 -31
- data/spec/unit/{operator → alf-core/operator}/relational/test_ungroup.rb +9 -15
- data/spec/unit/{operator → alf-core/operator}/relational/test_union.rb +11 -11
- data/spec/unit/{operator → alf-core/operator}/relational/test_unwrap.rb +10 -16
- data/spec/unit/{operator → alf-core/operator}/relational/test_wrap.rb +10 -16
- data/spec/unit/alf-core/operator/signature/test_argv2args.rb +82 -0
- data/spec/unit/alf-core/operator/signature/test_collect_on.rb +38 -0
- data/spec/unit/{operator → alf-core/operator}/signature/test_initialize.rb +0 -0
- data/spec/unit/{operator → alf-core/operator}/signature/test_install.rb +0 -0
- data/spec/unit/{operator → alf-core/operator}/signature/test_option_parser.rb +0 -0
- data/spec/unit/alf-core/operator/signature/test_parse_args.rb +90 -0
- data/spec/unit/{operator → alf-core/operator}/signature/test_to_lispy.rb +0 -0
- data/spec/unit/{operator → alf-core/operator}/signature/test_to_shell.rb +0 -0
- data/spec/unit/{operator → alf-core/operator}/test_non_relational.rb +0 -0
- data/spec/unit/{operator → alf-core/operator}/test_relational.rb +0 -0
- data/spec/unit/{reader → alf-core/reader}/input.rb +0 -0
- data/spec/unit/{reader → alf-core/reader}/test_alf_file.rb +0 -0
- data/spec/unit/{reader → alf-core/reader}/test_initialize.rb +0 -0
- data/spec/unit/alf-core/reader/test_looks_a_path.rb +20 -0
- data/spec/unit/{reader → alf-core/reader}/test_rash.rb +0 -0
- data/spec/unit/{relation → alf-core/relation}/test_coerce.rb +0 -0
- data/spec/unit/{relation → alf-core/relation}/test_inspect.rb +0 -0
- data/spec/unit/{relation → alf-core/relation}/test_relops.rb +0 -0
- data/spec/unit/{relation → alf-core/relation}/test_to_a.rb +0 -0
- data/spec/unit/{renderer → alf-core/renderer}/test_initialize.rb +0 -0
- data/spec/unit/alf-core/test_aggregator.rb +58 -0
- data/spec/unit/{test_environment.rb → alf-core/test_environment.rb} +8 -21
- data/spec/unit/{test_operator.rb → alf-core/test_operator.rb} +0 -0
- data/spec/unit/{test_reader.rb → alf-core/test_reader.rb} +0 -0
- data/spec/unit/{test_relation.rb → alf-core/test_relation.rb} +0 -0
- data/spec/unit/{test_renderer.rb → alf-core/test_renderer.rb} +0 -0
- data/spec/unit/{text → alf-core/text}/test_cell.rb +0 -0
- data/spec/unit/{text → alf-core/text}/test_row.rb +0 -0
- data/spec/unit/{text → alf-core/text}/test_table.rb +0 -0
- data/spec/unit/alf-core/tools/test_class_name.rb +16 -0
- data/spec/unit/{tools → alf-core/tools}/test_coalesce.rb +6 -2
- data/spec/unit/alf-core/tools/test_coerce.rb +16 -0
- data/spec/unit/alf-core/tools/test_ruby_case.rb +16 -0
- data/spec/unit/{tools → alf-core/tools}/test_to_lispy.rb +14 -7
- data/spec/unit/{tools → alf-core/tools}/test_to_ruby_literal.rb +5 -5
- data/spec/unit/{tools → alf-core/tools}/test_tuple_handle.rb +14 -14
- data/spec/unit/alf-core/tools/test_tuple_heading.rb +15 -0
- data/spec/unit/{tools → alf-core/tools}/test_varargs.rb +9 -6
- data/spec/unit/alf-core/types/test_attr_list.rb +188 -0
- data/spec/unit/alf-core/types/test_attr_name.rb +78 -0
- data/spec/unit/{types/test_attr_name.rb → alf-core/types/test_boolean.rb} +18 -28
- data/spec/unit/alf-core/types/test_class_methods.rb +24 -0
- data/spec/unit/alf-core/types/test_heading.rb +146 -0
- data/spec/unit/alf-core/types/test_ordering.rb +185 -0
- data/spec/unit/alf-core/types/test_renaming.rb +72 -0
- data/spec/unit/alf-core/types/test_size.rb +74 -0
- data/spec/unit/{types → alf-core/types}/test_summarization.rb +46 -14
- data/spec/unit/{types → alf-core/types}/test_tuple_computation.rb +46 -10
- data/spec/unit/alf-core/types/test_tuple_expression.rb +122 -0
- data/spec/unit/{types → alf-core/types}/test_tuple_predicate.rb +51 -22
- data/spec/unit/{csv → alf-csv}/input.csv +0 -0
- data/spec/unit/{csv → alf-csv}/test_reader.rb +0 -0
- data/spec/unit/{csv → alf-csv}/test_renderer.rb +1 -1
- data/spec/unit/alf-engine/compact/test_set.rb +33 -0
- data/spec/unit/alf-engine/compact/test_uniq.rb +33 -0
- data/spec/unit/alf-engine/group/test_hash.rb +34 -0
- data/spec/unit/{operator/relational/join/test_hash_based.rb → alf-engine/join/test_hash.rb} +21 -29
- data/spec/unit/alf-engine/materialize/test_array.rb +28 -0
- data/spec/unit/alf-engine/materialize/test_hash.rb +76 -0
- data/spec/unit/alf-engine/quota/test_cesure.rb +34 -0
- data/spec/unit/{operator/relational/test_rank.rb → alf-engine/rank/test_cesure.rb} +21 -24
- data/spec/unit/alf-engine/semi/test_hash.rb +58 -0
- data/spec/unit/alf-engine/sort/test_in_memory.rb +32 -0
- data/spec/unit/{operator/relational/summarize/test_hash_based.rb → alf-engine/summarize/test_cesure.rb} +15 -21
- data/spec/unit/{operator/relational/summarize/test_sort_based.rb → alf-engine/summarize/test_hash.rb} +15 -21
- data/spec/unit/alf-engine/test_aggregate.rb +26 -0
- data/spec/unit/alf-engine/test_autonum.rb +24 -0
- data/spec/unit/alf-engine/test_clip.rb +34 -0
- data/spec/unit/alf-engine/test_coerce.rb +35 -0
- data/spec/unit/alf-engine/test_compact.rb +33 -0
- data/spec/unit/alf-engine/test_concat.rb +38 -0
- data/spec/unit/alf-engine/test_defaults.rb +37 -0
- data/spec/unit/alf-engine/test_filter.rb +23 -0
- data/spec/unit/alf-engine/test_generator.rb +25 -0
- data/spec/unit/alf-engine/test_rename.rb +24 -0
- data/spec/unit/alf-engine/test_set_attr.rb +38 -0
- data/spec/unit/alf-engine/test_sort.rb +32 -0
- data/spec/unit/alf-engine/test_ungroup.rb +28 -0
- data/spec/unit/alf-engine/test_unwrap.rb +20 -0
- data/spec/unit/alf-engine/test_wrap.rb +26 -0
- data/spec/unit/{logs → alf-logs}/apache_combined.log +0 -0
- data/spec/unit/{logs → alf-logs}/postgresql.log +0 -0
- data/spec/unit/{logs → alf-logs}/test_reader.rb +15 -16
- data/spec/unit/{sequel → alf-sequel}/alf.db +0 -0
- data/spec/unit/alf-sequel/test_environment.rb +69 -0
- data/spec/unit/{command → alf-shell}/doc_manager/dynamic.md +0 -0
- data/spec/unit/{command → alf-shell}/doc_manager/example.md +0 -0
- data/spec/unit/{command → alf-shell}/doc_manager/example_1.txt +0 -0
- data/spec/unit/{command → alf-shell}/doc_manager/static.md +0 -0
- data/spec/unit/{command → alf-shell}/doc_manager/test_call.rb +2 -3
- data/spec/unit/alf-shell/main/test_class_methods.rb +44 -0
- data/spec/unit/alf-shell/operator/test_autonum.rb +28 -0
- data/spec/unit/alf-shell/operator/test_clip.rb +29 -0
- data/spec/unit/alf-shell/operator/test_coerce.rb +21 -0
- data/spec/unit/alf-shell/operator/test_compact.rb +16 -0
- data/spec/unit/alf-shell/operator/test_defaults.rb +29 -0
- data/spec/unit/alf-shell/operator/test_extend.rb +21 -0
- data/spec/unit/alf-shell/operator/test_generator.rb +37 -0
- data/spec/unit/alf-shell/operator/test_group.rb +32 -0
- data/spec/unit/alf-shell/operator/test_heading.rb +16 -0
- data/spec/unit/alf-shell/operator/test_intersect.rb +18 -0
- data/spec/unit/alf-shell/operator/test_join.rb +18 -0
- data/spec/unit/alf-shell/operator/test_matching.rb +18 -0
- data/spec/unit/alf-shell/operator/test_minus.rb +18 -0
- data/spec/unit/alf-shell/operator/test_not_matching.rb +18 -0
- data/spec/unit/alf-shell/operator/test_project.rb +38 -0
- data/spec/unit/alf-shell/operator/test_quota.rb +23 -0
- data/spec/unit/alf-shell/operator/test_rank.rb +30 -0
- data/spec/unit/alf-shell/operator/test_rename.rb +21 -0
- data/spec/unit/alf-shell/operator/test_restrict.rb +35 -0
- data/spec/unit/alf-shell/operator/test_sort.rb +49 -0
- data/spec/unit/alf-shell/operator/test_summarize.rb +30 -0
- data/spec/unit/alf-shell/operator/test_ungroup.rb +28 -0
- data/spec/unit/alf-shell/operator/test_union.rb +18 -0
- data/spec/unit/alf-shell/operator/test_unwrap.rb +28 -0
- data/spec/unit/alf-shell/operator/test_wrap.rb +30 -0
- data/tasks/debug_mail.rake +42 -45
- data/tasks/gem.rake +13 -13
- data/tasks/gh-pages.rake +11 -6
- data/tasks/integration_test.rake +0 -8
- data/tasks/regression_test.rake +0 -8
- data/tasks/unit_test.rake +0 -8
- data/tasks/yard.rake +13 -13
- metadata +909 -1107
- data/examples/hitradio/compact.rb +0 -48
- data/examples/hitradio/compare1.rb +0 -28
- data/examples/hitradio/gz_reader.rb +0 -23
- data/examples/hitradio/hitradio-1.alf +0 -1
- data/examples/hitradio/hitradio.log +0 -25080
- data/examples/hitradio/hitradio.mar +0 -25081
- data/examples/hitradio/hitradio.mar.gz +0 -0
- data/examples/hitradio/hitradio.rash +0 -25080
- data/examples/hitradio/mar_reader.rb +0 -18
- data/examples/northwind/customers.csv +0 -92
- data/examples/northwind/northwind.db +0 -0
- data/examples/northwind/orders.csv +0 -831
- data/lib/alf/aggregator/aggregators.rb +0 -105
- data/lib/alf/aggregator/aggregators.rbc +0 -2640
- data/lib/alf/aggregator/base.rbc +0 -1055
- data/lib/alf/aggregator/class_methods.rbc +0 -830
- data/lib/alf/buffer/sorted.rb +0 -48
- data/lib/alf/buffer/sorted.rbc +0 -715
- data/lib/alf/command/class_methods.rb +0 -27
- data/lib/alf/command/class_methods.rbc +0 -453
- data/lib/alf/command/doc_manager.rbc +0 -1604
- data/lib/alf/command/exec.rbc +0 -408
- data/lib/alf/command/help.rbc +0 -764
- data/lib/alf/command/main.rbc +0 -3612
- data/lib/alf/command/show.rbc +0 -1327
- data/lib/alf/environment/base.rbc +0 -459
- data/lib/alf/environment/class_methods.rbc +0 -1110
- data/lib/alf/environment/explicit.rb +0 -38
- data/lib/alf/environment/explicit.rbc +0 -601
- data/lib/alf/environment/folder.rbc +0 -942
- data/lib/alf/errors.rbc +0 -155
- data/lib/alf/extra/csv.rb +0 -107
- data/lib/alf/extra/csv.rbc +0 -2021
- data/lib/alf/extra/logs.rbc +0 -1957
- data/lib/alf/extra/sequel.rb +0 -77
- data/lib/alf/extra/sequel.rbc +0 -1417
- data/lib/alf/extra/yaml.rbc +0 -435
- data/lib/alf/extra.rb +0 -5
- data/lib/alf/extra.rbc +0 -101
- data/lib/alf/iterator/base.rb +0 -38
- data/lib/alf/iterator/base.rbc +0 -437
- data/lib/alf/iterator/class_methods.rbc +0 -518
- data/lib/alf/iterator/proxy.rbc +0 -599
- data/lib/alf/lispy/instance_methods.rbc +0 -2535
- data/lib/alf/loader.rbc +0 -85
- data/lib/alf/operator/base.rb +0 -74
- data/lib/alf/operator/base.rbc +0 -860
- data/lib/alf/operator/binary.rbc +0 -595
- data/lib/alf/operator/cesure.rbc +0 -883
- data/lib/alf/operator/class_methods.rbc +0 -1915
- data/lib/alf/operator/experimental.rbc +0 -200
- data/lib/alf/operator/non_relational/autonum.rbc +0 -587
- data/lib/alf/operator/non_relational/clip.rbc +0 -522
- data/lib/alf/operator/non_relational/coerce.rbc +0 -596
- data/lib/alf/operator/non_relational/compact.rbc +0 -1283
- data/lib/alf/operator/non_relational/defaults.rbc +0 -733
- data/lib/alf/operator/non_relational/generator.rbc +0 -1015
- data/lib/alf/operator/non_relational/sort.rbc +0 -665
- data/lib/alf/operator/nullary.rbc +0 -404
- data/lib/alf/operator/relational/extend.rbc +0 -616
- data/lib/alf/operator/relational/group.rbc +0 -968
- data/lib/alf/operator/relational/heading.rbc +0 -657
- data/lib/alf/operator/relational/intersect.rbc +0 -969
- data/lib/alf/operator/relational/join.rbc +0 -1708
- data/lib/alf/operator/relational/matching.rbc +0 -1047
- data/lib/alf/operator/relational/minus.rbc +0 -965
- data/lib/alf/operator/relational/not_matching.rbc +0 -1047
- data/lib/alf/operator/relational/project.rbc +0 -669
- data/lib/alf/operator/relational/quota.rbc +0 -1193
- data/lib/alf/operator/relational/rank.rbc +0 -1217
- data/lib/alf/operator/relational/rename.rbc +0 -496
- data/lib/alf/operator/relational/restrict.rbc +0 -611
- data/lib/alf/operator/relational/summarize.rbc +0 -1922
- data/lib/alf/operator/relational/ungroup.rbc +0 -643
- data/lib/alf/operator/relational/union.rbc +0 -846
- data/lib/alf/operator/relational/unwrap.rbc +0 -540
- data/lib/alf/operator/relational/wrap.rbc +0 -560
- data/lib/alf/operator/shortcut.rb +0 -53
- data/lib/alf/operator/shortcut.rbc +0 -809
- data/lib/alf/operator/signature.rbc +0 -4640
- data/lib/alf/operator/transform.rb +0 -27
- data/lib/alf/operator/transform.rbc +0 -484
- data/lib/alf/operator/unary.rbc +0 -629
- data/lib/alf/reader/alf_file.rbc +0 -464
- data/lib/alf/reader/base.rbc +0 -1613
- data/lib/alf/reader/class_methods.rbc +0 -1099
- data/lib/alf/reader/rash.rbc +0 -583
- data/lib/alf/relation/class_methods.rbc +0 -674
- data/lib/alf/relation/instance_methods.rbc +0 -2107
- data/lib/alf/renderer/base.rbc +0 -936
- data/lib/alf/renderer/class_methods.rbc +0 -875
- data/lib/alf/renderer/rash.rbc +0 -802
- data/lib/alf/renderer/text.rbc +0 -5530
- data/lib/alf/tools/coerce.rbc +0 -352
- data/lib/alf/tools/miscellaneous.rbc +0 -1497
- data/lib/alf/tools/to_lispy.rbc +0 -2618
- data/lib/alf/tools/to_ruby_literal.rbc +0 -344
- data/lib/alf/tools/tuple_handle.rbc +0 -738
- data/lib/alf/types/attr_list.rbc +0 -1535
- data/lib/alf/types/attr_name.rbc +0 -781
- data/lib/alf/types/boolean.rbc +0 -365
- data/lib/alf/types/heading.rbc +0 -1778
- data/lib/alf/types/ordering.rbc +0 -2228
- data/lib/alf/types/renaming.rbc +0 -1064
- data/lib/alf/types/summarization.rbc +0 -1394
- data/lib/alf/types/tuple_computation.rbc +0 -1061
- data/lib/alf/types/tuple_expression.rbc +0 -1016
- data/lib/alf/types/tuple_predicate.rbc +0 -1349
- data/lib/alf/version.rbc +0 -350
- data/lib/alf.rbc +0 -3884
- data/spec/integration/command/alf/alf_env.cmd +0 -1
- data/spec/integration/command/alf/alf_env_sqlite.cmd +0 -1
- data/spec/integration/command/alf/alf_implicit_exec.cmd +0 -1
- data/spec/integration/command/autonum/autonum_1.cmd +0 -1
- data/spec/integration/command/clip/clip_0.cmd +0 -1
- data/spec/integration/command/clip/clip_1.cmd +0 -1
- data/spec/integration/command/show/show_rash_2.cmd +0 -1
- data/spec/integration/command/show/show_rash_2.stdout +0 -5
- data/spec/integration/test_alf.rbc +0 -1098
- data/spec/integration/test_command.rbc +0 -1832
- data/spec/integration/test_examples.rbc +0 -559
- data/spec/integration/test_semantics.rbc +0 -991
- data/spec/regression/alf_file/test___FILE__.rbc +0 -524
- data/spec/regression/heading/test_heading_with_date.rbc +0 -381
- data/spec/regression/lispy/test_compile.rbc +0 -404
- data/spec/regression/logs/test_path_attribute.rbc +0 -687
- data/spec/regression/relation/test_relation_allbut_all.rbc +0 -468
- data/spec/regression/relation/test_relation_with_date.rbc +0 -381
- data/spec/regression/restrict/test_restrict_with_keywords.rbc +0 -628
- data/spec/shared/a_value.rbc +0 -337
- data/spec/shared/an_operator_class.rbc +0 -908
- data/spec/spec_helper.rbc +0 -453
- data/spec/unit/assumptions/test_file.rbc +0 -668
- data/spec/unit/assumptions/test_instance_eval.rbc +0 -654
- data/spec/unit/assumptions/test_scoping.rbc +0 -755
- data/spec/unit/assumptions/test_set.rbc +0 -1928
- data/spec/unit/command/doc_manager/test_call.rbc +0 -1537
- data/spec/unit/csv/test_reader.rbc +0 -2228
- data/spec/unit/csv/test_renderer.rbc +0 -2426
- data/spec/unit/environment/test_explicit.rb +0 -15
- data/spec/unit/environment/test_explicit.rbc +0 -464
- data/spec/unit/environment/test_folder.rb +0 -35
- data/spec/unit/environment/test_folder.rbc +0 -1304
- data/spec/unit/lispy/test_relation.rbc +0 -1477
- data/spec/unit/lispy/test_run.rbc +0 -1735
- data/spec/unit/lispy/test_tuple.rbc +0 -1686
- data/spec/unit/logs/test_reader.rbc +0 -1807
- data/spec/unit/operator/non_relational/compact/test_buffer_based.rb +0 -30
- data/spec/unit/operator/non_relational/compact/test_buffer_based.rbc +0 -1127
- data/spec/unit/operator/non_relational/compact/test_sort_based.rbc +0 -1127
- data/spec/unit/operator/non_relational/test_autonum.rbc +0 -1969
- data/spec/unit/operator/non_relational/test_clip.rb +0 -49
- data/spec/unit/operator/non_relational/test_clip.rbc +0 -1850
- data/spec/unit/operator/non_relational/test_coerce.rbc +0 -1290
- data/spec/unit/operator/non_relational/test_compact.rb +0 -38
- data/spec/unit/operator/non_relational/test_compact.rbc +0 -1382
- data/spec/unit/operator/non_relational/test_defaults.rbc +0 -2319
- data/spec/unit/operator/non_relational/test_generator.rbc +0 -2361
- data/spec/unit/operator/non_relational/test_sort.rbc +0 -2583
- data/spec/unit/operator/relational/join/test_hash_based.rbc +0 -2481
- data/spec/unit/operator/relational/matching/test_hash_based.rb +0 -60
- data/spec/unit/operator/relational/matching/test_hash_based.rbc +0 -2458
- data/spec/unit/operator/relational/not_matching/test_hash_based.rb +0 -37
- data/spec/unit/operator/relational/not_matching/test_hash_based.rbc +0 -1632
- data/spec/unit/operator/relational/summarize/test_hash_based.rbc +0 -1990
- data/spec/unit/operator/relational/summarize/test_sort_based.rbc +0 -1990
- data/spec/unit/operator/relational/test_extend.rbc +0 -1300
- data/spec/unit/operator/relational/test_group.rbc +0 -2142
- data/spec/unit/operator/relational/test_intersect.rbc +0 -2069
- data/spec/unit/operator/relational/test_join.rbc +0 -1282
- data/spec/unit/operator/relational/test_minus.rbc +0 -1995
- data/spec/unit/operator/relational/test_project.rb +0 -75
- data/spec/unit/operator/relational/test_project.rbc +0 -2870
- data/spec/unit/operator/relational/test_quota.rbc +0 -1788
- data/spec/unit/operator/relational/test_rank.rbc +0 -2079
- data/spec/unit/operator/relational/test_rename.rbc +0 -1158
- data/spec/unit/operator/relational/test_restrict.rb +0 -56
- data/spec/unit/operator/relational/test_restrict.rbc +0 -2305
- data/spec/unit/operator/relational/test_summarize.rbc +0 -2570
- data/spec/unit/operator/relational/test_ungroup.rbc +0 -1425
- data/spec/unit/operator/relational/test_union.rbc +0 -1089
- data/spec/unit/operator/relational/test_unwrap.rbc +0 -1176
- data/spec/unit/operator/relational/test_wrap.rbc +0 -1203
- data/spec/unit/operator/signature/test_collect_on.rb +0 -45
- data/spec/unit/operator/signature/test_collect_on.rbc +0 -1989
- data/spec/unit/operator/signature/test_initialize.rbc +0 -544
- data/spec/unit/operator/signature/test_install.rbc +0 -1671
- data/spec/unit/operator/signature/test_option_parser.rbc +0 -1348
- data/spec/unit/operator/signature/test_parse_args.rb +0 -60
- data/spec/unit/operator/signature/test_parse_args.rbc +0 -1908
- data/spec/unit/operator/signature/test_parse_argv.rb +0 -87
- data/spec/unit/operator/signature/test_parse_argv.rbc +0 -2878
- data/spec/unit/operator/signature/test_to_lispy.rbc +0 -3305
- data/spec/unit/operator/signature/test_to_shell.rbc +0 -3327
- data/spec/unit/operator/test_non_relational.rbc +0 -571
- data/spec/unit/operator/test_relational.rbc +0 -758
- data/spec/unit/reader/test_alf_file.rbc +0 -1107
- data/spec/unit/reader/test_initialize.rbc +0 -1774
- data/spec/unit/reader/test_rash.rbc +0 -1127
- data/spec/unit/relation/test_coerce.rbc +0 -2320
- data/spec/unit/relation/test_inspect.rbc +0 -502
- data/spec/unit/relation/test_relops.rbc +0 -1585
- data/spec/unit/relation/test_to_a.rbc +0 -1112
- data/spec/unit/renderer/test_initialize.rbc +0 -1766
- data/spec/unit/sequel/test_environment.rb +0 -54
- data/spec/unit/sequel/test_environment.rbc +0 -1723
- data/spec/unit/test_aggregator.rb +0 -109
- data/spec/unit/test_aggregator.rbc +0 -4358
- data/spec/unit/test_environment.rbc +0 -1271
- data/spec/unit/test_lispy.rbc +0 -879
- data/spec/unit/test_operator.rbc +0 -531
- data/spec/unit/test_reader.rbc +0 -1249
- data/spec/unit/test_relation.rbc +0 -2588
- data/spec/unit/test_renderer.rbc +0 -2011
- data/spec/unit/text/test_cell.rbc +0 -1532
- data/spec/unit/text/test_row.rbc +0 -847
- data/spec/unit/text/test_table.rbc +0 -978
- data/spec/unit/tools/test_coalesce.rbc +0 -456
- data/spec/unit/tools/test_coerce.rb +0 -10
- data/spec/unit/tools/test_coerce.rbc +0 -279
- data/spec/unit/tools/test_to_lispy.rbc +0 -5711
- data/spec/unit/tools/test_to_ruby_literal.rbc +0 -272
- data/spec/unit/tools/test_tools.rb +0 -25
- data/spec/unit/tools/test_tools.rbc +0 -672
- data/spec/unit/tools/test_tuple_handle.rbc +0 -1591
- data/spec/unit/tools/test_tuple_heading.rb +0 -20
- data/spec/unit/tools/test_tuple_heading.rbc +0 -821
- data/spec/unit/tools/test_varargs.rbc +0 -495
- data/spec/unit/types/heading/test_union.rb +0 -21
- data/spec/unit/types/heading/test_union.rbc +0 -1043
- data/spec/unit/types/test_attr_list.rb +0 -106
- data/spec/unit/types/test_attr_list.rbc +0 -4481
- data/spec/unit/types/test_attr_name.rbc +0 -1872
- data/spec/unit/types/test_heading.rb +0 -48
- data/spec/unit/types/test_heading.rbc +0 -1735
- data/spec/unit/types/test_ordering.rb +0 -127
- data/spec/unit/types/test_ordering.rbc +0 -3695
- data/spec/unit/types/test_renaming.rb +0 -55
- data/spec/unit/types/test_renaming.rbc +0 -2426
- data/spec/unit/types/test_summarization.rbc +0 -2538
- data/spec/unit/types/test_tuple_computation.rbc +0 -2340
- data/spec/unit/types/test_tuple_expression.rb +0 -64
- data/spec/unit/types/test_tuple_expression.rbc +0 -2285
- data/spec/unit/types/test_tuple_predicate.rbc +0 -3168
@@ -5,16 +5,16 @@ module Alf
|
|
5
5
|
|
6
6
|
# @return [Class] the operator class to which this signature belongs
|
7
7
|
attr_reader :operator
|
8
|
-
|
8
|
+
|
9
9
|
# @return [Array] signature arguments
|
10
10
|
attr_reader :arguments
|
11
11
|
|
12
12
|
# @return [Array] signature options
|
13
13
|
attr_reader :options
|
14
14
|
|
15
|
+
# Creates an empty signature instance
|
15
16
|
#
|
16
|
-
#
|
17
|
-
#
|
17
|
+
# @param [Class] the operator class to which this signature belongs
|
18
18
|
def initialize(operator)
|
19
19
|
@operator = operator
|
20
20
|
@arguments = []
|
@@ -22,73 +22,50 @@ module Alf
|
|
22
22
|
yield(self) if block_given?
|
23
23
|
end
|
24
24
|
|
25
|
-
#
|
26
25
|
# Adds an argument to the signature
|
27
26
|
#
|
28
27
|
# @param [Symbol] name argument name
|
29
28
|
# @param [Class] domain argument domain
|
30
29
|
# @param [Object] default (optional) default value
|
31
|
-
#
|
32
30
|
def argument(name, domain, default = nil, descr = nil)
|
33
31
|
arguments << [name, domain, default, descr]
|
34
32
|
end
|
35
33
|
|
36
|
-
#
|
37
34
|
# Adds an option to the signature
|
38
35
|
#
|
39
36
|
# @param [Symbol] name argument name
|
40
37
|
# @param [Class] domain argument domain
|
41
38
|
# @param [Object] default (optional) default value
|
42
|
-
#
|
43
39
|
def option(name, domain, default = nil, descr = nil)
|
44
40
|
options << [name, domain, default, descr]
|
45
41
|
end
|
46
42
|
|
43
|
+
# Builds an option parser instance `opt` prepared for installing options on
|
44
|
+
# `receiver`.
|
47
45
|
#
|
48
|
-
#
|
49
|
-
#
|
50
|
-
# @return [Hash] the default options
|
51
|
-
#
|
52
|
-
def default_options
|
53
|
-
@default_options ||=
|
54
|
-
Hash[options.select{|opt| !opt[2].nil? }.
|
55
|
-
collect{|opt| [opt[0], opt[2]]}]
|
56
|
-
end
|
57
|
-
|
58
|
-
#
|
59
|
-
# Fills an OptionParser instance according to signature options.
|
60
|
-
#
|
61
|
-
# @param [OptionParser] opt an parser instance, to fill with parse options
|
46
|
+
# @param [Hash|Operator] a receiver for option values
|
47
|
+
# @param [OptionParser] opt the parser to fill with options
|
62
48
|
# @return [OptionParser] `opt`
|
63
|
-
|
64
|
-
def fill_option_parser(opt, receiver)
|
49
|
+
def option_parser(receiver, opt = OptionParser.new)
|
65
50
|
options.each do |option|
|
66
51
|
name, dom, defa, descr = option
|
67
52
|
opt.on(option_name(option), descr || "") do |val|
|
68
|
-
receiver.
|
53
|
+
if receiver.is_a?(Hash)
|
54
|
+
receiver[name] = val
|
55
|
+
else
|
56
|
+
receiver.send(:"#{name}=", val)
|
57
|
+
end
|
69
58
|
end
|
70
59
|
end
|
71
60
|
opt
|
72
61
|
end
|
73
62
|
|
74
|
-
#
|
75
|
-
# Returns an option parser instance bound to a given `receiver` object
|
76
|
-
#
|
77
|
-
# @return [OptionParser] an parser instance, ready to parse options and
|
78
|
-
# install them on `receiver`
|
79
|
-
#
|
80
|
-
def option_parser(receiver)
|
81
|
-
fill_option_parser(OptionParser.new, receiver)
|
82
|
-
end
|
83
|
-
|
84
|
-
#
|
85
63
|
# Installs the signature on the operator class
|
86
64
|
#
|
87
65
|
# This method installs an attr reader and an attr writer for each
|
88
66
|
# signature argument and each signature option.
|
89
67
|
#
|
90
68
|
# @return [Hash] the default options to use
|
91
|
-
#
|
92
69
|
def install
|
93
70
|
clazz = operator
|
94
71
|
code = (arguments + options).each{|siginfo|
|
@@ -101,64 +78,67 @@ module Alf
|
|
101
78
|
}
|
102
79
|
default_options
|
103
80
|
end
|
104
|
-
|
105
|
-
#
|
81
|
+
|
106
82
|
# Parses arguments `args` passed to the operator `initialize` and
|
107
83
|
# sets attributes accordingly on `receiver`.
|
108
84
|
#
|
109
85
|
# @param [Array] args an array of initialize arguments
|
110
86
|
# @param [Operator] receiver an operator instance
|
111
|
-
#
|
87
|
+
# @return [Operator] installed `receiver`
|
112
88
|
def parse_args(args, receiver)
|
113
|
-
invalid_args!(args) if args.size > (1+arguments.size)
|
114
89
|
|
115
|
-
#
|
90
|
+
# 1) Check and set operands, passed as an array as first argument
|
91
|
+
invalid_args!(args) unless args.first.is_a?(Array)
|
92
|
+
receiver.operands = args.shift
|
93
|
+
|
94
|
+
# 2) Extract options if provided
|
116
95
|
optargs = default_options
|
117
96
|
if args.size == (1+arguments.size)
|
97
|
+
# options are passed as last argument
|
118
98
|
invalid_args!(args) unless args.last.is_a?(Hash)
|
119
99
|
optargs = optargs.merge(args.pop)
|
100
|
+
elsif args.size > arguments.size
|
101
|
+
# too many arguments here
|
102
|
+
invalid_args!(args)
|
120
103
|
end
|
121
104
|
|
122
|
-
# Set options
|
105
|
+
# 3) Set options now, including default ones
|
123
106
|
optargs.each_pair do |name,val|
|
124
107
|
receiver.send(:"#{name}=", val)
|
125
108
|
end
|
126
109
|
|
127
|
-
# Parse other arguments now
|
128
|
-
|
129
|
-
|
110
|
+
# 4) Parse other arguments now
|
111
|
+
with_each_arg(args) do |name,dom,value|
|
112
|
+
invalid_args!(args) if value.nil?
|
113
|
+
receiver.send(:"#{name}=", value)
|
130
114
|
end
|
115
|
+
|
116
|
+
receiver
|
131
117
|
end
|
132
|
-
|
133
|
-
#
|
134
|
-
|
135
|
-
# commandline arguments and sets attributes accordingly on `receiver`.
|
136
|
-
#
|
137
|
-
# @param [Array] argv an array of commandline arguments
|
138
|
-
# @param [Operator] receiver an operator instance
|
139
|
-
#
|
140
|
-
def parse_argv(argv, receiver)
|
118
|
+
|
119
|
+
# Converts commandline arguments to operator constructor arguments
|
120
|
+
def argv2args(argv)
|
141
121
|
# First split over --
|
142
122
|
argv = Quickl.split_commandline_args(argv)
|
143
123
|
|
144
|
-
#
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
argv[0] = option_parser(receiver).parse!(argv[0])
|
124
|
+
# Parse the options and replace argv[0] by remaining arguments
|
125
|
+
opts = {}
|
126
|
+
argv[0] = option_parser(opts).parse!(argv[0])
|
127
|
+
opts = default_options.merge(opts)
|
149
128
|
|
150
|
-
#
|
151
|
-
|
129
|
+
# Operands are argv[0], and can be removed
|
130
|
+
oper = argv.shift
|
152
131
|
|
153
|
-
#
|
154
|
-
|
155
|
-
|
132
|
+
# Coerce each remaining argument according to the signature
|
133
|
+
args = []
|
134
|
+
with_each_arg(argv) do |name,dom,value|
|
135
|
+
invalid_args!(args) if value.nil?
|
136
|
+
args << dom.from_argv(Array(value))
|
156
137
|
end
|
157
138
|
|
158
|
-
|
139
|
+
[oper, args, opts]
|
159
140
|
end
|
160
141
|
|
161
|
-
#
|
162
142
|
# Collects signature values on a given operator.
|
163
143
|
#
|
164
144
|
# This methods returns a triple `[datasets, arguments, options]` with
|
@@ -168,28 +148,24 @@ module Alf
|
|
168
148
|
# `self.operator`
|
169
149
|
# @return [Array] a triple [datasets, arguments, options] with operands,
|
170
150
|
# then signature values
|
171
|
-
#
|
172
151
|
def collect_on(op)
|
173
|
-
oper = op.
|
174
|
-
|
175
|
-
|
176
|
-
opts = Hash[options.collect{|name,dom,defa,_|
|
152
|
+
oper = op.operands
|
153
|
+
args = arguments.map{|name,_| op.send(name) }
|
154
|
+
opts = Hash[options.map{|name,dom,defa,_|
|
177
155
|
val = op.send(name)
|
178
156
|
(val == defa) ? nil : [name, val]
|
179
157
|
}.compact]
|
180
158
|
[oper, args, opts]
|
181
159
|
end
|
182
160
|
|
183
|
-
#
|
184
161
|
# Returns a lispy synopsis for this signature
|
185
162
|
#
|
186
163
|
# Example:
|
187
164
|
#
|
188
165
|
# Alf::Operator::Relational::Project.signature.to_shell
|
189
166
|
# # => "(project operand, attributes:AttrList, {allbut: Boolean})"
|
190
|
-
#
|
191
167
|
def to_lispy
|
192
|
-
cmd = operator.
|
168
|
+
cmd = operator.rubycase_name
|
193
169
|
oper = operator.nullary? ? "" :
|
194
170
|
(operator.unary? ? "operand" : "left, right")
|
195
171
|
|
@@ -209,54 +185,49 @@ module Alf
|
|
209
185
|
"(#{cmd} #{argopt}".strip + ")"
|
210
186
|
end
|
211
187
|
|
212
|
-
#
|
213
188
|
# Returns a shell synopsis for this signature.
|
214
189
|
#
|
215
190
|
# Example:
|
216
191
|
#
|
217
192
|
# Alf::Operator::Relational::Project.signature.to_shell
|
218
193
|
# # => "alf project [--allbut] [OPERAND] -- ATTRIBUTES"
|
219
|
-
#
|
220
194
|
def to_shell
|
221
195
|
oper = operator.nullary? ? "" :
|
222
196
|
(operator.unary? ? "[OPERAND]" : "[LEFT] RIGHT")
|
223
197
|
opts = options.collect{|opt| "[#{option_name(opt)}]" }.join(" ")
|
224
198
|
args = arguments.collect{|arg,_| "#{arg.to_s.upcase}" }.join(" -- ")
|
225
199
|
optargs = "#{opts} #{oper} " + (args.empty? ? "" : "-- #{args}")
|
226
|
-
"alf #{operator.
|
200
|
+
"alf #{operator.rubycase_name} #{optargs.strip}".strip
|
227
201
|
end
|
228
202
|
|
229
203
|
private
|
230
204
|
|
205
|
+
# @return the default options as a Hash
|
206
|
+
def default_options
|
207
|
+
@default_options ||=
|
208
|
+
Hash[options.select{|opt| !opt[2].nil? }.
|
209
|
+
map{|opt| [opt[0], opt[2]]}]
|
210
|
+
end
|
211
|
+
|
212
|
+
# @return the name to use in shell for `option`
|
231
213
|
def option_name(option)
|
232
214
|
name, domain, defa, = option
|
233
215
|
domain == Boolean ? "--#{name}" : "--#{name}=#{name.to_s.upcase}"
|
234
216
|
end
|
235
217
|
|
236
|
-
|
218
|
+
# Yields `(name,dom,value)` triples for each argument value
|
219
|
+
def with_each_arg(args)
|
237
220
|
arguments.zip(args).collect do |sigpart,subargs|
|
238
221
|
name, dom, default = sigpart
|
239
|
-
|
240
|
-
|
241
|
-
val = if Array(subargs).empty?
|
242
|
-
Tools.coerce(default, dom)
|
243
|
-
else
|
244
|
-
dom.send(coercer, subargs)
|
245
|
-
end
|
246
|
-
|
247
|
-
# check and yield
|
248
|
-
if val.nil?
|
249
|
-
raise ArgumentError, "Invalid `#{subargs.inspect}` for #{sigpart.inspect}"
|
250
|
-
else
|
251
|
-
yield(name, val)
|
252
|
-
end
|
222
|
+
val = Array(subargs).empty? ? default : subargs
|
223
|
+
yield(name, dom, val)
|
253
224
|
end
|
254
225
|
end
|
255
|
-
|
256
|
-
def invalid_args!(args)
|
257
|
-
raise ArgumentError,
|
226
|
+
|
227
|
+
def invalid_args!(args, msg = "Invalid `#{args.inspect}` for #{self}")
|
228
|
+
raise ArgumentError, msg, caller
|
258
229
|
end
|
259
|
-
|
230
|
+
|
260
231
|
end # class Signature
|
261
232
|
end # module Operator
|
262
233
|
end # module Alf
|
data/lib/alf/operator/unary.rb
CHANGED
@@ -5,34 +5,12 @@ module Alf
|
|
5
5
|
#
|
6
6
|
module Unary
|
7
7
|
include Operator
|
8
|
-
|
9
|
-
#
|
10
|
-
# Sets the operator input
|
11
|
-
#
|
12
|
-
def pipe(input, env = environment)
|
13
|
-
self.environment = env
|
14
|
-
self.datasets = [ input ]
|
15
|
-
self
|
16
|
-
end
|
17
8
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
# Simply returns the first dataset
|
22
|
-
#
|
23
|
-
def input
|
24
|
-
Iterator.coerce(datasets.first, environment)
|
25
|
-
end
|
26
|
-
|
27
|
-
#
|
28
|
-
# Yields the block with each input tuple.
|
29
|
-
#
|
30
|
-
# This method should be preferred to <code>input.each</code> when possible.
|
31
|
-
#
|
32
|
-
def each_input_tuple
|
33
|
-
input.each(&Proc.new)
|
9
|
+
# Simply returns the first operand
|
10
|
+
def operand
|
11
|
+
operands.first
|
34
12
|
end
|
35
|
-
|
13
|
+
|
36
14
|
end # module Unary
|
37
15
|
end # module Operator
|
38
16
|
end # module Alf
|
data/lib/alf/operator.rb
ADDED
@@ -0,0 +1,68 @@
|
|
1
|
+
module Alf
|
2
|
+
#
|
3
|
+
# Namespace for all operators, relational and non-relational ones.
|
4
|
+
#
|
5
|
+
module Operator
|
6
|
+
include Iterator, Tools
|
7
|
+
|
8
|
+
require 'alf/operator/class_methods'
|
9
|
+
require 'alf/operator/signature'
|
10
|
+
require 'alf/operator/instance_methods'
|
11
|
+
require 'alf/operator/nullary'
|
12
|
+
require 'alf/operator/unary'
|
13
|
+
require 'alf/operator/binary'
|
14
|
+
require 'alf/operator/experimental'
|
15
|
+
|
16
|
+
# Namespace for non relational operators
|
17
|
+
module NonRelational
|
18
|
+
require 'alf/operator/non_relational/autonum'
|
19
|
+
require 'alf/operator/non_relational/defaults'
|
20
|
+
require 'alf/operator/non_relational/compact'
|
21
|
+
require 'alf/operator/non_relational/sort'
|
22
|
+
require 'alf/operator/non_relational/clip'
|
23
|
+
require 'alf/operator/non_relational/coerce'
|
24
|
+
require 'alf/operator/non_relational/generator'
|
25
|
+
|
26
|
+
# Yields the block with each operator module in turn
|
27
|
+
def self.each
|
28
|
+
constants.each do |c|
|
29
|
+
val = const_get(c)
|
30
|
+
yield(val) if val.ancestors.include?(Operator::NonRelational)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end # NonRelational
|
34
|
+
|
35
|
+
#
|
36
|
+
# Marker module and namespace for relational operators
|
37
|
+
#
|
38
|
+
module Relational
|
39
|
+
require 'alf/operator/relational/extend'
|
40
|
+
require 'alf/operator/relational/project'
|
41
|
+
require 'alf/operator/relational/restrict'
|
42
|
+
require 'alf/operator/relational/rename'
|
43
|
+
require 'alf/operator/relational/union'
|
44
|
+
require 'alf/operator/relational/minus'
|
45
|
+
require 'alf/operator/relational/intersect'
|
46
|
+
require 'alf/operator/relational/join'
|
47
|
+
require 'alf/operator/relational/matching'
|
48
|
+
require 'alf/operator/relational/not_matching'
|
49
|
+
require 'alf/operator/relational/wrap'
|
50
|
+
require 'alf/operator/relational/unwrap'
|
51
|
+
require 'alf/operator/relational/group'
|
52
|
+
require 'alf/operator/relational/ungroup'
|
53
|
+
require 'alf/operator/relational/summarize'
|
54
|
+
require 'alf/operator/relational/rank'
|
55
|
+
require 'alf/operator/relational/quota'
|
56
|
+
require 'alf/operator/relational/heading'
|
57
|
+
|
58
|
+
# Yields the block with each operator module in turn
|
59
|
+
def self.each
|
60
|
+
constants.each do |c|
|
61
|
+
val = const_get(c)
|
62
|
+
yield(val) if val.ancestors.include?(Operator::Relational)
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end # module Relational
|
66
|
+
|
67
|
+
end # module Operator
|
68
|
+
end # module Alf
|
data/lib/alf/reader/alf_file.rb
CHANGED
@@ -1,23 +1,23 @@
|
|
1
1
|
module Alf
|
2
2
|
class Reader
|
3
3
|
#
|
4
|
-
# Specialization of the Reader
|
4
|
+
# Specialization of the Reader contract for .alf files.
|
5
5
|
#
|
6
6
|
# A .alf file simply contains a query expression in the Lispy DSL. This
|
7
7
|
# reader decodes and compiles the expression and delegates the enumeration
|
8
8
|
# to the obtained operator.
|
9
9
|
#
|
10
|
-
# Note that an Environment must be wired at creation
|
11
|
-
# NoSuchDatasetError will certainly occur otherwise.
|
10
|
+
# Note that an Environment must be wired at creation time. A
|
11
|
+
# NoSuchDatasetError will certainly occur otherwise.
|
12
12
|
#
|
13
13
|
class AlfFile < Reader
|
14
|
-
|
14
|
+
|
15
15
|
# (see Reader#each)
|
16
16
|
def each
|
17
17
|
op = Alf.lispy(environment).compile(input_text, input_path)
|
18
18
|
op.each(&Proc.new)
|
19
19
|
end
|
20
|
-
|
20
|
+
|
21
21
|
Reader.register(:alf, [".alf"], self)
|
22
22
|
end # module AlfFile
|
23
23
|
end # class Reader
|
@@ -1,28 +1,24 @@
|
|
1
1
|
module Alf
|
2
2
|
class Reader
|
3
3
|
module ClassMethods
|
4
|
-
|
5
|
-
#
|
6
|
-
# Returns registered readers
|
7
|
-
#
|
4
|
+
|
5
|
+
# @return [Array<Reader>] registered readers
|
8
6
|
def readers
|
9
7
|
@readers ||= []
|
10
8
|
end
|
11
|
-
|
12
|
-
#
|
13
|
-
# Registers a reader class associated with specific file extensions
|
9
|
+
|
10
|
+
# Registers a reader class associated with specific file extensions.
|
14
11
|
#
|
15
12
|
# Registered class must provide a constructor with the following signature
|
16
|
-
#
|
17
|
-
# which can safely be used as a ruby method name.
|
18
|
-
# that name and
|
19
|
-
# class.
|
13
|
+
# `new(path_or_io, environment = nil, options = {})`. The registration
|
14
|
+
# name must be a symbol which can safely be used as a ruby method name.
|
15
|
+
# A factory method of that name and signature is automatically installed
|
16
|
+
# on the Reader class.
|
20
17
|
#
|
21
18
|
# @param [Symbol] name a name for the kind of data decoded
|
22
19
|
# @param [Array] extensions file extensions mapped to the registered reader
|
23
20
|
# class (should include the '.', e.g. '.foo')
|
24
|
-
# @param [Class] class Reader subclass used to decode this kind of files
|
25
|
-
#
|
21
|
+
# @param [Class] class Reader subclass used to decode this kind of files
|
26
22
|
def register(name, extensions, clazz)
|
27
23
|
readers << [name, extensions, clazz]
|
28
24
|
(class << self; self; end).
|
@@ -30,41 +26,38 @@ module Alf
|
|
30
26
|
clazz.new(*args)
|
31
27
|
end
|
32
28
|
end
|
33
|
-
|
29
|
+
|
30
|
+
# When filepath looks like a String or a path, returns a reader instance
|
31
|
+
# for the source it denotes. Otherwise, delegates the call to
|
32
|
+
# `coerce(filepath)`.
|
34
33
|
#
|
35
|
-
#
|
36
|
-
#
|
37
|
-
# <code>coerce(filepath)</code>
|
38
|
-
#
|
39
|
-
# @param [String] filepath path to a file for which extension is recognized
|
34
|
+
# @param [:to_str|:to_path] filepath path to a file for which extension
|
35
|
+
# is recognized
|
40
36
|
# @param [Array] args optional additional arguments that must be passed at
|
41
37
|
# reader's class new method.
|
42
|
-
# @return [Reader] a reader instance
|
43
|
-
#
|
38
|
+
# @return [Reader] a reader instance built from arguments
|
39
|
+
# @raise [ArgumentError] if `filepath` is not recognized or no reader can
|
40
|
+
# be found for this extension.
|
44
41
|
def reader(filepath, *args)
|
45
|
-
if
|
46
|
-
ext = File.extname(filepath)
|
47
|
-
|
48
|
-
|
49
|
-
else
|
50
|
-
raise "No registered reader for #{ext} (#{filepath})"
|
51
|
-
end
|
52
|
-
elsif args.empty?
|
42
|
+
if looks_a_path?(filepath)
|
43
|
+
ext = File.extname(filepath.to_s)
|
44
|
+
has_reader_for_ext!(ext).new(filepath.to_s, *args)
|
45
|
+
elsif args.empty?
|
53
46
|
coerce(filepath)
|
54
47
|
else
|
55
48
|
raise ArgumentError, "Unable to return a reader for #{filepath} and #{args}"
|
56
49
|
end
|
57
50
|
end
|
58
|
-
|
51
|
+
|
52
|
+
# Coerces `arg` to a Reader instance, using an optional environment to
|
53
|
+
# convert named datasets.
|
59
54
|
#
|
60
|
-
#
|
61
|
-
#
|
62
|
-
#
|
63
|
-
# This method automatically provides readers for Strings and Symbols through
|
64
|
-
# passed environment (**not** through the reader factory) and for IO objects
|
65
|
-
# (through Rash reader). It is part if Alf's internals and should be used
|
66
|
-
# with care.
|
55
|
+
# This method automatically provides readers for Strings and Symbols
|
56
|
+
# through `environment` (**not** through the reader factory) and for IO
|
57
|
+
# objects through a Rash reader.
|
67
58
|
#
|
59
|
+
# @param [Object] arg any value to coerce to a Reader instance
|
60
|
+
# @param [Environment] environment to resolved named datasets (optional)
|
68
61
|
def coerce(arg, environment = nil)
|
69
62
|
case arg
|
70
63
|
when Reader
|
@@ -75,7 +68,23 @@ module Alf
|
|
75
68
|
raise ArgumentError, "Unable to coerce #{arg.inspect} to a reader"
|
76
69
|
end
|
77
70
|
end
|
78
|
-
|
71
|
+
|
72
|
+
private
|
73
|
+
|
74
|
+
# Checks if `path` looks like a usable path
|
75
|
+
def looks_a_path?(path)
|
76
|
+
return false if path.is_a?(StringIO)
|
77
|
+
path.respond_to?(:to_str) or path.respond_to?(:to_path)
|
78
|
+
end
|
79
|
+
|
80
|
+
# @return [Class] the reader class to use for `ext` file extension.
|
81
|
+
# @raise [ArgumentError] if no such reader class can be found
|
82
|
+
def has_reader_for_ext!(ext)
|
83
|
+
entry = readers.find{|r| r[1].include?(ext)}
|
84
|
+
return entry[2] if entry
|
85
|
+
raise ArgumentError, "No registered reader for #{ext}"
|
86
|
+
end
|
87
|
+
|
79
88
|
end # module ClassMethods
|
80
89
|
extend(ClassMethods)
|
81
90
|
end # class Reader
|