facets 1.7.0 → 1.7.30
Sign up to get free protection for your applications and to get access to all the features.
- data/{meta/projectinfo → PROJECT} +1 -3
- data/README +114 -47
- data/VERSION +1 -0
- data/doc/{ChangeLog → CHANGELOG} +30 -0
- data/doc/{ChangeLog.pre1.5 → CHANGELOG.1} +0 -0
- data/{COPYING → doc/COPYING} +0 -0
- data/lib/facet/cache.rb +1 -0
- data/lib/facet/doublemetaphone.rb +1 -0
- data/lib/facet/enumerable/eachn.rb +1 -0
- data/lib/facet/file/self/null.rb +1 -0
- data/lib/facet/filesystem.rb +1 -0
- data/lib/facet/filetest/self/root.rb +1 -0
- data/lib/facet/hash/delete_at.rb +1 -0
- data/lib/facet/hash/delete_values.rb +1 -0
- data/lib/facet/hash/delete_values_at.rb +1 -0
- data/lib/facet/kernel/load_local.rb +1 -0
- data/lib/facet/main_as_module.rb +1 -0
- data/lib/facet/nilclass/to_path.rb +1 -0
- data/lib/facet/symbol/to_s.rb +1 -0
- data/lib/facets.rb +1 -0
- data/lib/facets/core/array/delete_values_at.rb +2 -0
- data/lib/facets/core/array/op_fetch.rb +27 -0
- data/lib/facets/core/array/op_store.rb +2 -47
- data/lib/facets/core/enumerable/each_by.rb +91 -2
- data/lib/facets/core/enumerable/eachn.rb +41 -0
- data/lib/facets/core/file/self/null.rb +17 -0
- data/lib/facets/core/filetest/self/root.rb +13 -0
- data/lib/facets/core/hash/delete_at.rb +10 -0
- data/lib/facets/core/hash/delete_values.rb +20 -0
- data/lib/facets/core/hash/delete_values_at.rb +24 -0
- data/lib/facets/core/hash/each.rb +26 -11
- data/lib/facets/core/kernel/load_local.rb +26 -0
- data/lib/facets/core/nilclass/to_path.rb +18 -0
- data/lib/facets/core/symbol/to_s.rb +10 -0
- data/lib/facets/more/association.rb +1 -1
- data/lib/facets/more/cache.rb +81 -0
- data/lib/facets/more/command.rb +11 -1
- data/lib/facets/more/doublemetaphone.rb +371 -0
- data/lib/facets/more/filesystem.rb +43 -0
- data/lib/facets/more/main_as_module.rb +42 -0
- data/lib/facets/more/taskable.rb +89 -212
- data/setup.rb +204 -181
- 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 +9 -1
- data/test/lib/facets/core/array/test_op_store.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 +1 -1
- 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 +71 -0
- 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_unique_pair.rb +1 -1
- data/test/lib/facets/core/enumerable/test_eachn.rb +34 -0
- 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_permute.rb +1 -1
- 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.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/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 +1 -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_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 +28 -7
- 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/announce +20 -0
- data/util/changelog +8 -0
- data/util/count +8 -0
- data/util/extest +8 -0
- data/util/list +38 -0
- data/util/package +9 -0
- data/util/prepare +12 -0
- data/util/redirect +34 -0
- data/util/release +13 -0
- data/util/setup +7 -0
- data/util/test +7 -0
- data/util/version +8 -0
- metadata +1514 -1491
- data/doc/CAUTION +0 -55
- data/doc/IMPORTANT +0 -8
- data/doc/LATEST +0 -41
- data/doc/history/ANN-0.6.0 +0 -40
- data/doc/history/ANN-0.6.1 +0 -36
- data/doc/history/ANN-0.6.3 +0 -43
- data/doc/history/ANN-0.7.0 +0 -59
- data/doc/history/ANN-0.8.1 +0 -127
- data/doc/history/INTRO +0 -172
- data/doc/history/README +0 -223
- data/doc/history/README-OLD +0 -180
- data/doc/manifest +0 -1209
- data/doc/scrap/Rakefile.old +0 -181
- data/lib/facet/enumerable/each_slice.rb +0 -1
- data/lib/facets/core/enumerable/each_slice.rb +0 -131
- data/meta/reapfile +0 -184
- data/meta/task +0 -74
- data/meta/tasks/calibre.rb +0 -16
- data/meta/version +0 -1
@@ -27,12 +27,10 @@ revision:
|
|
27
27
|
- doc/api # auto-generated
|
28
28
|
- test/lib # ''
|
29
29
|
- lib/facet # ''
|
30
|
-
- meta/version # should default
|
30
|
+
- meta/version # should exclude by default
|
31
31
|
- doc/ChangeLog # so should this
|
32
32
|
|
33
33
|
package:
|
34
34
|
exclude:
|
35
|
-
- doc/api
|
36
|
-
- doc/web
|
37
35
|
- work
|
38
36
|
|
data/README
CHANGED
@@ -1,29 +1,50 @@
|
|
1
1
|
|
2
2
|
= Ruby Facets
|
3
3
|
|
4
|
-
"ALL BASE
|
4
|
+
"ALL YOUR BASE ARE BELONG TO US"
|
5
5
|
|
6
6
|
|
7
7
|
== Introduction
|
8
8
|
|
9
|
-
Ruby Facets
|
9
|
+
Ruby Facets is the a collection of general purpose, pure-Ruby extensions and additions for the Ruby programming language. Facets is divided into two libraries, one for the extensions and the other for the additions. called Facets/CORE and Facets/MORE, respectively.
|
10
10
|
|
11
|
-
Facets is
|
11
|
+
Facets/CORE is a large collection of methods which extend the core capabilities of Ruby's built-in classes and modules. This collection of extension methods are unique by virtue of their atomicity. The methods are stored individually so that each can be required independently. This gives developers fine-grain control over which extra methods to bring into his or her code. The collection currently contains over 400 methods spanning 28 classes and modules. It is an _atomic_ library in that the methods are packaged individually so that each can be _required_ independently. This gives the programmer greater
|
12
|
+
control to include only the extra methods he or she actually needs.
|
12
13
|
|
13
|
-
Facets/
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
14
|
+
Facets/MORE are a collection of classes, modules and light frameworks whcih consitutes an ever growing and improving source of reusable components. Some very nice additions are provided, from an amazing SI Units system to an elegant Annotations system. And of course there are all the more typical goodies like Tuple, Functor and Multiton.
|
15
|
+
|
16
|
+
|
17
|
+
== License
|
18
|
+
|
19
|
+
The collection PER COLLECTION is licensed as follows:
|
20
|
+
|
21
|
+
Ruby Facets
|
22
|
+
Copyright (c) 2004-2006 Thomas Sawyer
|
23
|
+
|
24
|
+
Distributed under the terms of the Ruby lincense.
|
25
|
+
|
26
|
+
The Ruby license is a dual license that also provides for use of the GPL.
|
27
|
+
Complete texts of both licenses accompany this document (see doc/COPYING).
|
28
|
+
|
29
|
+
This program is free software; you can redistribute it and/or modify
|
30
|
+
it under the terms of the GNU General Public License as published by
|
31
|
+
the Free Software Foundation; either version 2 of the License, or
|
32
|
+
(at your option) any later version.
|
33
|
+
|
34
|
+
This program is distributed in the hope that it will be useful,
|
35
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
36
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
37
|
+
GNU General Public License for more details.
|
38
|
+
|
39
|
+
You should have received a copy of the GNU General Public License
|
40
|
+
along with this program; if not, write to the Free Software
|
41
|
+
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
42
|
+
|
43
|
+
Acknowledgments and Copyrights for particular snippets of borrowed code
|
44
|
+
are given in their respective source. All licenses are either compatible
|
45
|
+
with the Ruby license (namely the GPL) or the original author has given
|
46
|
+
permission for inclusion of their code under such lincense.</p>
|
20
47
|
|
21
|
-
Facets/MORE is a collection of additioanl classes, modules and microframeworks.
|
22
|
-
The class, module and microframework additions consitute an ever growing
|
23
|
-
and improving source of reusable components. Some very nice additions
|
24
|
-
are available, from an amazing Units system to an elegant
|
25
|
-
annotations systems. And of course there are all the more typical goodies
|
26
|
-
like Tuple, Functor and Multiton.
|
27
48
|
|
28
49
|
== Mission
|
29
50
|
|
@@ -60,14 +81,29 @@ setup.rb script. For example:
|
|
60
81
|
== Usage
|
61
82
|
|
62
83
|
For detailed usage of any given method or module please refer to the
|
63
|
-
API RDocs. Most are well documented.
|
84
|
+
API RDocs. Most are well documented. Assistance in improving
|
85
|
+
documentation though is always appreciated.
|
86
|
+
|
87
|
+
The general require statement for an atomic facet extension is as follows:
|
88
|
+
|
89
|
+
require 'facet/<class|module>/<method-name>'
|
64
90
|
|
65
|
-
|
91
|
+
For example:
|
66
92
|
|
67
93
|
require 'facet/time/stamp'
|
68
94
|
|
69
|
-
|
70
|
-
|
95
|
+
Teh path is alwasy lower. The name may differ a bit from the actual
|
96
|
+
method being required. For instance, if the name ends in ?, !, or = the
|
97
|
+
character is simply removed. For method names that are non-alphanumeric
|
98
|
+
althogether, a name is chosen according to the chracters and
|
99
|
+
prefixed with 'op_' for "operator" (see chart below).
|
100
|
+
|
101
|
+
Most "atoms" contain but a single method, but excpetions occur when methods
|
102
|
+
are very tightly related. In these case "stubs" are used to have one required
|
103
|
+
method require the group.
|
104
|
+
|
105
|
+
The use of "facet/" namespace techinally uses a redirection file to file in
|
106
|
+
facets/core. Redirection can be bypassed however:
|
71
107
|
|
72
108
|
require 'facets/core/time/stamp'
|
73
109
|
|
@@ -79,7 +115,7 @@ requiring any of them you first require the main facility.
|
|
79
115
|
|
80
116
|
require 'facets'
|
81
117
|
|
82
|
-
This loads a set of facets considered "
|
118
|
+
This loads a set of facets considered "BASE" --currently a couple dozen
|
83
119
|
very basic methods, and adds the facets library directories to the end
|
84
120
|
of Ruby's load path. This allows you to require facets without even using
|
85
121
|
the 'facet/...' prefix. Eg.
|
@@ -122,10 +158,60 @@ prefixless shorcut to require it.
|
|
122
158
|
|
123
159
|
For details pertaining to the functionality of each feature, please see the API Docs.
|
124
160
|
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
161
|
+
== Important Considerations for certain Facets
|
162
|
+
|
163
|
+
Some caution should be taken when using certain facets.
|
164
|
+
What follows ois list of such facets and the reasons
|
165
|
+
these particular facets should given special consideration.
|
166
|
+
|
167
|
+
Some facets require other files to be loaded first
|
168
|
+
that are not loaded automatically, like fileutils
|
169
|
+
(i.e. they are part of the standard lib, not core).
|
170
|
+
The file include all of the following.
|
171
|
+
|
172
|
+
date/*
|
173
|
+
fileutils/*
|
174
|
+
ostruct/*
|
175
|
+
logger/*
|
176
|
+
gem/*
|
177
|
+
|
178
|
+
Others effect the system in slightly non-standard ways.
|
179
|
+
Though such changes are kept to a minumim and intended
|
180
|
+
to be backward compatible, there still may be edge cases
|
181
|
+
that could cause another library to misbehave.
|
182
|
+
The following is a list known facets that may have
|
183
|
+
this potential.
|
184
|
+
|
185
|
+
array/op_fetch.rb
|
186
|
+
array/op_store.rb
|
187
|
+
binding/self/of_caller.rb
|
188
|
+
hash/op_fetch.rb
|
189
|
+
hash/op_store.rb
|
190
|
+
numeric/succ.rb
|
191
|
+
numeric/pred.rb
|
192
|
+
string/succ.rb
|
193
|
+
string/unpack.rb
|
194
|
+
module/attr.rb
|
195
|
+
|
196
|
+
There are also some facets that are potentially unsafe b/c
|
197
|
+
they change Ruby's default behavior in a nonconvential
|
198
|
+
manner and hence are not designed to be backward compatible.
|
199
|
+
Using these with a pre-existent program may cause the program
|
200
|
+
to misbehave. So while they can be useful, be sure to
|
201
|
+
understand exactly what they do before putting them to
|
202
|
+
serious use.
|
203
|
+
|
204
|
+
hash/each.rb
|
205
|
+
module/methods.rb
|
206
|
+
object/method.rb
|
207
|
+
nilclass/op_fetch.rb
|
208
|
+
nilclass/empty.rb
|
209
|
+
nilclass/include.rb
|
210
|
+
nilclass/size.rb
|
211
|
+
nilclass/length.rb
|
212
|
+
nilclass/method_missing.rb
|
213
|
+
|
214
|
+
== Facets' Directory Layout
|
129
215
|
|
130
216
|
There are two subdirectories in Facets library, 'core', which stores
|
131
217
|
the method extensions and 'more' which store the modules, classes and
|
@@ -141,7 +227,7 @@ Class method are stored in the same manner but under a 'self' subdirectory.
|
|
141
227
|
|
142
228
|
'core/<class|module>/self/<method-name>'
|
143
229
|
|
144
|
-
|
230
|
+
== Method File Names
|
145
231
|
|
146
232
|
Operators are stored in the file system using english names. For instance for
|
147
233
|
Proc#* is 'proc/op_mul'.
|
@@ -182,7 +268,7 @@ simply removed.
|
|
182
268
|
|
183
269
|
This project thrives on contribution.
|
184
270
|
|
185
|
-
If you have any extension methods, classes, modules or
|
271
|
+
If you have any extension methods, classes, modules or small frameworks
|
186
272
|
that you think have general applicability and would like to see them
|
187
273
|
included in this project, don't hesitiate to submit. There's a very good
|
188
274
|
chance it will be included. Also, if you have better versions of any thing
|
@@ -218,27 +304,9 @@ If anyone is missing from the list, please let me know and
|
|
218
304
|
I will correct right away. Thanks.
|
219
305
|
|
220
306
|
|
221
|
-
== License
|
222
|
-
|
223
|
-
In so far as it matters, the collection PER COLLECTION is licensed
|
224
|
-
as follows:
|
225
|
-
|
226
|
-
Ruby Facets
|
227
|
-
Copyright (c) 2004-2006 Thomas Sawyer
|
228
|
-
Ruby License
|
229
|
-
|
230
|
-
The Ruby license is a dual license that also provides for use of the GPL.
|
231
|
-
A copy of both licenses accompany this document (see COPYING).
|
232
|
-
|
233
|
-
Credit and Copyrights for particular borrowed code segments are
|
234
|
-
given in their respective source. All licenses are either compatible
|
235
|
-
with the Ruby license (namely the GPL) or the original author has given
|
236
|
-
permission for inclusion of their code under such lincense.</p>
|
237
|
-
|
238
|
-
|
239
307
|
== Pitch
|
240
308
|
|
241
|
-
ALL YOUR BASE ARE BELONG TO RUBY
|
309
|
+
ALL YOUR BASE ARE BELONG TO RUBY!
|
242
310
|
|
243
311
|
|
244
312
|
----
|
@@ -252,7 +320,6 @@ permission for inclusion of their code under such lincense.</p>
|
|
252
320
|
Finally let's not forget even older "working" titles that were used
|
253
321
|
along the way: Raspberry, ABC, Succ and the very original Tomslib.
|
254
322
|
|
255
|
-
|
256
323
|
# Copyright (c)2006 Thomas Sawyer
|
257
324
|
# facets.rubyforge.com
|
258
325
|
# (ruby-lang.org) Do you Ruby?
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
1.7.30 beta (2006-08-23)
|
data/doc/{ChangeLog → CHANGELOG}
RENAMED
@@ -1,3 +1,33 @@
|
|
1
|
+
* moved File.bitbucket to File.null (but bitbucket was so "fun"! ;)
|
2
|
+
* added nilclass/to_path
|
3
|
+
* added kernel/load_local
|
4
|
+
* added kernel/callee
|
5
|
+
* added enumerable/eachn, integer/each and integer/of
|
6
|
+
* re-added array/delete_values_at
|
7
|
+
* added filetest/self/root
|
8
|
+
* added cache.rb
|
9
|
+
* moved Dir.bitbucket to File.bitbucket
|
10
|
+
* removed task file in favor of sake based util/
|
11
|
+
* added main_as_module
|
12
|
+
* added doublemetaphone (Thanks Lawrence Philps!)
|
13
|
+
* rewrote taskable.rb
|
14
|
+
* minor doc fix to association.rb
|
15
|
+
* added symbol/to_s which caches the result for speed up
|
16
|
+
* additions and adjusments related to hash/delete_at
|
17
|
+
* added Dir.bitbucket
|
18
|
+
* update to array/op_fetch to include op_store
|
19
|
+
* updated docs and util tasks
|
20
|
+
* ice
|
21
|
+
* minor changes
|
22
|
+
* added filesystem.rb
|
23
|
+
* taskable should now work at the toplevel too
|
24
|
+
* still working the organization as Reap/Sake change
|
25
|
+
* started setting project tasks up for sake
|
26
|
+
* updates to enumerable each_slice
|
27
|
+
* updated names of meta files
|
28
|
+
* updates to READMEs
|
29
|
+
* added trace to command.rb
|
30
|
+
* organizational changes
|
1
31
|
1.7
|
2
32
|
* fix to inifinty.rb
|
3
33
|
* comment on cut.rb needed a quick fix
|
File without changes
|
data/{COPYING → doc/COPYING}
RENAMED
File without changes
|
data/lib/facet/cache.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'facets/more/cache.rb'
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'facets/more/doublemetaphone.rb'
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'facets/core/enumerable/eachn.rb'
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'facets/core/file/self/null.rb'
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'facets/more/filesystem.rb'
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'facets/core/filetest/self/root.rb'
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'facets/core/hash/delete_at.rb'
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'facets/core/hash/delete_values.rb'
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'facets/core/hash/delete_values_at.rb'
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'facets/core/kernel/load_local.rb'
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'facets/more/main_as_module.rb'
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'facets/core/nilclass/to_path.rb'
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'facets/core/symbol/to_s.rb'
|
data/lib/facets.rb
CHANGED
@@ -68,6 +68,7 @@ require 'facets/core/kernel/constant'
|
|
68
68
|
require 'facets/core/kernel/__callee__' # better name?
|
69
69
|
require 'facets/core/kernel/__method__'
|
70
70
|
require 'facets/core/symbol/to_proc'
|
71
|
+
require 'facets/core/symbol/to_s'
|
71
72
|
|
72
73
|
# Elementary (Know Thyself)
|
73
74
|
require 'facets/core/hash/to_h'
|
@@ -1,3 +1,4 @@
|
|
1
|
+
require 'facets/core/array/store'
|
1
2
|
|
2
3
|
class Array
|
3
4
|
|
@@ -15,9 +16,27 @@ class Array
|
|
15
16
|
return slice(*args)
|
16
17
|
end
|
17
18
|
|
19
|
+
# Modifies #[]= to accept an array of indexes for assignment.
|
20
|
+
#
|
21
|
+
# a = ['a','b','c','d']
|
22
|
+
#
|
23
|
+
# a[[1,-1]] = ['m','n'] #=> ['m','n']
|
24
|
+
# a #=> ['a','m','c','n']
|
25
|
+
#
|
26
|
+
def []=(*args)
|
27
|
+
if Array === args.at(0)
|
28
|
+
idx,vals = args.at(0),args.at(1)
|
29
|
+
idx.each_with_index{ |a,i| store(a,vals.at(i)) }
|
30
|
+
return values_at( *idx )
|
31
|
+
else
|
32
|
+
return store(*args)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
18
36
|
end
|
19
37
|
|
20
38
|
|
39
|
+
|
21
40
|
# _____ _
|
22
41
|
# |_ _|__ ___| |_
|
23
42
|
# | |/ _ \/ __| __|
|
@@ -35,6 +54,14 @@ end
|
|
35
54
|
assert_equal( ['b','f'], a[[1,-1]] )
|
36
55
|
end
|
37
56
|
|
57
|
+
def test_op_store
|
58
|
+
a = ['a','o','z']
|
59
|
+
a[[0,2]] = ['A','Z']
|
60
|
+
assert_equal( ['A','o','Z'], a )
|
61
|
+
a[[0,-1]] = ['W','Y']
|
62
|
+
assert_equal( ['W','o','Y'], a )
|
63
|
+
end
|
64
|
+
|
38
65
|
end
|
39
66
|
|
40
67
|
=end
|
@@ -1,47 +1,2 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
class Array
|
4
|
-
|
5
|
-
# Modifies #[]= to accept an array of indexes for assignment.
|
6
|
-
#
|
7
|
-
# a = ['a','b','c','d']
|
8
|
-
#
|
9
|
-
# a[[1,-1]] = ['m','n'] #=> ['m','n']
|
10
|
-
# a #=> ['a','m','c','n']
|
11
|
-
#
|
12
|
-
def []=(*args)
|
13
|
-
if Array === args.at(0)
|
14
|
-
idx,vals = args.at(0),args.at(1)
|
15
|
-
idx.each_with_index{ |a,i| store(a,vals.at(i)) }
|
16
|
-
return values_at( *idx )
|
17
|
-
else
|
18
|
-
return store(*args)
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
end
|
23
|
-
|
24
|
-
|
25
|
-
# _____ _
|
26
|
-
# |_ _|__ ___| |_
|
27
|
-
# | |/ _ \/ __| __|
|
28
|
-
# | | __/\__ \ |_
|
29
|
-
# |_|\___||___/\__|
|
30
|
-
#
|
31
|
-
=begin test
|
32
|
-
|
33
|
-
require 'test/unit'
|
34
|
-
|
35
|
-
class TCArray < Test::Unit::TestCase
|
36
|
-
|
37
|
-
def test_op_stroe
|
38
|
-
a = ['a','o','z']
|
39
|
-
a[[0,2]] = ['A','Z']
|
40
|
-
assert_equal( ['A','o','Z'], a )
|
41
|
-
a[[0,-1]] = ['W','Y']
|
42
|
-
assert_equal( ['W','o','Y'], a )
|
43
|
-
end
|
44
|
-
|
45
|
-
end
|
46
|
-
|
47
|
-
=end
|
1
|
+
#stub
|
2
|
+
require 'facets/core/array/op_fetch.rb'
|
@@ -1,2 +1,91 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
require 'enumerator'
|
2
|
+
|
3
|
+
module Enumerable
|
4
|
+
|
5
|
+
# Iterate through slices. If slicing +step+ is not
|
6
|
+
# given, the the arity if the block is used.
|
7
|
+
#
|
8
|
+
# x = []
|
9
|
+
# [1,2,3,4].each_by{ |a,b| x << [a,b] }
|
10
|
+
# x #=> [ [1,2], [3,4] ]
|
11
|
+
#
|
12
|
+
# x = []
|
13
|
+
# [1,2,3,4,5,6].each_by(3){ |a| x << a }
|
14
|
+
# x #=> [ [1,2,3], [4,5,6] ]
|
15
|
+
|
16
|
+
def each_by(step=nil, &yld)
|
17
|
+
if step
|
18
|
+
each_slice(step,&yld)
|
19
|
+
else
|
20
|
+
step = yld.arity.abs
|
21
|
+
each_slice(step,&yld)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
26
|
+
|
27
|
+
|
28
|
+
# _____ _
|
29
|
+
# |_ _|__ ___| |_
|
30
|
+
# | |/ _ \/ __| __|
|
31
|
+
# | | __/\__ \ |_
|
32
|
+
# |_|\___||___/\__|
|
33
|
+
#
|
34
|
+
=begin test
|
35
|
+
|
36
|
+
require 'test/unit'
|
37
|
+
|
38
|
+
class TCEnumerable < Test::Unit::TestCase
|
39
|
+
|
40
|
+
def test_01
|
41
|
+
x = []
|
42
|
+
[1,2,3,4].each_by{ |a,b| x << [a,b] }
|
43
|
+
o = [[1,2],[3,4]]
|
44
|
+
assert_equal( o, x )
|
45
|
+
end
|
46
|
+
|
47
|
+
def test_02
|
48
|
+
x = []
|
49
|
+
[1,2,3,4,5].each_by{ |a,b,c| x << [a,b,c] }
|
50
|
+
o = [[1,2,3],[4,5,nil]]
|
51
|
+
assert_equal( o, x )
|
52
|
+
end
|
53
|
+
|
54
|
+
def test_03
|
55
|
+
x = []
|
56
|
+
[1,2,3,4].each_by(2){ |a,b| x << [a,b] }
|
57
|
+
o = [[1,2],[3,4]]
|
58
|
+
assert_equal( o, x )
|
59
|
+
end
|
60
|
+
|
61
|
+
def test_04
|
62
|
+
x = []
|
63
|
+
[1,2,3,4,5,6,7,8].each_by(4){ |*a| x << a }
|
64
|
+
o = [ [[1,2,3,4]],[[5,6,7,8]] ]
|
65
|
+
assert_equal( o, x )
|
66
|
+
end
|
67
|
+
|
68
|
+
def test_05
|
69
|
+
x = []
|
70
|
+
[1,2,3,4,5,6].each_by(3){ |*a| x << a }
|
71
|
+
o = [ [[1,2,3]],[[4,5,6]] ]
|
72
|
+
assert_equal( o, x )
|
73
|
+
end
|
74
|
+
|
75
|
+
def test_06
|
76
|
+
a = [1,2,3,4,5,6]
|
77
|
+
r = []
|
78
|
+
a.each_by(2){ |x,y| r << [x,y] }
|
79
|
+
assert_equal( [[1,2],[3,4],[5,6]], r )
|
80
|
+
end
|
81
|
+
|
82
|
+
def test_07
|
83
|
+
a = [1,2,3,4,5,6]
|
84
|
+
r = []
|
85
|
+
a.each_by(3){ |*e| r << e }
|
86
|
+
assert_equal( [ [[1,2,3]], [[4,5,6]] ], r )
|
87
|
+
end
|
88
|
+
|
89
|
+
end
|
90
|
+
|
91
|
+
=end
|