facets 1.7.38 → 1.7.46
Sign up to get free protection for your applications and to get access to all the features.
- data/README +17 -6
- data/VERSION +1 -1
- data/doc/CHANGELOG +8 -0
- data/lib/facet/array/combos.rb +1 -0
- data/lib/facet/array/each_combo.rb +1 -0
- data/lib/facet/enumerable/permutation.rb +1 -0
- data/lib/facet/enumerable/sum.rb +1 -0
- data/lib/facet/linkedlist.rb +1 -0
- data/lib/facet/pathname/op_div.rb +1 -0
- data/lib/facets/core/array/combos.rb +3 -0
- data/lib/facets/core/array/each_combo.rb +48 -0
- data/lib/facets/core/enumerable/{permute.rb → permutation.rb} +8 -1
- data/lib/facets/core/enumerable/self/combinations.rb +13 -8
- data/lib/facets/core/enumerable/sum.rb +19 -0
- data/lib/facets/core/pathname/op_div.rb +4 -0
- data/lib/facets/more/annotation.rb +10 -0
- data/lib/facets/more/linkedlist.rb +254 -0
- data/test/lib/facets/core/array/test_at_rand.rb +1 -1
- data/test/lib/facets/core/array/test_delete_unless.rb +1 -1
- data/test/lib/facets/core/array/test_delete_values.rb +1 -1
- data/test/lib/facets/core/array/test_delete_values_at.rb +1 -1
- data/test/lib/facets/core/array/test_first.rb +1 -1
- data/test/lib/facets/core/array/test_head.rb +1 -1
- data/test/lib/facets/core/array/test_last_index.rb +1 -1
- data/test/lib/facets/core/array/test_merge.rb +1 -1
- data/test/lib/facets/core/array/test_mid.rb +1 -1
- data/test/lib/facets/core/array/test_middle.rb +1 -1
- data/test/lib/facets/core/array/test_op_fetch.rb +1 -1
- data/test/lib/facets/core/array/test_pick.rb +1 -1
- data/test/lib/facets/core/array/test_pos.rb +1 -1
- data/test/lib/facets/core/array/test_pot.rb +1 -1
- data/test/lib/facets/core/array/test_pull.rb +1 -1
- data/test/lib/facets/core/array/test_rand_index.rb +1 -1
- data/test/lib/facets/core/array/test_rand_subset.rb +1 -1
- data/test/lib/facets/core/array/test_range.rb +1 -1
- data/test/lib/facets/core/array/test_rotate.rb +1 -1
- data/test/lib/facets/core/array/test_select.rb +1 -1
- data/test/lib/facets/core/array/test_shuffle.rb +1 -1
- data/test/lib/facets/core/array/test_thru.rb +1 -1
- data/test/lib/facets/core/array/test_to_b.rb +1 -1
- data/test/lib/facets/core/array/test_to_h.rb +1 -1
- data/test/lib/facets/core/array/test_to_hash.rb +1 -1
- data/test/lib/facets/core/binding/self/test_of_caller.rb +1 -1
- data/test/lib/facets/core/binding/test___LINE__.rb +1 -1
- data/test/lib/facets/core/binding/test_call_stack.rb +1 -1
- data/test/lib/facets/core/binding/test_called.rb +1 -1
- data/test/lib/facets/core/binding/test_caller.rb +1 -1
- data/test/lib/facets/core/binding/test_defined.rb +1 -1
- data/test/lib/facets/core/binding/test_eval.rb +1 -1
- data/test/lib/facets/core/binding/test_local_variables.rb +1 -1
- data/test/lib/facets/core/binding/test_method_name.rb +1 -1
- data/test/lib/facets/core/binding/test_op_fetch.rb +1 -1
- data/test/lib/facets/core/binding/test_op_store.rb +1 -1
- data/test/lib/facets/core/binding/test_self.rb +1 -1
- data/test/lib/facets/core/class/test_cattr.rb +1 -1
- data/test/lib/facets/core/class/test_descendents.rb +1 -1
- data/test/lib/facets/core/class/test_method_name.rb +1 -1
- data/test/lib/facets/core/class/test_remove_descendents.rb +1 -1
- data/test/lib/facets/core/class/test_unix_path.rb +1 -1
- data/test/lib/facets/core/comparable/test_at_least.rb +1 -1
- data/test/lib/facets/core/comparable/test_clip.rb +1 -1
- data/test/lib/facets/core/comparable/test_cmp.rb +1 -1
- data/test/lib/facets/core/continuation/self/test_create.rb +1 -1
- data/test/lib/facets/core/date/test_days_in_month.rb +1 -1
- data/test/lib/facets/core/date/test_days_of_month.rb +1 -1
- data/test/lib/facets/core/date/test_stamp.rb +1 -1
- data/test/lib/facets/core/date/test_to_date.rb +1 -1
- data/test/lib/facets/core/date/test_to_s.rb +1 -1
- data/test/lib/facets/core/date/test_to_time.rb +1 -1
- data/test/lib/facets/core/dir/self/test_ancestor.rb +1 -1
- data/test/lib/facets/core/dir/self/test_ascend.rb +1 -1
- data/test/lib/facets/core/enumerable/self/test_combinations.rb +11 -8
- data/test/lib/facets/core/enumerable/self/test_cross.rb +1 -1
- data/test/lib/facets/core/enumerable/test_collect_with_index.rb +1 -1
- data/test/lib/facets/core/enumerable/test_commonality.rb +1 -1
- data/test/lib/facets/core/enumerable/test_compact_collect.rb +1 -1
- data/test/lib/facets/core/enumerable/test_count.rb +1 -1
- data/test/lib/facets/core/enumerable/test_cross.rb +1 -1
- data/test/lib/facets/core/enumerable/test_each_by.rb +1 -1
- data/test/lib/facets/core/enumerable/test_each_combination.rb +1 -1
- data/test/lib/facets/core/enumerable/test_each_pair.rb +1 -1
- data/test/lib/facets/core/enumerable/test_each_slice.rb +1 -1
- data/test/lib/facets/core/enumerable/test_each_unique_pair.rb +1 -1
- data/test/lib/facets/core/enumerable/test_eachn.rb +1 -1
- data/test/lib/facets/core/enumerable/test_entropy.rb +1 -1
- data/test/lib/facets/core/enumerable/test_every.rb +1 -1
- data/test/lib/facets/core/enumerable/test_ew.rb +1 -1
- data/test/lib/facets/core/enumerable/test_filter_collect.rb +1 -1
- data/test/lib/facets/core/enumerable/test_find_collisions.rb +1 -1
- data/test/lib/facets/core/enumerable/test_frequency.rb +1 -1
- data/test/lib/facets/core/enumerable/test_graph.rb +1 -1
- data/test/lib/facets/core/enumerable/test_ideal_entropy.rb +1 -1
- data/test/lib/facets/core/enumerable/test_none.rb +1 -1
- data/test/lib/facets/core/enumerable/test_occur.rb +1 -1
- data/test/lib/facets/core/enumerable/test_one.rb +1 -1
- data/test/lib/facets/core/enumerable/test_op_pow.rb +1 -1
- data/test/lib/facets/core/enumerable/test_partition_by.rb +1 -1
- data/test/lib/facets/core/enumerable/test_permutation.rb +29 -0
- data/test/lib/facets/core/enumerable/test_probability.rb +1 -1
- data/test/lib/facets/core/enumerable/test_to_h.rb +1 -1
- data/test/lib/facets/core/enumerable/test_uniq_by.rb +1 -1
- data/test/lib/facets/core/file/self/test_create.rb +1 -1
- data/test/lib/facets/core/file/self/test_open_as_string.rb +1 -1
- data/test/lib/facets/core/file/self/test_read_list.rb +1 -1
- data/test/lib/facets/core/file/self/test_sanitize.rb +1 -1
- data/test/lib/facets/core/file/self/test_split_all.rb +1 -1
- data/test/lib/facets/core/float/test_round_at.rb +1 -1
- data/test/lib/facets/core/float/test_round_to.rb +1 -1
- data/test/lib/facets/core/hash/self/test_zipnew.rb +1 -1
- data/test/lib/facets/core/hash/test_alias.rb +1 -1
- data/test/lib/facets/core/hash/test_assert_has_keys.rb +1 -1
- data/test/lib/facets/core/hash/test_assert_has_only_keys.rb +1 -1
- data/test/lib/facets/core/hash/test_at.rb +1 -1
- data/test/lib/facets/core/hash/test_collate.rb +1 -1
- data/test/lib/facets/core/hash/test_each_with_index.rb +1 -1
- data/test/lib/facets/core/hash/test_each_with_key.rb +1 -1
- data/test/lib/facets/core/hash/test_graph.rb +1 -1
- data/test/lib/facets/core/hash/test_has_keys.rb +1 -1
- data/test/lib/facets/core/hash/test_has_only_keys.rb +1 -1
- data/test/lib/facets/core/hash/test_inverse.rb +1 -1
- data/test/lib/facets/core/hash/test_normalize_keys.rb +1 -1
- data/test/lib/facets/core/hash/test_op_fetch.rb +1 -1
- data/test/lib/facets/core/hash/test_op_lshift.rb +1 -1
- data/test/lib/facets/core/hash/test_rand_key.rb +1 -1
- data/test/lib/facets/core/hash/test_rand_pair.rb +1 -1
- data/test/lib/facets/core/hash/test_rand_value.rb +1 -1
- data/test/lib/facets/core/hash/test_replace_each.rb +1 -1
- data/test/lib/facets/core/hash/test_shuffle.rb +1 -1
- data/test/lib/facets/core/hash/test_slice.rb +1 -1
- data/test/lib/facets/core/hash/test_stringify_keys.rb +1 -1
- data/test/lib/facets/core/hash/test_swap.rb +1 -1
- data/test/lib/facets/core/hash/test_swapkey.rb +1 -1
- data/test/lib/facets/core/hash/test_symbolize_keys.rb +1 -1
- data/test/lib/facets/core/hash/test_to_h.rb +1 -1
- data/test/lib/facets/core/hash/test_to_ostruct.rb +1 -1
- data/test/lib/facets/core/hash/test_to_ostruct_recurse.rb +1 -1
- data/test/lib/facets/core/hash/test_traverse.rb +1 -1
- data/test/lib/facets/core/hash/test_update_each.rb +1 -1
- data/test/lib/facets/core/hash/test_update_keys.rb +1 -1
- data/test/lib/facets/core/hash/test_update_values.rb +1 -1
- data/test/lib/facets/core/hash/test_weave.rb +1 -1
- data/test/lib/facets/core/integer/test_factorial.rb +1 -1
- data/test/lib/facets/core/integer/test_multiple.rb +1 -1
- data/test/lib/facets/core/integer/test_of.rb +1 -1
- data/test/lib/facets/core/integer/test_ordinal.rb +1 -1
- data/test/lib/facets/core/integer/test_times_collect.rb +1 -1
- data/test/lib/facets/core/kernel/test___class__.rb +1 -1
- data/test/lib/facets/core/kernel/test_as.rb +1 -1
- data/test/lib/facets/core/kernel/test_assign_from.rb +1 -1
- data/test/lib/facets/core/kernel/test_assign_with.rb +1 -1
- data/test/lib/facets/core/kernel/test_bool.rb +1 -1
- data/test/lib/facets/core/kernel/test_bug.rb +1 -1
- data/test/lib/facets/core/kernel/test_call_stack.rb +1 -1
- data/test/lib/facets/core/kernel/test_called.rb +1 -1
- data/test/lib/facets/core/kernel/test_callee.rb +1 -1
- data/test/lib/facets/core/kernel/test_constant.rb +1 -1
- data/test/lib/facets/core/kernel/test_copy.rb +1 -1
- data/test/lib/facets/core/kernel/test_deep_copy.rb +1 -1
- data/test/lib/facets/core/kernel/test_demo.rb +1 -1
- data/test/lib/facets/core/kernel/test_fn.rb +1 -1
- data/test/lib/facets/core/kernel/test_get_by_id.rb +1 -1
- data/test/lib/facets/core/kernel/test_here.rb +1 -1
- data/test/lib/facets/core/kernel/test_in.rb +1 -1
- data/test/lib/facets/core/kernel/test_instance_exec.rb +1 -1
- data/test/lib/facets/core/kernel/test_maybe.rb +1 -1
- data/test/lib/facets/core/kernel/test_metaclass.rb +1 -1
- data/test/lib/facets/core/kernel/test_method.rb +1 -1
- data/test/lib/facets/core/kernel/test_methods.rb +1 -1
- data/test/lib/facets/core/kernel/test_new.rb +1 -1
- data/test/lib/facets/core/kernel/test_object_class.rb +1 -1
- data/test/lib/facets/core/kernel/test_object_hexid.rb +1 -1
- data/test/lib/facets/core/kernel/test_quaclass.rb +1 -1
- data/test/lib/facets/core/kernel/test_require_all.rb +1 -1
- data/test/lib/facets/core/kernel/test_require_esc.rb +1 -1
- data/test/lib/facets/core/kernel/test_require_facet.rb +1 -1
- data/test/lib/facets/core/kernel/test_resc.rb +1 -1
- data/test/lib/facets/core/kernel/test_returning.rb +1 -1
- data/test/lib/facets/core/kernel/test_send_as.rb +1 -1
- data/test/lib/facets/core/kernel/test_set_from.rb +1 -1
- data/test/lib/facets/core/kernel/test_set_with.rb +1 -1
- data/test/lib/facets/core/kernel/test_silently.rb +1 -1
- data/test/lib/facets/core/kernel/test_singleton.rb +1 -1
- data/test/lib/facets/core/kernel/test_singleton_class.rb +1 -1
- data/test/lib/facets/core/kernel/test_superior.rb +1 -1
- data/test/lib/facets/core/kernel/test_supermethod.rb +1 -1
- data/test/lib/facets/core/kernel/test_this.rb +1 -1
- data/test/lib/facets/core/kernel/test_to_b.rb +1 -1
- data/test/lib/facets/core/kernel/test_to_bool.rb +1 -1
- data/test/lib/facets/core/kernel/test_to_data.rb +1 -1
- data/test/lib/facets/core/kernel/test_uri.rb +1 -1
- data/test/lib/facets/core/kernel/test_val.rb +1 -1
- data/test/lib/facets/core/kernel/test_with_accessor.rb +1 -1
- data/test/lib/facets/core/matchdata/test_match.rb +1 -1
- data/test/lib/facets/core/matchdata/test_matchtree.rb +1 -1
- data/test/lib/facets/core/module/self/test_op_add.rb +1 -1
- data/test/lib/facets/core/module/test_abstract.rb +1 -1
- data/test/lib/facets/core/module/test_alias_module_function.rb +1 -1
- data/test/lib/facets/core/module/test_ancestor.rb +1 -1
- data/test/lib/facets/core/module/test_basename.rb +1 -1
- data/test/lib/facets/core/module/test_by_name.rb +1 -1
- data/test/lib/facets/core/module/test_class_extension.rb +1 -1
- data/test/lib/facets/core/module/test_clone_using.rb +1 -1
- data/test/lib/facets/core/module/test_dirname.rb +1 -1
- data/test/lib/facets/core/module/test_equate_on.rb +1 -1
- data/test/lib/facets/core/module/test_include_as.rb +1 -1
- data/test/lib/facets/core/module/test_initializer.rb +1 -1
- data/test/lib/facets/core/module/test_instance_methods.rb +1 -1
- data/test/lib/facets/core/module/test_integrate.rb +1 -1
- data/test/lib/facets/core/module/test_memoize.rb +1 -1
- data/test/lib/facets/core/module/test_modspace.rb +1 -1
- data/test/lib/facets/core/module/test_namespace.rb +1 -1
- data/test/lib/facets/core/module/test_nesting.rb +1 -1
- data/test/lib/facets/core/module/test_nodef.rb +1 -1
- data/test/lib/facets/core/module/test_on_included.rb +1 -1
- data/test/lib/facets/core/module/test_redef.rb +1 -1
- data/test/lib/facets/core/module/test_redefine_method.rb +1 -1
- data/test/lib/facets/core/module/test_redirect.rb +1 -1
- data/test/lib/facets/core/module/test_redirect_method.rb +1 -1
- data/test/lib/facets/core/module/test_remove.rb +1 -1
- data/test/lib/facets/core/module/test_rename.rb +1 -1
- data/test/lib/facets/core/module/test_rename_method.rb +1 -1
- data/test/lib/facets/core/module/test_revisal.rb +1 -1
- data/test/lib/facets/core/module/test_shadow_method.rb +1 -1
- data/test/lib/facets/core/module/test_sort_on.rb +1 -1
- data/test/lib/facets/core/module/test_this.rb +1 -1
- data/test/lib/facets/core/module/test_wrap.rb +1 -1
- data/test/lib/facets/core/module/test_wrap_method.rb +1 -1
- data/test/lib/facets/core/nilclass/test_blank.rb +1 -1
- data/test/lib/facets/core/nilclass/test_empty.rb +1 -1
- data/test/lib/facets/core/nilclass/test_include.rb +1 -1
- data/test/lib/facets/core/nilclass/test_op_fetch.rb +1 -1
- data/test/lib/facets/core/nilclass/test_size.rb +1 -1
- data/test/lib/facets/core/nilclass/test_to_h.rb +1 -1
- data/test/lib/facets/core/numeric/test_approx.rb +1 -1
- data/test/lib/facets/core/numeric/test_ceil_multiple.rb +1 -1
- data/test/lib/facets/core/numeric/test_distance.rb +1 -1
- data/test/lib/facets/core/numeric/test_succ.rb +1 -1
- data/test/lib/facets/core/numeric/test_to_b.rb +1 -1
- data/test/lib/facets/core/ostruct/test___merge__.rb +1 -1
- data/test/lib/facets/core/ostruct/test___update__.rb +1 -1
- data/test/lib/facets/core/ostruct/test_op_fetch.rb +1 -1
- data/test/lib/facets/core/ostruct/test_op_store.rb +1 -1
- data/test/lib/facets/core/proc/test_compose.rb +1 -1
- data/test/lib/facets/core/proc/test_op_mul.rb +1 -1
- data/test/lib/facets/core/proc/test_to_method.rb +1 -1
- data/test/lib/facets/core/range/test_to_r.rb +1 -1
- data/test/lib/facets/core/range/test_to_range.rb +1 -1
- data/test/lib/facets/core/range/test_umbrella.rb +1 -1
- data/test/lib/facets/core/range/test_within.rb +1 -1
- data/test/lib/facets/core/regexp/test_arity.rb +1 -1
- data/test/lib/facets/core/regexp/test_to_re.rb +1 -1
- data/test/lib/facets/core/regexp/test_to_regexp.rb +1 -1
- data/test/lib/facets/core/string/self/test_interpolate.rb +1 -1
- data/test/lib/facets/core/string/self/test_patterns.rb +1 -1
- data/test/lib/facets/core/string/self/test_rand_letter.rb +1 -1
- data/test/lib/facets/core/string/test_align_center.rb +1 -1
- data/test/lib/facets/core/string/test_at_rand.rb +1 -1
- data/test/lib/facets/core/string/test_basename.rb +1 -1
- data/test/lib/facets/core/string/test_blank.rb +1 -1
- data/test/lib/facets/core/string/test_bracket.rb +1 -1
- data/test/lib/facets/core/string/test_camelcase.rb +1 -1
- data/test/lib/facets/core/string/test_camelize.rb +1 -1
- data/test/lib/facets/core/string/test_capitalized.rb +1 -1
- data/test/lib/facets/core/string/test_chars.rb +1 -1
- data/test/lib/facets/core/string/test_cmp.rb +1 -1
- data/test/lib/facets/core/string/test_demodulize.rb +1 -1
- data/test/lib/facets/core/string/test_divide.rb +1 -1
- data/test/lib/facets/core/string/test_downcase.rb +1 -1
- data/test/lib/facets/core/string/test_dresner.rb +1 -1
- data/test/lib/facets/core/string/test_each_char.rb +1 -1
- data/test/lib/facets/core/string/test_each_word.rb +1 -1
- data/test/lib/facets/core/string/test_first.rb +1 -1
- data/test/lib/facets/core/string/test_fold.rb +1 -1
- data/test/lib/facets/core/string/test_humanize.rb +1 -1
- data/test/lib/facets/core/string/test_indent.rb +1 -1
- data/test/lib/facets/core/string/test_index_all.rb +1 -1
- data/test/lib/facets/core/string/test_last.rb +1 -1
- data/test/lib/facets/core/string/test_line_wrap.rb +1 -1
- data/test/lib/facets/core/string/test_lines.rb +1 -1
- data/test/lib/facets/core/string/test_lowercase.rb +1 -1
- data/test/lib/facets/core/string/test_margin.rb +1 -1
- data/test/lib/facets/core/string/test_methodize.rb +1 -1
- data/test/lib/facets/core/string/test_modulize.rb +1 -1
- data/test/lib/facets/core/string/test_mscan.rb +1 -1
- data/test/lib/facets/core/string/test_natcmp.rb +1 -1
- data/test/lib/facets/core/string/test_nchar.rb +1 -1
- data/test/lib/facets/core/string/test_pathize.rb +1 -1
- data/test/lib/facets/core/string/test_pop.rb +1 -1
- data/test/lib/facets/core/string/test_pot.rb +1 -1
- data/test/lib/facets/core/string/test_push.rb +1 -1
- data/test/lib/facets/core/string/test_quote.rb +1 -1
- data/test/lib/facets/core/string/test_rand_byte.rb +1 -1
- data/test/lib/facets/core/string/test_rand_index.rb +1 -1
- data/test/lib/facets/core/string/test_range.rb +1 -1
- data/test/lib/facets/core/string/test_range_all.rb +1 -1
- data/test/lib/facets/core/string/test_range_of_line.rb +1 -1
- data/test/lib/facets/core/string/test_regesc.rb +1 -1
- data/test/lib/facets/core/string/test_shatter.rb +1 -1
- data/test/lib/facets/core/string/test_shift.rb +1 -1
- data/test/lib/facets/core/string/test_shuffle.rb +1 -1
- data/test/lib/facets/core/string/test_similarity.rb +1 -1
- data/test/lib/facets/core/string/test_singular.rb +1 -1
- data/test/lib/facets/core/string/test_soundex.rb +1 -1
- data/test/lib/facets/core/string/test_succ.rb +1 -1
- data/test/lib/facets/core/string/test_to_a.rb +1 -1
- data/test/lib/facets/core/string/test_to_b.rb +1 -1
- data/test/lib/facets/core/string/test_to_const.rb +1 -1
- data/test/lib/facets/core/string/test_to_date.rb +1 -1
- data/test/lib/facets/core/string/test_to_proc.rb +1 -1
- data/test/lib/facets/core/string/test_to_re.rb +1 -1
- data/test/lib/facets/core/string/test_to_time.rb +1 -1
- data/test/lib/facets/core/string/test_unix_crypt.rb +1 -1
- data/test/lib/facets/core/string/test_unpack.rb +1 -1
- data/test/lib/facets/core/string/test_unshift.rb +1 -1
- data/test/lib/facets/core/string/test_upcase.rb +1 -1
- data/test/lib/facets/core/string/test_whitespace.rb +1 -1
- data/test/lib/facets/core/string/test_word_filter.rb +1 -1
- data/test/lib/facets/core/string/test_word_wrap.rb +1 -1
- data/test/lib/facets/core/string/test_words.rb +1 -1
- data/test/lib/facets/core/symbol/test_camelcase.rb +1 -1
- data/test/lib/facets/core/symbol/test_camelize.rb +1 -1
- data/test/lib/facets/core/symbol/test_capitalize.rb +1 -1
- data/test/lib/facets/core/symbol/test_capitalized.rb +1 -1
- data/test/lib/facets/core/symbol/test_downcase.rb +1 -1
- data/test/lib/facets/core/symbol/test_not.rb +1 -1
- data/test/lib/facets/core/symbol/test_pad.rb +1 -1
- data/test/lib/facets/core/symbol/test_succ.rb +1 -1
- data/test/lib/facets/core/symbol/test_to_const.rb +1 -1
- data/test/lib/facets/core/symbol/test_to_proc.rb +1 -1
- data/test/lib/facets/core/symbol/test_to_str.rb +1 -1
- data/test/lib/facets/core/symbol/test_underscore.rb +1 -1
- data/test/lib/facets/core/symbol/test_upcase.rb +1 -1
- data/test/lib/facets/core/time/test_change.rb +1 -1
- data/test/lib/facets/core/time/test_elapse.rb +1 -1
- data/test/lib/facets/core/time/test_stamp.rb +1 -1
- data/test/lib/facets/core/time/test_to_date.rb +1 -1
- data/test/lib/facets/core/time/test_to_s.rb +1 -1
- data/test/lib/facets/core/time/test_to_time.rb +1 -1
- data/test/lib/facets/more/test_annattr.rb +1 -1
- data/test/lib/facets/more/test_annotation.rb +11 -1
- data/test/lib/facets/more/test_ansicode.rb +1 -1
- data/test/lib/facets/more/test_association.rb +1 -1
- data/test/lib/facets/more/test_autoarray.rb +1 -1
- data/test/lib/facets/more/test_basicobject.rb +1 -1
- data/test/lib/facets/more/test_bbcode.rb +1 -1
- data/test/lib/facets/more/test_binaryreader.rb +1 -1
- data/test/lib/facets/more/test_bitmask.rb +1 -1
- data/test/lib/facets/more/test_bytes.rb +1 -1
- data/test/lib/facets/more/test_classmethods.rb +1 -1
- data/test/lib/facets/more/test_command.rb +1 -1
- data/test/lib/facets/more/test_coroutine.rb +1 -1
- data/test/lib/facets/more/test_crypt.rb +1 -1
- data/test/lib/facets/more/test_cut.rb +1 -1
- data/test/lib/facets/more/test_dictionary.rb +1 -1
- data/test/lib/facets/more/test_elementor.rb +1 -1
- data/test/lib/facets/more/test_enumerablepass.rb +1 -1
- data/test/lib/facets/more/test_floatstring.rb +1 -1
- data/test/lib/facets/more/test_functor.rb +1 -1
- data/test/lib/facets/more/test_htmlbuilder.rb +1 -1
- data/test/lib/facets/more/test_infinity.rb +1 -1
- data/test/lib/facets/more/test_inheritor.rb +1 -1
- data/test/lib/facets/more/test_instance_intercept.rb +1 -1
- data/test/lib/facets/more/test_interval.rb +1 -1
- data/test/lib/facets/more/test_json.rb +1 -1
- data/test/lib/facets/more/test_linkedlist.rb +53 -0
- data/test/lib/facets/more/test_lisp.rb +1 -1
- data/test/lib/facets/more/test_lisp_format.rb +1 -1
- data/test/lib/facets/more/test_lrucache.rb +1 -1
- data/test/lib/facets/more/test_mathconstants.rb +1 -1
- data/test/lib/facets/more/test_methodfilter.rb +1 -1
- data/test/lib/facets/more/test_methodprobe.rb +1 -1
- data/test/lib/facets/more/test_multipliers.rb +1 -1
- data/test/lib/facets/more/test_multiton.rb +1 -1
- data/test/lib/facets/more/test_nackclass.rb +1 -1
- data/test/lib/facets/more/test_nilcomparable.rb +1 -1
- data/test/lib/facets/more/test_opencascade.rb +1 -1
- data/test/lib/facets/more/test_openobject.rb +1 -1
- data/test/lib/facets/more/test_overload.rb +1 -1
- data/test/lib/facets/more/test_paramix.rb +1 -1
- data/test/lib/facets/more/test_pqueue.rb +1 -1
- data/test/lib/facets/more/test_predicate.rb +1 -1
- data/test/lib/facets/more/test_preinitialize.rb +1 -1
- data/test/lib/facets/more/test_promoteself.rb +1 -1
- data/test/lib/facets/more/test_recorder.rb +1 -1
- data/test/lib/facets/more/test_snapshot.rb +1 -1
- data/test/lib/facets/more/test_statichash.rb +1 -1
- data/test/lib/facets/more/test_syncarray.rb +1 -1
- data/test/lib/facets/more/test_synchash.rb +1 -1
- data/test/lib/facets/more/test_tagiterator.rb +1 -1
- data/test/lib/facets/more/test_taskable.rb +1 -1
- data/test/lib/facets/more/test_timer.rb +1 -1
- data/test/lib/facets/more/test_times.rb +1 -1
- data/test/lib/facets/more/test_tuple.rb +1 -1
- data/test/lib/facets/more/test_typecast.rb +1 -1
- data/test/lib/facets/more/test_uninheritable.rb +1 -1
- data/test/lib/facets/more/test_units.rb +1 -1
- data/test/lib/facets/more/test_xmlbuilder.rb +1 -1
- data/test/lib/facets/more/test_xmlhelper.rb +1 -1
- data/test/lib/facets/more/test_xoxo.rb +1 -1
- data/test/lib/facets/more/test_yamlstruct.rb +1 -1
- data/util/package +1 -1
- metadata +17 -5
- data/lib/facet/enumerable/permute.rb +0 -1
data/README
CHANGED
@@ -6,12 +6,23 @@
|
|
6
6
|
|
7
7
|
== Introduction
|
8
8
|
|
9
|
-
Ruby Facets is
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
9
|
+
Ruby Facets is a collection of general purpose, pure-Ruby extensions and additions
|
10
|
+
for the Ruby programming language. Facets is divided into two libraries, one for the
|
11
|
+
extensions and the other for the additions. called Facets/CORE and Facets/MORE, respectively.
|
12
|
+
|
13
|
+
Facets/CORE is a large collection of methods which extend the core capabilities of Ruby's
|
14
|
+
built-in classes and modules. This collection of extension methods are unique by virtue of
|
15
|
+
their atomicity. The methods are stored individually so that each can be required independently.
|
16
|
+
This gives developers fine-grain control over which extra methods to bring into his or her code.
|
17
|
+
The collection currently contains over 400 methods spanning 28 classes and modules. It is an
|
18
|
+
_atomic_ library in that the methods are packaged individually so that each can be _required_
|
19
|
+
independently. This gives the programmer greater control to include only the extra methods he
|
20
|
+
or she actually needs.
|
21
|
+
|
22
|
+
Facets/MORE are a collection of classes, modules and light frameworks whcih consitutes an ever
|
23
|
+
growing and improving source of reusable components. Some very nice additions are provided,
|
24
|
+
from an amazing SI Units system to an elegant Annotations system. And of course there are all
|
25
|
+
the more typical goodies like Tuple, Functor and Multiton.
|
15
26
|
|
16
27
|
|
17
28
|
== License
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.7.
|
1
|
+
1.7.46 (2006-09-08)
|
data/doc/CHANGELOG
CHANGED
@@ -1,3 +1,11 @@
|
|
1
|
+
* [deprecate] enumerable/permute.rb (replaced by permutation) and minor test fix to linkedlist.rb
|
2
|
+
* [added] linkedlist.rb (thanks Kirk Haines!)
|
3
|
+
* [added] enumerable/sum (thanks to Gavin Kistner)
|
4
|
+
* [added] array/each_combo and combos (Eunumerable.combinations will be deprecated eventually)
|
5
|
+
* [rename] changed enumerable/permute to permutation
|
6
|
+
* [update] annotation.rb, fixed :self key
|
7
|
+
* [added] pathname/op_div
|
8
|
+
* [deprecated] hash/each.rb
|
1
9
|
* [removed] hash/each.rb, this variation of Hash#each is too "dangerous" in practice
|
2
10
|
* [update] module/self/op_add.rb: fixed inclusion order
|
3
11
|
* annotation.rb, return annotations of self when key is :self [updated]
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'facets/core/array/combos.rb'
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'facets/core/array/each_combo.rb'
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'facets/core/enumerable/permutation.rb'
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'facets/core/enumerable/sum.rb'
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'facets/more/linkedlist.rb'
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'facets/core/pathname/op_div.rb'
|
@@ -0,0 +1,48 @@
|
|
1
|
+
|
2
|
+
class Array
|
3
|
+
|
4
|
+
# The array is expected to be and array of arrays, which
|
5
|
+
# iterates through combinations of each in position.
|
6
|
+
#
|
7
|
+
# a = [ [0,1], [2,3] ]
|
8
|
+
# a.each_combo { |c| p c }
|
9
|
+
#
|
10
|
+
# produces
|
11
|
+
#
|
12
|
+
# [0, 2]
|
13
|
+
# [0, 3]
|
14
|
+
# [1, 2]
|
15
|
+
# [1, 3]
|
16
|
+
#
|
17
|
+
|
18
|
+
def each_combo
|
19
|
+
a = collect{ |x|
|
20
|
+
x.respond_to?(:to_a) ? x.to_a : 0..x
|
21
|
+
}
|
22
|
+
|
23
|
+
if a.size == 1
|
24
|
+
r = a.shift
|
25
|
+
r.each{ |n|
|
26
|
+
yield n
|
27
|
+
}
|
28
|
+
else
|
29
|
+
r = a.shift
|
30
|
+
r.each{ |n|
|
31
|
+
a.each_combo{ |s|
|
32
|
+
yield [n, *s]
|
33
|
+
}
|
34
|
+
}
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
|
39
|
+
# As with each_combo but returns combos collected in an array.
|
40
|
+
|
41
|
+
def combos
|
42
|
+
a = []
|
43
|
+
each_combo{ |c| a << c }
|
44
|
+
a
|
45
|
+
end
|
46
|
+
|
47
|
+
end
|
48
|
+
|
@@ -3,7 +3,11 @@ require 'facet/integer/factorial'
|
|
3
3
|
|
4
4
|
module Enumerable
|
5
5
|
|
6
|
-
|
6
|
+
# Permutation proves the possible orders of an enumerable.
|
7
|
+
# Each is index by a oermutation numnber. The maximum number of
|
8
|
+
# arrangements is the factorial of the size of the array.
|
9
|
+
|
10
|
+
def permutation(number)
|
7
11
|
arr = to_a
|
8
12
|
out = arr[0..0]
|
9
13
|
nextfactor = factor = 1
|
@@ -18,6 +22,9 @@ module Enumerable
|
|
18
22
|
}
|
19
23
|
out
|
20
24
|
end
|
25
|
+
alias :permute :permutation
|
26
|
+
|
27
|
+
#
|
21
28
|
|
22
29
|
def permutation_number(original_array=self.to_a.sort)
|
23
30
|
arr = to_a
|
@@ -2,7 +2,9 @@
|
|
2
2
|
module Enumerable
|
3
3
|
|
4
4
|
# Produces an array of arrays of all possible combinations
|
5
|
-
# of the given arrays in the
|
5
|
+
# of the given arrays in the positions given. (Imagine
|
6
|
+
# it like a slot machine dial. This gives evey combination
|
7
|
+
# that could come up.)
|
6
8
|
#
|
7
9
|
# a = %w|a b|
|
8
10
|
# b = %w|a x|
|
@@ -42,12 +44,19 @@ end
|
|
42
44
|
|
43
45
|
class TCEnumerable < Test::Unit::TestCase
|
44
46
|
|
45
|
-
def
|
47
|
+
def test_01
|
46
48
|
a = [1,2]
|
47
49
|
b = [3,4]
|
48
|
-
|
49
|
-
|
50
|
+
z = Enumerable.combinations(a,b)
|
51
|
+
r = [[1,3],[1,4],[2,3],[2,4]]
|
52
|
+
assert_equal( r, z )
|
53
|
+
end
|
50
54
|
|
55
|
+
def test_02
|
56
|
+
a = %w|a b|
|
57
|
+
b = %w|a x|
|
58
|
+
c = %w|x y|
|
59
|
+
z = Enumerable.combinations(a, b, c)
|
51
60
|
r = [ ["a", "a", "x"],
|
52
61
|
["a", "a", "y"],
|
53
62
|
["a", "x", "x"],
|
@@ -56,10 +65,6 @@ end
|
|
56
65
|
["b", "a", "y"],
|
57
66
|
["b", "x", "x"],
|
58
67
|
["b", "x", "y"] ]
|
59
|
-
a = %w|a b|
|
60
|
-
b = %w|a x|
|
61
|
-
c = %w|x y|
|
62
|
-
z = Enumerable.combinations(a, b, c)
|
63
68
|
assert_equal( r, z )
|
64
69
|
end
|
65
70
|
|
@@ -469,6 +469,15 @@ end
|
|
469
469
|
end
|
470
470
|
end
|
471
471
|
|
472
|
+
class TestAnnotation10 < Test::Unit::TestCase
|
473
|
+
class C
|
474
|
+
ann :self, :mod => 'YES'
|
475
|
+
end
|
476
|
+
def test_10_01
|
477
|
+
assert_equal( 'YES', C.ann.self.mod )
|
478
|
+
end
|
479
|
+
end
|
480
|
+
|
472
481
|
# class TestAnnotation10 < Test::Unit::TestCase
|
473
482
|
# module M
|
474
483
|
# ann :this, :koko => []
|
@@ -539,4 +548,5 @@ end
|
|
539
548
|
# end
|
540
549
|
# end
|
541
550
|
|
551
|
+
|
542
552
|
=end
|
@@ -0,0 +1,254 @@
|
|
1
|
+
# = linkedlist.rb
|
2
|
+
#
|
3
|
+
# == Copyright (C) 2006 Kirk Haines
|
4
|
+
#
|
5
|
+
# General Public License (GPL)
|
6
|
+
#
|
7
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
8
|
+
# a copy of this software and associated documentation files (the
|
9
|
+
# "Software"), to deal in the Software without restriction, including
|
10
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
11
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
12
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
13
|
+
# the following conditions:
|
14
|
+
#
|
15
|
+
# The above copyright notice and this permission notice shall be
|
16
|
+
# included in all copies or substantial portions of the Software.
|
17
|
+
#
|
18
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
19
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
20
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
21
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
22
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
23
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
24
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
25
|
+
#
|
26
|
+
# == Special Thanks
|
27
|
+
#
|
28
|
+
# LinkedList came from Kirk Hanes IOWA web framework.
|
29
|
+
#
|
30
|
+
# == Authors and Contributors
|
31
|
+
#
|
32
|
+
# * Kirk Haines <khaines@enigo.com>.
|
33
|
+
#
|
34
|
+
# == Developer Notes
|
35
|
+
#
|
36
|
+
# TODO Create an example of usage for docs.
|
37
|
+
#
|
38
|
+
|
39
|
+
# Author:: Jim Weirich
|
40
|
+
# Copyright:: Copyright (c) 2006 Kirk Haines
|
41
|
+
# License:: General Public License (GPL)
|
42
|
+
|
43
|
+
require 'enumerator'
|
44
|
+
|
45
|
+
# == LinkedList
|
46
|
+
#
|
47
|
+
# LinkedList implements a simple doubly linked list with efficient
|
48
|
+
# hash-like element access.
|
49
|
+
#
|
50
|
+
# This is a simple linked list implementation with efficient random
|
51
|
+
# access of data elements. It was inspired by George Moscovitis'
|
52
|
+
# LRUCache implementation found in Facets 1.7.30, but unlike the
|
53
|
+
# linked list in that cache, this one does not require the use of a
|
54
|
+
# mixin on any class to be stored. The linked list provides the
|
55
|
+
# push, pop, shift, unshift, first, last, delete and length methods
|
56
|
+
# which work just like their namesakes in the Array class, but it
|
57
|
+
# also supports setting and retrieving values by key, just like a
|
58
|
+
# hash.
|
59
|
+
|
60
|
+
class LinkedList
|
61
|
+
|
62
|
+
include Enumerable
|
63
|
+
|
64
|
+
# Represents a single node of the linked list.
|
65
|
+
|
66
|
+
class Node
|
67
|
+
attr_accessor :key, :value, :prev_node, :next_node
|
68
|
+
|
69
|
+
def initialize(key=nil,value=nil,prev_node=nil,next_node=nil)
|
70
|
+
@key = key
|
71
|
+
@value = value
|
72
|
+
@prev_node = prev_node
|
73
|
+
@next_node = next_node
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
def initialize
|
78
|
+
@head = Node.new
|
79
|
+
@tail = Node.new
|
80
|
+
@lookup = Hash.new
|
81
|
+
node_join(@head,@tail)
|
82
|
+
end
|
83
|
+
|
84
|
+
def [](v)
|
85
|
+
@lookup[v].value
|
86
|
+
end
|
87
|
+
|
88
|
+
def []=(k,v)
|
89
|
+
if @lookup.has_key?(k)
|
90
|
+
@lookup[k].value = v
|
91
|
+
else
|
92
|
+
n = Node.new(k,v,@head,@head.next_node)
|
93
|
+
node_join(n,@head.next_node)
|
94
|
+
node_join(@head,n)
|
95
|
+
@lookup[k] = n
|
96
|
+
end
|
97
|
+
v
|
98
|
+
end
|
99
|
+
|
100
|
+
def empty?
|
101
|
+
@lookup.empty?
|
102
|
+
end
|
103
|
+
|
104
|
+
def delete(k)
|
105
|
+
n = @lookup.delete(k)
|
106
|
+
v = n ? node_purge(n) : nil
|
107
|
+
v
|
108
|
+
end
|
109
|
+
|
110
|
+
def first
|
111
|
+
@head.next_node.value
|
112
|
+
end
|
113
|
+
|
114
|
+
def last
|
115
|
+
@tail.prev_node.value
|
116
|
+
end
|
117
|
+
|
118
|
+
def shift
|
119
|
+
k = @head.next_node.key
|
120
|
+
n = @lookup.delete(k)
|
121
|
+
node_delete(n) if n
|
122
|
+
end
|
123
|
+
|
124
|
+
def unshift(v)
|
125
|
+
if @lookup.has_key?(v)
|
126
|
+
n = @lookup[v]
|
127
|
+
node_delete(n)
|
128
|
+
node_join(n,@head.next_node)
|
129
|
+
node_join(@head,n)
|
130
|
+
else
|
131
|
+
n = Node.new(v,v,@head,@head.next_node)
|
132
|
+
node_join(n,@head.next_node)
|
133
|
+
node_join(@head,n)
|
134
|
+
@lookup[v] = n
|
135
|
+
end
|
136
|
+
v
|
137
|
+
end
|
138
|
+
|
139
|
+
def pop
|
140
|
+
k = @tail.prev_node.key
|
141
|
+
n = @lookup.delete(k)
|
142
|
+
node_delete(n) if n
|
143
|
+
end
|
144
|
+
|
145
|
+
def push(v)
|
146
|
+
if @lookup.has_key?(v)
|
147
|
+
n = @lookup[v]
|
148
|
+
node_delete(n)
|
149
|
+
node_join(@tail.prev_node,n)
|
150
|
+
node_join(n,@tail)
|
151
|
+
else
|
152
|
+
n = Node.new(v,v,@tail.prev_node,@tail)
|
153
|
+
node_join(@tail.prev_node,n)
|
154
|
+
node_join(n,@tail)
|
155
|
+
@lookup[v] = n
|
156
|
+
end
|
157
|
+
v
|
158
|
+
end
|
159
|
+
|
160
|
+
def queue
|
161
|
+
r = []
|
162
|
+
n = @head
|
163
|
+
while (n = n.next_node) and n != @tail
|
164
|
+
r << n.key
|
165
|
+
end
|
166
|
+
r
|
167
|
+
end
|
168
|
+
|
169
|
+
def to_a
|
170
|
+
r = []
|
171
|
+
n = @head
|
172
|
+
while (n = n.next_node) and n != @tail
|
173
|
+
r << n.value
|
174
|
+
end
|
175
|
+
r
|
176
|
+
end
|
177
|
+
|
178
|
+
def length
|
179
|
+
@lookup.length
|
180
|
+
end
|
181
|
+
|
182
|
+
def each
|
183
|
+
n = @head
|
184
|
+
while (n = n.next_node) and n != @tail
|
185
|
+
yield(n.key,n.value)
|
186
|
+
end
|
187
|
+
end
|
188
|
+
|
189
|
+
private
|
190
|
+
|
191
|
+
def node_delete(n)
|
192
|
+
node_join(n.prev_node,n.next_node)
|
193
|
+
v = n.value
|
194
|
+
end
|
195
|
+
|
196
|
+
def node_purge(n)
|
197
|
+
node_join(n.prev_node,n.next_node)
|
198
|
+
v = n.value
|
199
|
+
n.value = nil
|
200
|
+
n.key = nil
|
201
|
+
n.next_node = nil
|
202
|
+
n.prev_node = nil
|
203
|
+
v
|
204
|
+
end
|
205
|
+
|
206
|
+
def node_join(a,b)
|
207
|
+
a.next_node = b
|
208
|
+
b.prev_node = a
|
209
|
+
end
|
210
|
+
|
211
|
+
end
|
212
|
+
|
213
|
+
|
214
|
+
|
215
|
+
=begin test
|
216
|
+
|
217
|
+
require 'test/unit'
|
218
|
+
|
219
|
+
class TC_LinkedList < Test::Unit::TestCase
|
220
|
+
|
221
|
+
@cache
|
222
|
+
|
223
|
+
def test_all
|
224
|
+
ll = nil
|
225
|
+
assert_nothing_raised('Failed while creating an LinkedList object.') { ll = LinkedList.new }
|
226
|
+
assert_kind_of(LinkedList,ll,'Strangely, the created object does not appear to be an LinkedList.')
|
227
|
+
|
228
|
+
assert_nothing_raised('Failed while pushing a value onto the linked list.') { ll.push 'a' }
|
229
|
+
ll.push 'b'
|
230
|
+
assert_nothing_raised('Failed while assigning a key/value to the linked list.') { ll['c'] = 3 }
|
231
|
+
assert_equal(3,ll.first, 'First element in the linked list appears to be the wrong one.')
|
232
|
+
assert_equal('b',ll.last, 'Last element in the linked list appears to be the wrong one.')
|
233
|
+
assert_nothing_raised('Failed while unshifting a value onto the linked list.') { ll.unshift 'd' }
|
234
|
+
assert_equal('d',ll.first, 'The prior unshift apparently failed.')
|
235
|
+
assert_equal('a',ll['a'], 'Accessing an element by key failed.')
|
236
|
+
assert_equal(4,ll.length, 'The length of the linked list appears to be incorrect.')
|
237
|
+
d = nil
|
238
|
+
assert_nothing_raised('Failed while deleting an element from the middle of the list.') { d = ll.delete('a') }
|
239
|
+
assert_equal('a',d, 'The prior delete returned the wrong value for the deleted object.')
|
240
|
+
assert_equal(3,ll.length, 'The length of the linked list appears to be incorrect following the prior deletion.')
|
241
|
+
assert_nothing_raised('Failed while popping an element from the end of the list.') { d = ll.pop }
|
242
|
+
assert_equal('b',d, 'The prior pop returned the wrong value.')
|
243
|
+
assert_equal(2,ll.length, 'The length of the linked list appears to be incorrect following the prior pop.')
|
244
|
+
assert_equal(['d','c'],ll.queue, 'The queue of keys for the list is incorrect.')
|
245
|
+
assert_equal(['d',3],ll.to_a, 'Converting the list to an array (of values) seems to have failed.')
|
246
|
+
expected = [['c',3],['d','d']]
|
247
|
+
ll.each do |k,v|
|
248
|
+
e = expected.pop
|
249
|
+
assert_equal(e,[k,v], 'While iterates over the list via each(), the value from this iteration is not what was expected.')
|
250
|
+
end
|
251
|
+
end
|
252
|
+
end
|
253
|
+
|
254
|
+
=end
|