facets 2.4.5 → 2.5.0
Sign up to get free protection for your applications and to get access to all the features.
- data/AUTHORS +6 -2
- data/CHANGES +46 -52
- data/MANIFEST +680 -642
- data/README +3 -10
- data/RELEASE +82 -36
- data/VERSION +1 -1
- data/doc/archive/{changelog-0.rdoc → CHANGELOG-0.10.30} +0 -0
- data/doc/archive/{changelog-1.rdoc → CHANGELOG-1.8.54} +0 -0
- data/doc/archive/CHANGELOG-2.4.5 +1654 -0
- data/doc/{news → archive}/RELEASE-2.0.5 +0 -0
- data/doc/{news → archive}/RELEASE-2.1.0 +0 -0
- data/doc/{news → archive}/RELEASE-2.1.1 +0 -0
- data/doc/{news → archive}/RELEASE-2.1.2 +0 -0
- data/doc/{news → archive}/RELEASE-2.1.3 +0 -0
- data/doc/{news → archive}/RELEASE-2.2.0 +0 -0
- data/doc/{news → archive}/RELEASE-2.2.1 +0 -0
- data/doc/{news → archive}/RELEASE-2.3.0 +0 -0
- data/doc/{news → archive}/RELEASE-2.4.0 +0 -0
- data/doc/{news → archive}/RELEASE-2.4.1 +0 -0
- data/doc/{news → archive}/RELEASE-2.4.2 +0 -0
- data/doc/{news → archive}/RELEASE-2.4.3 +0 -0
- data/doc/{news → archive}/RELEASE-2.4.4 +0 -0
- data/doc/archive/RELEASE-2.4.5 +37 -0
- data/doc/{book/history.rdoc → guide/notes.rd} +62 -4
- data/doc/log/basic_stats/index.html +39 -0
- data/doc/log/bstats/stats.html +39 -0
- data/doc/log/changelog.html +141 -0
- data/doc/log/changelog.txt +1609 -0
- data/doc/log/stats.html +25 -0
- data/doc/log/testlog.txt +278 -0
- data/doc/rdoc/core/classes/Array.html +158 -147
- data/doc/rdoc/core/classes/Binding.html +54 -54
- data/doc/rdoc/core/classes/Class.html +59 -57
- data/doc/rdoc/core/classes/Comparable.html +67 -76
- data/doc/rdoc/core/classes/Dir.html +47 -47
- data/doc/rdoc/core/classes/Enumerable.html +232 -192
- data/doc/rdoc/core/classes/Exception.html +15 -16
- data/doc/rdoc/core/classes/File.html +128 -85
- data/doc/rdoc/core/classes/FileTest.html +7 -7
- data/doc/rdoc/core/classes/Float.html +16 -14
- data/doc/rdoc/core/classes/Functor.html +12 -12
- data/doc/rdoc/core/classes/Hash.html +490 -319
- data/doc/rdoc/core/classes/Indexable.html +110 -110
- data/doc/rdoc/core/classes/InstanceVariables.html +44 -44
- data/doc/rdoc/core/classes/Integer.html +122 -116
- data/doc/rdoc/core/classes/Kernel.html +415 -401
- data/doc/rdoc/core/classes/Lazy/Promise.html +1 -1
- data/doc/rdoc/core/classes/MatchData.html +24 -21
- data/doc/rdoc/core/classes/Module.html +230 -229
- data/doc/rdoc/core/classes/NilClass.html +28 -26
- data/doc/rdoc/core/classes/Numeric.html +30 -30
- data/doc/rdoc/core/classes/Object.html +8 -8
- data/doc/rdoc/core/classes/{Friend.html → ObjectSpace.html} +25 -48
- data/doc/rdoc/core/classes/Proc.html +29 -27
- data/doc/rdoc/core/classes/Range.html +17 -15
- data/doc/rdoc/core/classes/Regexp.html +17 -17
- data/doc/rdoc/core/classes/Stackable.html +31 -31
- data/doc/rdoc/core/classes/String.html +445 -401
- data/doc/rdoc/{more/classes/CLI/NoOptionError.html → core/classes/Struct.html} +24 -21
- data/doc/rdoc/core/classes/Symbol.html +73 -65
- data/doc/rdoc/core/classes/Time.html +87 -86
- data/doc/rdoc/core/classes/TrueClass.html +8 -8
- data/doc/rdoc/core/classes/UnboundMethod.html +17 -16
- data/doc/rdoc/core/created.rid +1 -1
- data/doc/rdoc/core/files/README.html +10 -16
- data/doc/rdoc/core/files/lib/core/facets/array/combination_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/array/conjoin_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/array/delete_rb.html +10 -1
- data/doc/rdoc/core/files/lib/core/facets/array/delete_unless_rb.html +92 -0
- data/doc/rdoc/core/files/lib/core/facets/array/delete_values_rb.html +92 -0
- data/doc/rdoc/core/files/lib/core/facets/array/index_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/array/indexable_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/array/merge_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/array/only_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/array/pad_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/array/permutation_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/array/product_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/array/rotate_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/array/select_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/array/splice_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/array/stackable_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/binding/caller_rb.html +2 -2
- data/doc/rdoc/core/files/lib/core/facets/binding/callstack_rb.html +96 -0
- data/doc/rdoc/core/files/lib/core/facets/binding/defined_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/bitmask_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/class/cattr_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/class/descendents_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/class/prepend_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/class/to_proc_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/comparable/at_least_rb.html +96 -0
- data/doc/rdoc/core/files/lib/core/facets/comparable/at_most_rb.html +96 -0
- data/doc/rdoc/core/files/lib/core/facets/comparable/bound_rb.html +5 -1
- data/doc/rdoc/core/files/lib/core/facets/comparable/cap_rb.html +92 -0
- data/doc/rdoc/core/files/lib/core/facets/comparable/clip_rb.html +92 -0
- data/doc/rdoc/core/files/lib/core/facets/comparable/cmp_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/comparable/comparable_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/dir/ascend_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/dir/multiglob_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/dir/recurse_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/enumerable/accumulate_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/enumerable/cluster_by_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/enumerable/collect_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/enumerable/commonality_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/enumerable/count_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/enumerable/divide_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/enumerable/duplicates_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/enumerable/each_by_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/enumerable/entropy_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/enumerable/frequency_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/enumerable/graph_rb.html +96 -0
- data/doc/rdoc/core/files/lib/core/facets/enumerable/group_by_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/enumerable/inject_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/enumerable/map_send_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/enumerable/mash_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/enumerable/mode_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/enumerable/modulate_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/enumerable/none_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/enumerable/occur_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/enumerable/one_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/enumerable/probability_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/enumerable/sum_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/enumerable/take_rb.html +92 -0
- data/doc/rdoc/core/files/lib/core/facets/enumerable/uniq_by_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/exception/detail_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/exception/suppress_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/file/append_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/file/create_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/file/null_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/file/read_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/file/rewrite_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/file/rootname_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/file/split_all_rb.html +92 -0
- data/doc/rdoc/core/files/lib/core/facets/file/split_root_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/file/write_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/file/writelines_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/filetest/root_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/hash/alias_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/hash/autonew_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/hash/collate_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/hash/delete_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/hash/insert_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/hash/inverse_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/hash/join_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/hash/keys_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/hash/op_add_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/hash/op_and_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/hash/op_mul_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/hash/op_or_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/hash/op_push_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/hash/op_sub_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/hash/rekey_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/hash/replace_each_rb.html +92 -0
- data/doc/rdoc/core/files/lib/core/facets/hash/select_rb.html +1 -1
- data/doc/rdoc/{more/files/lib/more → core/files/lib/core}/facets/hash/stringify_keys_rb.html +1 -1
- data/doc/rdoc/{more/files/lib/more → core/files/lib/core}/facets/hash/symbolize_keys_rb.html +2 -2
- data/doc/rdoc/core/files/lib/core/facets/hash/to_options_rb.html +96 -0
- data/doc/rdoc/core/files/lib/core/facets/hash/to_struct_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/hash/traverse_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/hash/update_each_rb.html +92 -0
- data/doc/rdoc/core/files/lib/core/facets/hash/update_keys_rb.html +92 -0
- data/doc/rdoc/core/files/lib/core/facets/hash/update_rb.html +8 -1
- data/doc/rdoc/core/files/lib/core/facets/hash/update_values_rb.html +92 -0
- data/doc/rdoc/core/files/lib/core/facets/hash/weave_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/hash/zipnew_rb.html +1 -5
- data/doc/rdoc/core/files/lib/core/facets/integer/factorial_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/integer/multiple_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/integer/odd_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/kernel/__here___rb.html +92 -0
- data/doc/rdoc/core/files/lib/core/facets/kernel/as_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/kernel/ask_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/kernel/attr_singleton_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/kernel/callstack_rb.html +92 -0
- data/doc/rdoc/core/files/lib/core/facets/kernel/complete_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/kernel/constant_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/kernel/d_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/kernel/demo_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/kernel/ergo_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/kernel/instance_class_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/kernel/instance_variables_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/kernel/not_nil_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/kernel/object_send_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/kernel/p_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/kernel/populate_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/kernel/qua_class_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/kernel/resc_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/kernel/respond_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/kernel/returning_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/kernel/silence_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/kernel/try_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/matchdata/match_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/matchdata/matchset_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/metaid_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/module/abstract_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/module/alias_accessor_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/module/alias_method_chain_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/module/alias_module_function_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/module/ancestor_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/module/basename_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/module/conflict_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/module/include_function_module_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/module/instance_methods_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/module/is_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/module/methodize_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/module/modspace_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/module/module_load_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/module/nesting_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/module/op_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/module/prepend_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/module/redefine_method_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/module/rename_method_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/module/revise_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/module/spacename_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/module/wrap_method_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/nilclass/to_f_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/numeric/approx_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/numeric/distance_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/numeric/round_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/objectspace/classes_rb.html +92 -0
- data/doc/rdoc/{more/files/lib/more/facets/dictionarymatcher_rb.html → core/files/lib/core/facets/objectspace_rb.html} +4 -4
- data/doc/rdoc/core/files/lib/core/facets/proc/bind_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/proc/compose_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/proc/to_method_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/proc/update_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/range/combine_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/range/overlap_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/range/within_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/regexp/arity_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/string/align_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/string/bracket_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/string/camelcase_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/string/capitalized_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/string/chars_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/string/chomp_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/string/cleave_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/string/compress_lines_rb.html +92 -0
- data/doc/rdoc/core/files/lib/core/facets/string/contains_rb.html +92 -0
- data/doc/rdoc/core/files/lib/core/facets/string/divide_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/string/expand_tab_rb.html +92 -0
- data/doc/rdoc/core/files/lib/core/facets/string/fold_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/string/indent_rb.html +92 -0
- data/doc/rdoc/core/files/lib/core/facets/string/interpolate_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/string/line_wrap_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/string/lines_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/string/margin_rb.html +92 -0
- data/doc/rdoc/core/files/lib/core/facets/string/methodize_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/string/mscan_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/string/natcmp_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/string/nchar_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/string/op_sub_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/string/outdent_rb.html +96 -0
- data/doc/rdoc/core/files/lib/core/facets/string/range_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/string/rewrite_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/string/shatter_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/string/snakecase_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/string/splice_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/string/start_with_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/string/tab_rb.html +8 -1
- data/doc/rdoc/core/files/lib/core/facets/string/tabto_rb.html +96 -0
- data/doc/rdoc/core/files/lib/core/facets/string/titlecase_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/string/to_re_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/string/word_wrap_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/struct/attributes_rb.html +92 -0
- data/doc/rdoc/{more/files/lib/more/facets/bytes_rb.html → core/files/lib/core/facets/struct_rb.html} +4 -4
- data/doc/rdoc/core/files/lib/core/facets/symbol/chomp_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/symbol/generate_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/symbol/not_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/symbol/succ_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/symbol/to_proc_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/time/advance_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/time/change_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/time/elapse_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/time/hence_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/time/stamp_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/to_hash_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/unboundmethod/arguments_rb.html +1 -1
- data/doc/rdoc/core/files/lib/core/facets/unboundmethod/name_rb.html +1 -1
- data/doc/rdoc/core/fr_class_index.html +2 -1
- data/doc/rdoc/core/fr_file_index.html +30 -1
- data/doc/rdoc/core/fr_method_index.html +430 -423
- data/doc/rdoc/lore/classes/Date.html +6 -5
- data/doc/rdoc/{more/classes/CLI/Command/UniversalOptions.html → lore/classes/Enumerable.html} +7 -9
- data/doc/rdoc/lore/classes/Enumerable/Enumerator.html +147 -0
- data/doc/rdoc/lore/classes/OpenStruct.html +13 -15
- data/doc/rdoc/lore/created.rid +1 -1
- data/doc/rdoc/lore/files/README.html +10 -16
- data/doc/rdoc/lore/files/lib/lore/facets/date_rb.html +1 -1
- data/doc/rdoc/lore/files/lib/lore/facets/enumerator_rb.html +111 -0
- data/doc/rdoc/lore/files/lib/lore/facets/ostruct_rb.html +1 -1
- data/doc/rdoc/lore/fr_class_index.html +2 -0
- data/doc/rdoc/lore/fr_file_index.html +1 -0
- data/doc/rdoc/lore/fr_method_index.html +13 -12
- data/doc/rdoc/more/classes/ANSICode.html +66 -66
- data/doc/rdoc/more/classes/Advisable.html +37 -37
- data/doc/rdoc/more/classes/Advisable/Method.html +20 -20
- data/doc/rdoc/more/classes/Archive/Tar/Minitar.html +27 -27
- data/doc/rdoc/more/classes/Archive/Tar/Minitar/Input.html +28 -28
- data/doc/rdoc/more/classes/Archive/Tar/Minitar/Output.html +19 -19
- data/doc/rdoc/more/classes/Archive/Tar/Minitar/Reader.html +31 -31
- data/doc/rdoc/more/classes/Archive/Tar/Minitar/Writer.html +33 -33
- data/doc/rdoc/more/classes/Argvector.html +76 -76
- data/doc/rdoc/more/classes/Association.html +28 -28
- data/doc/rdoc/more/classes/Association/Kernel.html +8 -8
- data/doc/rdoc/more/classes/Autoarray.html +12 -12
- data/doc/rdoc/more/classes/BBCode.html +34 -34
- data/doc/rdoc/more/classes/BaseX.html +16 -16
- data/doc/rdoc/more/classes/BiCrypt.html +67 -67
- data/doc/rdoc/more/classes/BinReadable.html +85 -85
- data/doc/rdoc/more/classes/BinReadable/ByteOrder.html +25 -25
- data/doc/rdoc/more/classes/Binding.html +8 -8
- data/doc/rdoc/more/classes/BlankSlate.html +5 -5
- data/doc/rdoc/more/classes/Buildable.html +4 -4
- data/doc/rdoc/more/classes/BuildingBlock.html +32 -32
- data/doc/rdoc/more/classes/Capsule.html +41 -41
- data/doc/rdoc/more/classes/Cloneable.html +4 -4
- data/doc/rdoc/more/classes/ConsoleUtils.html +22 -22
- data/doc/rdoc/more/classes/Coroutine.html +28 -28
- data/doc/rdoc/more/classes/Crypt.html +16 -16
- data/doc/rdoc/more/classes/CssFilter.html +45 -45
- data/doc/rdoc/more/classes/CssTree.html +8 -8
- data/doc/rdoc/more/classes/Dictionary.html +228 -228
- data/doc/rdoc/more/classes/Downloader.html +56 -56
- data/doc/rdoc/more/classes/Duration.html +369 -445
- data/doc/rdoc/more/classes/Duration/Numeric.html +389 -0
- data/doc/rdoc/more/classes/{CLI/NoCommandError.html → Duration/Time.html} +30 -17
- data/doc/rdoc/more/classes/Enumerable.html +114 -51
- data/doc/rdoc/more/classes/Enumerable/Elementor.html +16 -16
- data/doc/rdoc/more/classes/Enumerable/Enumerator.html +4 -4
- data/doc/rdoc/more/classes/Enumerable/Filterable.html +246 -0
- data/doc/rdoc/more/classes/EnumerablePass.html +17 -17
- data/doc/rdoc/more/classes/{RecursiveDependency.html → Enumerator.html} +7 -4
- data/doc/rdoc/more/classes/{CLI.html → Enumerator/Filter.html} +22 -26
- data/doc/rdoc/more/classes/Equatable.html +16 -16
- data/doc/rdoc/more/classes/Expirable.html +17 -17
- data/doc/rdoc/more/classes/FileList.html +125 -125
- data/doc/rdoc/more/classes/Fileable.html +14 -14
- data/doc/rdoc/more/classes/Fileable/DSL.html +41 -41
- data/doc/rdoc/more/classes/Hash.html +16 -162
- data/doc/rdoc/more/classes/Hash2Xml.html +4 -4
- data/doc/rdoc/more/classes/HtmlFilter.html +9 -9
- data/doc/rdoc/more/classes/IORedirect.html +19 -19
- data/doc/rdoc/more/classes/InfinityClass.html +36 -36
- data/doc/rdoc/more/classes/InfinityClass/Numeric.html +23 -23
- data/doc/rdoc/more/classes/Ini.html +37 -37
- data/doc/rdoc/more/classes/Instantiable.html +9 -9
- data/doc/rdoc/more/classes/Instantize.html +8 -8
- data/doc/rdoc/more/classes/Interval.html +187 -187
- data/doc/rdoc/more/classes/It.html +12 -12
- data/doc/rdoc/more/classes/LRUCache.html +38 -38
- data/doc/rdoc/more/classes/LinkedList.html +68 -68
- data/doc/rdoc/more/classes/LinkedList/Node.html +4 -4
- data/doc/rdoc/more/classes/{DictionaryMatcher.html → Matcher.html} +66 -68
- data/doc/rdoc/more/classes/{DictionaryMatcher → Matcher}/MatchData.html +8 -8
- data/doc/rdoc/more/classes/{CacheDecorator.html → Memoizer.html} +64 -46
- data/doc/rdoc/more/classes/Module.html +182 -361
- data/doc/rdoc/more/classes/Multiton.html +12 -12
- data/doc/rdoc/more/classes/Multiton/MetaMethods.html +28 -28
- data/doc/rdoc/more/classes/Net/SMTP.html +8 -8
- data/doc/rdoc/more/classes/NullClass.html +24 -24
- data/doc/rdoc/more/classes/Numeric/Multipliers.html +456 -0
- data/doc/rdoc/more/classes/ObjectReflection.html +12 -12
- data/doc/rdoc/more/classes/OpEsc.html +8 -7
- data/doc/rdoc/more/classes/OpenCascade.html +4 -4
- data/doc/rdoc/more/classes/OpenCollection.html +8 -8
- data/doc/rdoc/more/classes/OpenHash.html +9 -9
- data/doc/rdoc/more/classes/{EventHook.html → OpenModule.html} +24 -63
- data/doc/rdoc/more/classes/OpenObject.html +95 -95
- data/doc/rdoc/more/classes/OpenStructable.html +326 -0
- data/doc/rdoc/more/classes/PQueue.html +84 -84
- data/doc/rdoc/more/classes/Paramix.html +11 -11
- data/doc/rdoc/more/classes/Paramix/Delegator.html +16 -16
- data/doc/rdoc/more/classes/PathList.html +8 -8
- data/doc/rdoc/more/classes/PathList/Finder.html +8 -8
- data/doc/rdoc/more/classes/Platform.html +46 -46
- data/doc/rdoc/more/classes/Pool.html +18 -18
- data/doc/rdoc/more/classes/Proc.html +9 -9
- data/doc/rdoc/more/classes/ProgressBar.html +52 -52
- data/doc/rdoc/more/classes/Prototype.html +28 -28
- data/doc/rdoc/more/classes/RWDelegator.html +16 -16
- data/doc/rdoc/more/classes/Random.html +5 -5
- data/doc/rdoc/more/classes/Random/Array.html +37 -37
- data/doc/rdoc/more/classes/Random/Hash.html +52 -52
- data/doc/rdoc/more/classes/Random/Object.html +4 -4
- data/doc/rdoc/more/classes/Random/String.html +34 -34
- data/doc/rdoc/more/classes/Random/String/Self.html +9 -9
- data/doc/rdoc/more/classes/Recorder.html +16 -16
- data/doc/rdoc/more/classes/Reference.html +19 -19
- data/doc/rdoc/more/classes/Registerable.html +13 -13
- data/doc/rdoc/more/classes/Semaphore.html +36 -36
- data/doc/rdoc/more/classes/Settings.html +28 -28
- data/doc/rdoc/more/classes/Settings/Setting.html +13 -13
- data/doc/rdoc/more/classes/Settings/SettingCollection.html +4 -4
- data/doc/rdoc/more/classes/SimpleStringIO.html +8 -8
- data/doc/rdoc/more/classes/Snapshot.html +16 -16
- data/doc/rdoc/more/classes/Snapshot/ValueHolder.html +12 -12
- data/doc/rdoc/more/classes/SparseArray.html +1397 -0
- data/doc/rdoc/more/classes/Stash.html +232 -0
- data/doc/rdoc/more/classes/String/Mask.html +72 -72
- data/doc/rdoc/more/classes/String/Words.html +49 -49
- data/doc/rdoc/more/classes/Struct.html +8 -8
- data/doc/rdoc/more/classes/SyncArray.html +4 -4
- data/doc/rdoc/more/classes/SyncHash.html +4 -4
- data/doc/rdoc/more/classes/SyncHash/Delegator.html +28 -28
- data/doc/rdoc/more/classes/SyncHash/Inheritor.html +28 -28
- data/doc/rdoc/more/classes/System.html +253 -253
- data/doc/rdoc/more/classes/Timer.html +48 -48
- data/doc/rdoc/more/classes/Timer/Dummy.html +9 -9
- data/doc/rdoc/more/classes/TracePoint.html +58 -58
- data/doc/rdoc/more/classes/Tuple.html +170 -170
- data/doc/rdoc/more/classes/TypeCast/Class.html +4 -4
- data/doc/rdoc/more/classes/TypeCast/Object.html +4 -4
- data/doc/rdoc/more/classes/Uninheritable.html +6 -6
- data/doc/rdoc/more/classes/VersionNumber.html +57 -57
- data/doc/rdoc/more/classes/XOXO.html +9 -9
- data/doc/rdoc/more/classes/ZipUtils.html +251 -118
- data/doc/rdoc/more/classes/ZipUtils/DryRun.html +203 -35
- data/doc/rdoc/more/classes/ZipUtils/NoWrite.html +203 -35
- data/doc/rdoc/more/classes/ZipUtils/Verbose.html +173 -35
- data/doc/rdoc/more/created.rid +1 -1
- data/doc/rdoc/more/files/README.html +10 -16
- data/doc/rdoc/more/files/lib/more/facets/attr_rb.html +1 -1
- data/doc/rdoc/more/files/lib/more/facets/buildable_rb.html +1 -1
- data/doc/rdoc/more/files/lib/more/facets/consoleutils_rb.html +1 -18
- data/doc/rdoc/more/files/lib/more/facets/dependency_rb.html +1 -1
- data/doc/rdoc/more/files/lib/more/facets/duration_rb.html +1 -41
- data/doc/rdoc/more/files/lib/more/facets/elementor_rb.html +2 -1
- data/doc/rdoc/more/files/lib/more/facets/enumerablepass_rb.html +2 -1
- data/doc/rdoc/more/files/lib/more/facets/{fileshell_rb.html → filter_rb.html} +6 -5
- data/doc/rdoc/more/files/lib/more/facets/inheritor_rb.html +3 -28
- data/doc/rdoc/more/files/lib/more/facets/iteration_rb.html +1 -1
- data/doc/rdoc/more/files/lib/more/facets/kernel/meta_rb.html +1 -1
- data/doc/rdoc/more/files/lib/more/facets/matcher_rb.html +97 -0
- data/doc/rdoc/more/files/lib/more/facets/memoize_rb.html +7 -4
- data/doc/rdoc/more/files/lib/more/facets/{cachedecorator_rb.html → memoizer_rb.html} +23 -49
- data/doc/rdoc/more/files/lib/more/facets/multipliers_rb.html +2 -18
- data/doc/rdoc/more/files/lib/more/facets/nilstatus_rb.html +1 -1
- data/doc/rdoc/{core/files/lib/core/facets/callstack_rb.html → more/files/lib/more/facets/openmodule_rb.html} +4 -4
- data/doc/rdoc/more/files/lib/more/facets/opesc_rb.html +1 -1
- data/doc/rdoc/more/files/lib/more/facets/ostructable_rb.html +92 -0
- data/doc/rdoc/more/files/lib/more/facets/pathlist_rb.html +1 -1
- data/doc/rdoc/more/files/lib/more/facets/snapshot_rb.html +2 -2
- data/doc/rdoc/more/files/lib/more/facets/sparse_array_rb.html +92 -0
- data/doc/rdoc/more/files/lib/more/facets/stash_rb.html +166 -0
- data/doc/rdoc/more/files/lib/more/facets/string/words_rb.html +1 -1
- data/doc/rdoc/more/files/lib/more/facets/succ_rb.html +1 -1
- data/doc/rdoc/more/files/lib/more/facets/thread_rb.html +1 -1
- data/doc/rdoc/more/files/lib/more/facets/ziputils_rb.html +6 -34
- data/doc/rdoc/more/fr_class_index.html +13 -17
- data/doc/rdoc/more/fr_file_index.html +7 -15
- data/doc/rdoc/more/fr_method_index.html +1079 -1003
- data/doc/rdoc/more/index.html +1 -1
- data/lib/core/facets/array/conjoin.rb +1 -1
- data/lib/core/facets/array/delete.rb +3 -60
- data/lib/core/facets/array/delete_unless.rb +15 -0
- data/lib/core/facets/array/delete_values.rb +50 -0
- data/lib/core/facets/array/index.rb +0 -26
- data/lib/core/facets/array/indexable.rb +2 -2
- data/lib/core/facets/array/merge.rb +1 -1
- data/lib/core/facets/array/only.rb +1 -2
- data/lib/core/facets/array/pad.rb +2 -2
- data/lib/core/facets/array/permutation.rb +1 -1
- data/lib/core/facets/array/product.rb +2 -2
- data/lib/core/facets/array/rotate.rb +2 -4
- data/lib/core/facets/array/select.rb +1 -1
- data/lib/core/facets/array/splice.rb +1 -1
- data/lib/core/facets/array/stackable.rb +2 -2
- data/lib/core/facets/binding/caller.rb +2 -7
- data/lib/core/facets/binding/callstack.rb +1 -0
- data/lib/core/facets/binding/defined.rb +0 -1
- data/lib/core/facets/bitmask.rb +6 -9
- data/lib/core/facets/class/cattr.rb +6 -9
- data/lib/core/facets/class/descendents.rb +0 -2
- data/lib/core/facets/class/prepend.rb +3 -4
- data/lib/core/facets/class/to_proc.rb +0 -20
- data/lib/core/facets/comparable/at_least.rb +1 -0
- data/lib/core/facets/comparable/at_most.rb +1 -0
- data/lib/core/facets/comparable/bound.rb +1 -65
- data/lib/core/facets/comparable/cap.rb +34 -0
- data/lib/core/facets/comparable/clip.rb +38 -0
- data/lib/core/facets/comparable/cmp.rb +3 -3
- data/lib/core/facets/comparable/comparable.rb +1 -1
- data/lib/core/facets/dir/ascend.rb +2 -5
- data/lib/core/facets/dir/multiglob.rb +0 -2
- data/lib/core/facets/dir/recurse.rb +1 -2
- data/lib/core/facets/enumerable/accumulate.rb +2 -0
- data/lib/core/facets/enumerable/cluster_by.rb +1 -1
- data/lib/core/facets/enumerable/collect.rb +2 -2
- data/lib/core/facets/enumerable/commonality.rb +1 -1
- data/lib/core/facets/enumerable/count.rb +1 -1
- data/lib/core/facets/enumerable/divide.rb +1 -1
- data/lib/core/facets/enumerable/duplicates.rb +2 -2
- data/lib/core/facets/enumerable/each_by.rb +1 -1
- data/lib/core/facets/enumerable/entropy.rb +2 -2
- data/lib/core/facets/enumerable/frequency.rb +1 -1
- data/lib/core/facets/enumerable/graph.rb +1 -0
- data/lib/core/facets/enumerable/group_by.rb +1 -1
- data/lib/core/facets/enumerable/inject.rb +2 -3
- data/lib/core/facets/enumerable/map_send.rb +15 -3
- data/lib/core/facets/enumerable/mash.rb +4 -5
- data/lib/core/facets/enumerable/mode.rb +1 -1
- data/lib/core/facets/enumerable/modulate.rb +2 -2
- data/lib/core/facets/enumerable/none.rb +1 -1
- data/lib/core/facets/enumerable/occur.rb +0 -2
- data/lib/core/facets/enumerable/one.rb +1 -1
- data/lib/core/facets/enumerable/probability.rb +1 -1
- data/lib/core/facets/enumerable/sum.rb +1 -1
- data/lib/core/facets/enumerable/take.rb +20 -0
- data/lib/core/facets/enumerable/uniq_by.rb +0 -2
- data/lib/core/facets/exception/detail.rb +1 -1
- data/lib/core/facets/exception/suppress.rb +1 -2
- data/lib/core/facets/file/append.rb +1 -1
- data/lib/core/facets/file/create.rb +1 -1
- data/lib/core/facets/file/null.rb +1 -1
- data/lib/core/facets/file/read.rb +3 -3
- data/lib/core/facets/file/rewrite.rb +1 -1
- data/lib/core/facets/file/rootname.rb +1 -1
- data/lib/core/facets/file/split_all.rb +19 -0
- data/lib/core/facets/file/split_root.rb +3 -0
- data/lib/core/facets/file/write.rb +1 -1
- data/lib/core/facets/file/writelines.rb +1 -2
- data/lib/core/facets/filetest/root.rb +1 -1
- data/lib/core/facets/hash/alias.rb +1 -1
- data/lib/core/facets/hash/autonew.rb +1 -17
- data/lib/core/facets/hash/collate.rb +1 -1
- data/lib/core/facets/hash/delete.rb +3 -3
- data/lib/core/facets/hash/insert.rb +1 -1
- data/lib/core/facets/hash/inverse.rb +1 -1
- data/lib/core/facets/hash/join.rb +1 -1
- data/lib/core/facets/hash/keys.rb +3 -3
- data/lib/core/facets/hash/op_add.rb +1 -1
- data/lib/core/facets/hash/op_and.rb +1 -1
- data/lib/core/facets/hash/op_mul.rb +1 -1
- data/lib/core/facets/hash/op_or.rb +1 -1
- data/lib/core/facets/hash/op_push.rb +1 -1
- data/lib/core/facets/hash/op_sub.rb +1 -1
- data/lib/core/facets/hash/rekey.rb +11 -7
- data/lib/core/facets/hash/replace_each.rb +16 -0
- data/lib/core/facets/hash/select.rb +1 -2
- data/lib/{more → core}/facets/hash/stringify_keys.rb +0 -0
- data/lib/core/facets/hash/symbolize_keys.rb +94 -0
- data/lib/core/facets/hash/to_options.rb +1 -0
- data/lib/core/facets/hash/to_struct.rb +1 -1
- data/lib/core/facets/hash/traverse.rb +2 -2
- data/lib/core/facets/hash/update.rb +5 -80
- data/lib/core/facets/hash/update_each.rb +18 -0
- data/lib/core/facets/hash/update_keys.rb +20 -0
- data/lib/core/facets/hash/update_values.rb +20 -0
- data/lib/core/facets/hash/weave.rb +1 -1
- data/lib/core/facets/hash/zipnew.rb +17 -1
- data/lib/core/facets/integer/factorial.rb +1 -1
- data/lib/core/facets/integer/multiple.rb +1 -1
- data/lib/core/facets/integer/odd.rb +2 -2
- data/lib/core/facets/kernel/__here__.rb +8 -0
- data/lib/core/facets/kernel/as.rb +2 -2
- data/lib/core/facets/kernel/attr_singleton.rb +5 -5
- data/lib/core/facets/{callstack.rb → kernel/callstack.rb} +1 -1
- data/lib/core/facets/kernel/complete.rb +1 -1
- data/lib/core/facets/kernel/constant.rb +1 -1
- data/lib/core/facets/kernel/d.rb +1 -5
- data/lib/core/facets/kernel/demo.rb +2 -2
- data/lib/core/facets/kernel/ergo.rb +2 -2
- data/lib/core/facets/kernel/instance_class.rb +1 -1
- data/lib/core/facets/kernel/instance_variables.rb +2 -4
- data/lib/core/facets/kernel/not_nil.rb +1 -1
- data/lib/core/facets/kernel/object_send.rb +1 -1
- data/lib/core/facets/kernel/p.rb +1 -1
- data/lib/core/facets/kernel/populate.rb +2 -2
- data/lib/core/facets/kernel/qua_class.rb +2 -2
- data/lib/core/facets/kernel/resc.rb +1 -1
- data/lib/core/facets/kernel/respond.rb +1 -1
- data/lib/core/facets/kernel/returning.rb +1 -1
- data/lib/core/facets/kernel/silence.rb +4 -4
- data/lib/core/facets/kernel/try.rb +5 -3
- data/lib/core/facets/matchdata/match.rb +1 -1
- data/lib/core/facets/matchdata/matchset.rb +2 -2
- data/lib/core/facets/metaid.rb +5 -5
- data/lib/core/facets/module/abstract.rb +1 -1
- data/lib/core/facets/module/alias_accessor.rb +3 -3
- data/lib/core/facets/module/alias_method_chain.rb +1 -2
- data/lib/core/facets/module/alias_module_function.rb +1 -1
- data/lib/core/facets/module/ancestor.rb +1 -1
- data/lib/core/facets/module/basename.rb +1 -1
- data/lib/core/facets/module/conflict.rb +1 -2
- data/lib/core/facets/module/include_function_module.rb +1 -1
- data/lib/core/facets/module/instance_methods.rb +4 -6
- data/lib/core/facets/module/is.rb +2 -2
- data/lib/core/facets/module/modspace.rb +1 -1
- data/lib/core/facets/module/module_load.rb +2 -2
- data/lib/core/facets/module/nesting.rb +1 -1
- data/lib/core/facets/module/op.rb +3 -6
- data/lib/core/facets/module/prepend.rb +1 -1
- data/lib/core/facets/module/redefine_method.rb +1 -1
- data/lib/core/facets/module/rename_method.rb +1 -1
- data/lib/core/facets/module/revise.rb +2 -2
- data/lib/core/facets/module/spacename.rb +1 -1
- data/lib/core/facets/module/wrap_method.rb +1 -1
- data/lib/core/facets/nilclass/to_f.rb +1 -1
- data/lib/core/facets/numeric/approx.rb +1 -1
- data/lib/core/facets/numeric/distance.rb +1 -1
- data/lib/core/facets/numeric/round.rb +3 -6
- data/lib/core/facets/objectspace.rb +6 -0
- data/lib/core/facets/objectspace/classes.rb +11 -0
- data/lib/core/facets/proc/bind.rb +1 -1
- data/lib/core/facets/proc/compose.rb +2 -2
- data/lib/core/facets/proc/to_method.rb +1 -1
- data/lib/core/facets/proc/update.rb +1 -1
- data/lib/core/facets/range/combine.rb +2 -2
- data/lib/core/facets/range/overlap.rb +1 -2
- data/lib/core/facets/range/within.rb +2 -4
- data/lib/core/facets/regexp/arity.rb +1 -1
- data/lib/core/facets/string/align.rb +3 -3
- data/lib/core/facets/string/bracket.rb +6 -6
- data/lib/core/facets/string/camelcase.rb +1 -1
- data/lib/core/facets/string/capitalized.rb +3 -3
- data/lib/core/facets/string/chars.rb +1 -1
- data/lib/core/facets/string/chomp.rb +2 -2
- data/lib/core/facets/string/cleave.rb +1 -1
- data/lib/core/facets/string/compress_lines.rb +17 -0
- data/lib/core/facets/string/contains.rb +7 -0
- data/lib/core/facets/string/divide.rb +1 -1
- data/lib/core/facets/string/expand_tab.rb +35 -0
- data/lib/core/facets/string/fold.rb +1 -1
- data/lib/core/facets/string/indent.rb +25 -0
- data/lib/core/facets/string/interpolate.rb +1 -1
- data/lib/core/facets/string/line_wrap.rb +1 -1
- data/lib/core/facets/string/lines.rb +1 -2
- data/lib/core/facets/string/margin.rb +30 -0
- data/lib/core/facets/string/methodize.rb +1 -1
- data/lib/core/facets/string/mscan.rb +1 -1
- data/lib/core/facets/string/natcmp.rb +1 -2
- data/lib/core/facets/string/nchar.rb +0 -2
- data/lib/core/facets/string/op_sub.rb +1 -1
- data/lib/core/facets/string/outdent.rb +1 -0
- data/lib/core/facets/string/range.rb +4 -5
- data/lib/core/facets/string/rewrite.rb +1 -1
- data/lib/core/facets/string/shatter.rb +1 -1
- data/lib/core/facets/string/snakecase.rb +1 -1
- data/lib/core/facets/string/splice.rb +2 -2
- data/lib/core/facets/string/start_with.rb +2 -4
- data/lib/core/facets/string/tab.rb +9 -92
- data/lib/core/facets/string/tabto.rb +19 -0
- data/lib/core/facets/string/titlecase.rb +1 -1
- data/lib/core/facets/string/to_re.rb +2 -2
- data/lib/core/facets/string/word_wrap.rb +2 -4
- data/lib/core/facets/struct.rb +6 -0
- data/lib/core/facets/struct/attributes.rb +11 -0
- data/lib/core/facets/symbol/chomp.rb +2 -2
- data/lib/core/facets/symbol/generate.rb +1 -1
- data/lib/core/facets/symbol/not.rb +2 -2
- data/lib/core/facets/symbol/succ.rb +1 -1
- data/lib/core/facets/symbol/to_proc.rb +2 -3
- data/lib/core/facets/time/advance.rb +2 -1
- data/lib/core/facets/time/elapse.rb +1 -1
- data/lib/core/facets/time/hence.rb +16 -13
- data/lib/core/facets/time/stamp.rb +2 -2
- data/lib/core/facets/to_hash.rb +1 -1
- data/lib/core/facets/unboundmethod/arguments.rb +1 -1
- data/lib/core/facets/unboundmethod/name.rb +1 -1
- data/lib/lore/facets/date.rb +2 -2
- data/lib/lore/facets/enumerator.rb +67 -0
- data/lib/lore/facets/ostruct.rb +3 -7
- data/lib/more/facets/attr.rb +10 -9
- data/lib/more/facets/consoleutils.rb +1 -15
- data/lib/more/facets/dependency.rb +1 -1
- data/lib/more/facets/duration.rb +271 -525
- data/lib/more/facets/filter.rb +121 -0
- data/lib/more/facets/inheritor.rb +37 -58
- data/lib/more/facets/iteration.rb +1 -1
- data/lib/more/facets/kernel/meta.rb +1 -1
- data/lib/more/facets/{dictionarymatcher.rb → matcher.rb} +15 -11
- data/lib/more/facets/memoize.rb +9 -12
- data/lib/more/facets/memoizer.rb +74 -0
- data/lib/more/facets/multipliers.rb +54 -66
- data/lib/more/facets/nilstatus.rb +3 -2
- data/lib/more/facets/openmodule.rb +15 -0
- data/lib/more/facets/opesc.rb +1 -1
- data/lib/more/facets/ostructable.rb +212 -0
- data/lib/more/facets/pathlist.rb +1 -0
- data/lib/more/facets/sparse_array.rb +809 -0
- data/lib/more/facets/stash.rb +66 -0
- data/lib/more/facets/string/words.rb +8 -11
- data/lib/more/facets/succ.rb +3 -3
- data/lib/more/facets/thread.rb +2 -2
- data/lib/more/facets/ziputils.rb +238 -97
- data/test/core/array/test_index.rb +17 -0
- data/test/core/class/test_cattr.rb +1 -1
- data/test/core/class/test_to_proc.rb +13 -0
- data/test/core/comparable/test_cap.rb +25 -0
- data/test/core/comparable/{test_bound.rb → test_clip.rb} +1 -20
- data/test/core/file/test_split_all.rb +32 -0
- data/test/core/hash/test_op_mul.rb +1 -1
- data/test/core/hash/test_op_push.rb +7 -0
- data/test/core/hash/test_replace_each.rb +14 -0
- data/test/core/hash/test_update_each.rb +13 -0
- data/test/core/hash/test_update_keys.rb +18 -0
- data/test/core/hash/test_update_values.rb +12 -0
- data/test/core/kernel/test_callstack.rb +1 -1
- data/test/core/string/test_indent.rb +13 -0
- data/test/core/string/test_margin.rb +100 -0
- data/test/core/string/test_outdent.rb +65 -0
- data/test/core/string/test_tab.rb +1 -162
- data/test/core/string/test_tabto.rb +13 -0
- data/test/{more → core}/test_metaid.rb +8 -8
- data/test/core/time/test_hence.rb +118 -4
- data/test/core/unboundmethod/test_name.rb +1 -1
- data/test/more/{test_arguments.rb → test_argvector.rb} +8 -12
- data/test/more/test_filter.rb +87 -0
- data/test/more/test_memoize.rb +11 -9
- data/test/more/test_sparsearray.rb +279 -0
- metadata +741 -725
- data/demo/bench/bench_load.rb +0 -56
- data/demo/bench/enumerable/bench_collect.rb +0 -84
- data/demo/bench/enumerable/bench_count.rb +0 -58
- data/demo/bench/general/bench_calls.rb +0 -74
- data/demo/bench/general/bench_includes.rb +0 -25
- data/demo/bench/general/bench_methods.rb +0 -17
- data/demo/bench/general/bench_pathname.rb +0 -24
- data/demo/bench/general/bench_range.rb +0 -64
- data/demo/bench/general/bench_return.rb +0 -56
- data/demo/bench/general/bench_yeild.rb +0 -75
- data/demo/bench/general/comment_loading/bench.rb +0 -46
- data/demo/bench/general/comment_loading/comments_begin.rb +0 -109
- data/demo/bench/general/comment_loading/comments_end.rb +0 -127
- data/demo/bench/general/comment_loading/comments_none.rb +0 -1
- data/demo/bench/general/comment_loading/comments_sharp.rb +0 -125
- data/demo/bench/integer/bench_factorial.rb +0 -31
- data/demo/sample/annotations/annotations1.rb +0 -22
- data/demo/sample/ansicolor/cdiff.rb +0 -20
- data/demo/sample/ansicolor/example.rb +0 -82
- data/doc/book/notes.rdoc +0 -9
- data/doc/rdoc/more/classes/BigDuration.html +0 -323
- data/doc/rdoc/more/classes/CLI/Arguments.html +0 -488
- data/doc/rdoc/more/classes/CLI/Command.html +0 -316
- data/doc/rdoc/more/classes/Chain.html +0 -206
- data/doc/rdoc/more/classes/FileShell.html +0 -743
- data/doc/rdoc/more/classes/TagIterator.html +0 -581
- data/doc/rdoc/more/classes/UploadUtils.html +0 -497
- data/doc/rdoc/more/classes/Weekdays.html +0 -218
- data/doc/rdoc/more/files/lib/more/facets/annotations_rb.html +0 -180
- data/doc/rdoc/more/files/lib/more/facets/arguments_rb.html +0 -142
- data/doc/rdoc/more/files/lib/more/facets/cattr_rb.html +0 -125
- data/doc/rdoc/more/files/lib/more/facets/chain_rb.html +0 -114
- data/doc/rdoc/more/files/lib/more/facets/command_rb.html +0 -170
- data/doc/rdoc/more/files/lib/more/facets/eventhook_rb.html +0 -141
- data/doc/rdoc/more/files/lib/more/facets/tagiterator_rb.html +0 -111
- data/doc/rdoc/more/files/lib/more/facets/times_rb.html +0 -163
- data/doc/rdoc/more/files/lib/more/facets/uploadutils_rb.html +0 -176
- data/lib/more/facets/annotations.rb +0 -302
- data/lib/more/facets/arguments.rb +0 -365
- data/lib/more/facets/bytes.rb +0 -175
- data/lib/more/facets/cachedecorator.rb +0 -117
- data/lib/more/facets/chain.rb +0 -58
- data/lib/more/facets/command.rb +0 -439
- data/lib/more/facets/eventhook.rb +0 -132
- data/lib/more/facets/fileshell.rb +0 -202
- data/lib/more/facets/hash/symbolize_keys.rb +0 -94
- data/lib/more/facets/tagiter.rb +0 -366
- data/lib/more/facets/times.rb +0 -431
- data/lib/more/facets/uploadutils.rb +0 -464
- data/test/core/hash/test_update.rb +0 -46
- data/test/more/test_annotations.rb +0 -120
- data/test/more/test_bytes.rb +0 -71
- data/test/more/test_command.rb +0 -69
- data/test/more/test_times.rb +0 -89
@@ -1,23 +1,9 @@
|
|
1
1
|
# = Multipliers
|
2
2
|
#
|
3
|
-
# WARNING: Use Rich Units package for future compatibilty!
|
4
|
-
#
|
5
3
|
# == Synopsis
|
6
4
|
#
|
7
|
-
# Adds methods to Numeric to make working with
|
8
|
-
#
|
9
|
-
# as well as bits and bytes easier.
|
10
|
-
#
|
11
|
-
# 1.kilo #=> 1000
|
12
|
-
# 1.milli #=> 0.001
|
13
|
-
# 1.kibi #=> 1024
|
14
|
-
#
|
15
|
-
# To display a value in a certain denomination, simply
|
16
|
-
# perform the inverse operation by placing the
|
17
|
-
# multiplier called on unit (1) in the denominator.
|
18
|
-
#
|
19
|
-
# 1000 / 1.kilo #=> 1
|
20
|
-
# 1024 / 1.kibi #=> 1
|
5
|
+
# Adds methods to Numeric to make working with magnitudes
|
6
|
+
# (kilo, mega, giga, milli, micro, etc.)
|
21
7
|
#
|
22
8
|
# == History
|
23
9
|
#
|
@@ -26,7 +12,8 @@
|
|
26
12
|
# == Notes
|
27
13
|
#
|
28
14
|
# * This library is not compatible with STICK's units.rb (an spin-off
|
29
|
-
# of Facets old units.rb library). Do not attempt to use both at
|
15
|
+
# of Facets old units.rb library). Do not attempt to use both at
|
16
|
+
# the same time.
|
30
17
|
#
|
31
18
|
# == Authors
|
32
19
|
#
|
@@ -45,65 +32,66 @@
|
|
45
32
|
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
46
33
|
# FOR A PARTICULAR PURPOSE.
|
47
34
|
|
48
|
-
|
49
|
-
# = Multipliers
|
50
|
-
#
|
51
|
-
# Adds methods to Numeric to make working with
|
52
|
-
# magnitudes (kilo, mega, giga, milli, micro, etc.)
|
53
|
-
# as well as bits and bytes easier.
|
54
|
-
#
|
55
|
-
# 1.kilo #=> 1000
|
56
|
-
# 1.milli #=> 0.001
|
57
|
-
# 1.kibi #=> 1024
|
58
|
-
#
|
59
|
-
# To display a value in a certain denomination, simply
|
60
|
-
# perform the inverse operation by placing the
|
61
|
-
# multiplier called on unit (1) in the denominator.
|
62
|
-
#
|
63
|
-
# 1000 / 1.kilo #=> 1
|
64
|
-
# 1024 / 1.kibi #=> 1
|
65
|
-
#
|
66
|
-
|
67
35
|
#
|
68
36
|
class Numeric
|
69
37
|
|
70
|
-
#
|
38
|
+
# = Multipliers
|
39
|
+
#
|
40
|
+
# Adds methods to Numeric to make working with
|
41
|
+
# magnitudes (kilo, mega, giga, milli, micro, etc.)
|
42
|
+
#
|
43
|
+
# 1.kilo #=> 1000
|
44
|
+
# 1.milli #=> 0.001
|
45
|
+
# 1.kibi #=> 1024
|
46
|
+
#
|
47
|
+
# To display a value in a certain denomination, simply
|
48
|
+
# perform the inverse operation by placing the
|
49
|
+
# multiplier called on unit (1) in the denominator.
|
50
|
+
#
|
51
|
+
# 1000 / 1.kilo #=> 1
|
52
|
+
# 1024 / 1.kibi #=> 1
|
53
|
+
#
|
54
|
+
module Multipliers
|
55
|
+
|
56
|
+
# SI Multipliers
|
71
57
|
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
58
|
+
def deka ; self * 10 ; end
|
59
|
+
def hecto ; self * 100 ; end
|
60
|
+
def kilo ; self * 1000 ; end
|
61
|
+
def mega ; self * 1000000 ; end
|
62
|
+
def giga ; self * 1000000000 ; end
|
63
|
+
def tera ; self * 1000000000000 ; end
|
64
|
+
def peta ; self * 1000000000000000 ; end
|
65
|
+
def exa ; self * 1000000000000000000 ; end
|
80
66
|
|
81
|
-
|
67
|
+
# SI Fractional
|
82
68
|
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
69
|
+
def deci ; self.to_f / 10 ; end
|
70
|
+
def centi ; self.to_f / 100 ; end
|
71
|
+
def milli ; self.to_f / 1000 ; end
|
72
|
+
def micro ; self.to_f / 1000000 ; end
|
73
|
+
def nano ; self.to_f / 1000000000 ; end
|
74
|
+
def pico ; self.to_f / 1000000000000 ; end
|
75
|
+
def femto ; self.to_f / 1000000000000000 ; end
|
76
|
+
def atto ; self.to_f / 1000000000000000000 ; end
|
91
77
|
|
92
|
-
|
78
|
+
# SI Binary
|
93
79
|
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
80
|
+
def kibi ; self * 1024 ; end
|
81
|
+
def mebi ; self * 1024**2 ; end
|
82
|
+
def gibi ; self * 1024**3 ; end
|
83
|
+
def tebi ; self * 1024**4 ; end
|
84
|
+
def pebi ; self * 1024**5 ; end
|
85
|
+
def exbi ; self * 1024**6 ; end
|
100
86
|
|
101
|
-
|
87
|
+
# Bits and Bytes
|
102
88
|
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
89
|
+
#def bit ; self ; end
|
90
|
+
#def bits ; self ; end
|
91
|
+
#def byte ; self * 8 ; end
|
92
|
+
#def bytes ; self * 8 ; end
|
93
|
+
end
|
107
94
|
|
95
|
+
include Multipliers
|
108
96
|
end
|
109
97
|
|
@@ -13,7 +13,7 @@ class NilClass
|
|
13
13
|
# result.status #=> "failed foo!"
|
14
14
|
# end
|
15
15
|
#
|
16
|
-
#
|
16
|
+
# CREDIT: Trans
|
17
17
|
|
18
18
|
def status(status=nil)
|
19
19
|
if status
|
@@ -36,7 +36,7 @@ class NilClass
|
|
36
36
|
# result.status #=> "failed foo!"
|
37
37
|
# end
|
38
38
|
#
|
39
|
-
#
|
39
|
+
# CREDIT: Trans
|
40
40
|
|
41
41
|
def status?
|
42
42
|
return unless @status
|
@@ -45,3 +45,4 @@ class NilClass
|
|
45
45
|
end
|
46
46
|
|
47
47
|
end
|
48
|
+
|
data/lib/more/facets/opesc.rb
CHANGED
@@ -0,0 +1,212 @@
|
|
1
|
+
#--
|
2
|
+
# OpenStructable
|
3
|
+
#
|
4
|
+
# Copyright (c) 2005 Thomas Sawyer
|
5
|
+
#
|
6
|
+
# Ruby License
|
7
|
+
#
|
8
|
+
# This module is free software. You may use, modify, and/or redistribute this
|
9
|
+
# software under the same terms as Ruby.
|
10
|
+
#
|
11
|
+
# This program is distributed in the hope that it will be useful, but WITHOUT
|
12
|
+
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
13
|
+
# FOR A PARTICULAR PURPOSE.
|
14
|
+
#
|
15
|
+
# ==========================================================================
|
16
|
+
# Revision History ::
|
17
|
+
# --------------------------------------------------------------------------
|
18
|
+
# 05.04.28 Trans
|
19
|
+
# - Minor modifications to documentation.
|
20
|
+
# ==========================================================================
|
21
|
+
#
|
22
|
+
# TODO
|
23
|
+
# Keep this uptodate with ostruct.rb.
|
24
|
+
#
|
25
|
+
# TODO Ask Matz
|
26
|
+
# See if Matz will accept it into core so we don't have to anymore.
|
27
|
+
#
|
28
|
+
# TODO Marshalling
|
29
|
+
# As with OpenStruct, marshalling is problematic at the moment.
|
30
|
+
#
|
31
|
+
#++
|
32
|
+
|
33
|
+
#:title: OpenStructable
|
34
|
+
#
|
35
|
+
# OpensStructable is a mixin module which can provide OpenStruct behavior to
|
36
|
+
# any class or object. OpenStructable allows extention of data objects
|
37
|
+
# with arbitrary attributes.
|
38
|
+
#
|
39
|
+
# == Usage
|
40
|
+
#
|
41
|
+
# require 'mega/ostructable'
|
42
|
+
#
|
43
|
+
# class Record
|
44
|
+
# include OpenStructable
|
45
|
+
# end
|
46
|
+
#
|
47
|
+
# record = Record.new
|
48
|
+
# record.name = "John Smith"
|
49
|
+
# record.age = 70
|
50
|
+
# record.pension = 300
|
51
|
+
#
|
52
|
+
# puts record.name # -> "John Smith"
|
53
|
+
# puts record.address # -> nil
|
54
|
+
#
|
55
|
+
# == Author(s)
|
56
|
+
#
|
57
|
+
# * Thomas Sawyer
|
58
|
+
# * Yukihiro Matsumoto
|
59
|
+
# * Gavin Sinclair (Documentation)
|
60
|
+
#
|
61
|
+
|
62
|
+
module OpenStructable
|
63
|
+
|
64
|
+
def initialize(hash=nil)
|
65
|
+
@__table__ = {}
|
66
|
+
if hash
|
67
|
+
for k,v in hash
|
68
|
+
@__table__[k.to_sym] = v
|
69
|
+
new_ostruct_member(k)
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
# duplicate an OpenStruct object members.
|
75
|
+
def initialize_copy(orig)
|
76
|
+
super
|
77
|
+
@__table__ = @__table__.dup
|
78
|
+
end
|
79
|
+
|
80
|
+
def marshal_dump
|
81
|
+
@table
|
82
|
+
end
|
83
|
+
def marshal_load(x)
|
84
|
+
@table = x
|
85
|
+
@table.each_key{|key| new_ostruct_member(key)}
|
86
|
+
end
|
87
|
+
|
88
|
+
def new_ostruct_member(name)
|
89
|
+
unless self.respond_to?(name)
|
90
|
+
self.instance_eval %{
|
91
|
+
def #{name}; @__table__[:#{name}]; end
|
92
|
+
def #{name}=(x); @__table__[:#{name}] = x; end
|
93
|
+
}
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
#
|
98
|
+
# Generate additional attributes and values.
|
99
|
+
#
|
100
|
+
def update(hash)
|
101
|
+
@__table__ ||= {}
|
102
|
+
if hash
|
103
|
+
for k,v in hash
|
104
|
+
@__table__[k.to_sym] = v
|
105
|
+
new_ostruct_member(k)
|
106
|
+
end
|
107
|
+
end
|
108
|
+
end
|
109
|
+
|
110
|
+
def method_missing(mid, *args) # :nodoc:
|
111
|
+
mname = mid.to_s
|
112
|
+
len = args.length
|
113
|
+
if mname =~ /=$/
|
114
|
+
if len != 1
|
115
|
+
raise ArgumentError, "wrong number of arguments (#{len} for 1)", caller(1)
|
116
|
+
end
|
117
|
+
if self.frozen?
|
118
|
+
raise TypeError, "can't modify frozen #{self.class}", caller(1)
|
119
|
+
end
|
120
|
+
mname.chop!
|
121
|
+
@__table__ ||= {}
|
122
|
+
@__table__[mname.intern] = args[0]
|
123
|
+
self.new_ostruct_member(mname)
|
124
|
+
elsif len == 0
|
125
|
+
@__table__ ||= {}
|
126
|
+
@__table__[mid]
|
127
|
+
else
|
128
|
+
raise NoMethodError, "undefined method `#{mname}' for #{self}", caller(1)
|
129
|
+
end
|
130
|
+
end
|
131
|
+
|
132
|
+
#
|
133
|
+
# Remove the named field from the object.
|
134
|
+
#
|
135
|
+
def delete_field(name)
|
136
|
+
@__table__ ||= {}
|
137
|
+
@__table__.delete name.to_sym
|
138
|
+
end
|
139
|
+
|
140
|
+
#
|
141
|
+
# Returns a string containing a detailed summary of the keys and values.
|
142
|
+
#
|
143
|
+
def inspect
|
144
|
+
str = "<#{self.class}"
|
145
|
+
for k,v in (@__table__ ||= {})
|
146
|
+
str << " #{k}=#{v.inspect}"
|
147
|
+
end
|
148
|
+
str << ">"
|
149
|
+
end
|
150
|
+
|
151
|
+
def __table__ # :nodoc:
|
152
|
+
@__table__ ||= {}
|
153
|
+
end
|
154
|
+
protected :__table__
|
155
|
+
|
156
|
+
# Compare this object and +other+ for equality.
|
157
|
+
def ==(other)
|
158
|
+
return false unless(other.kind_of?(OpenStruct))
|
159
|
+
return @__table__ == other.table
|
160
|
+
end
|
161
|
+
|
162
|
+
end
|
163
|
+
|
164
|
+
=begin
|
165
|
+
#
|
166
|
+
# It is possibe to implement OpenStruct itself with
|
167
|
+
# this OpenStructable module as follows:
|
168
|
+
#
|
169
|
+
class OpenStruct
|
170
|
+
include OpenStructable
|
171
|
+
end
|
172
|
+
=end
|
173
|
+
|
174
|
+
|
175
|
+
|
176
|
+
# _____ _
|
177
|
+
# |_ _|__ ___| |_
|
178
|
+
# | |/ _ \/ __| __|
|
179
|
+
# | | __/\__ \ |_
|
180
|
+
# |_|\___||___/\__|
|
181
|
+
#
|
182
|
+
|
183
|
+
=begin testing
|
184
|
+
|
185
|
+
require 'test/unit'
|
186
|
+
|
187
|
+
# fixture
|
188
|
+
|
189
|
+
class Record
|
190
|
+
include OpenStructable
|
191
|
+
end
|
192
|
+
|
193
|
+
# test
|
194
|
+
|
195
|
+
class TC_OpenStructable < Test::Unit::TestCase
|
196
|
+
|
197
|
+
def test_record
|
198
|
+
record = nil
|
199
|
+
assert_nothing_raised {
|
200
|
+
record = Record.new
|
201
|
+
record.name = "John Smith"
|
202
|
+
record.age = 70
|
203
|
+
record.pension = 300
|
204
|
+
}
|
205
|
+
assert_equal( "John Smith", record.name )
|
206
|
+
assert_equal( 70, record.age )
|
207
|
+
assert_equal( nil, record.address )
|
208
|
+
end
|
209
|
+
|
210
|
+
end
|
211
|
+
|
212
|
+
=end
|
data/lib/more/facets/pathlist.rb
CHANGED
@@ -0,0 +1,809 @@
|
|
1
|
+
#--
|
2
|
+
# SparseArray
|
3
|
+
#
|
4
|
+
# Copyright (c) 2004,2005 Thomas Sawyer
|
5
|
+
#
|
6
|
+
# Ruby License
|
7
|
+
#
|
8
|
+
# This module is free software. You may use, modify, and/or redistribute this
|
9
|
+
# software under the same terms as Ruby.
|
10
|
+
#
|
11
|
+
# This program is distributed in the hope that it will be useful, but WITHOUT
|
12
|
+
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
13
|
+
# FOR A PARTICULAR PURPOSE.
|
14
|
+
#
|
15
|
+
# == AUTHOR(s)
|
16
|
+
#
|
17
|
+
# * Thamas Sawyer
|
18
|
+
#
|
19
|
+
# ==========================================================================
|
20
|
+
# Revision History ::
|
21
|
+
# --------------------------------------------------------------------------
|
22
|
+
# 04.09 Trans * 99% Compatible with Array
|
23
|
+
# ==========================================================================
|
24
|
+
#++
|
25
|
+
|
26
|
+
#:title: SparseArray
|
27
|
+
#
|
28
|
+
# SparseArray is an implemenation of the Array class using only Hashes.
|
29
|
+
# Regular Arrays are never used except once to delegate the #pack method,
|
30
|
+
# and for *args parameters (since there is no way around those is some cases).
|
31
|
+
# SparseArray is for all practical purposes 100% compatible with Array.
|
32
|
+
#
|
33
|
+
# SparseArray is slower then the built in Array class, but not as slow
|
34
|
+
# as one might expect, since a Hash in general is faster than an Array.
|
35
|
+
# It might be interesting to see how this would perform if it were
|
36
|
+
# written in c. Not all that useful, but an interesting example.
|
37
|
+
#
|
38
|
+
class SparseArray < Hash
|
39
|
+
|
40
|
+
def self.[](*args)
|
41
|
+
nha = new
|
42
|
+
args.each { |a| nha.set(nha.length,a) }
|
43
|
+
nha
|
44
|
+
end
|
45
|
+
|
46
|
+
def self.new_h(hsh)
|
47
|
+
nha = new
|
48
|
+
nha.replace(hsh)
|
49
|
+
#nha.reindex!
|
50
|
+
end
|
51
|
+
|
52
|
+
def initialize(i=0,e=nil)
|
53
|
+
if i > 0
|
54
|
+
i.times { self.set(self.length,e) }
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
def &(ha)
|
59
|
+
nha = self.class.new
|
60
|
+
(0..self.length-1).each do |i|
|
61
|
+
if ha.has_value?(self.fetch(i)) and !nha.has_value?(self.fetch(i))
|
62
|
+
nha.set(nha.length,self.fetch(i))
|
63
|
+
end
|
64
|
+
end
|
65
|
+
nha
|
66
|
+
end
|
67
|
+
|
68
|
+
def *(j)
|
69
|
+
if j.kind_of?(String)
|
70
|
+
return self.join(j)
|
71
|
+
else
|
72
|
+
nha = self.class.new
|
73
|
+
j.times { (0...self.length).each { |i| nha.set(nha.length,self.fetch(i)) } }
|
74
|
+
return nha
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
def +(ha)
|
79
|
+
nha = self.dup
|
80
|
+
(0..ha.length-1).each { |i| nha.set(nha.length,ha.fetch(i)) }
|
81
|
+
nha
|
82
|
+
end
|
83
|
+
|
84
|
+
def -(ha)
|
85
|
+
nha = self.class.new
|
86
|
+
self.each { |v| nha << v if !ha.has_value?(v) }
|
87
|
+
#ha.each { |v| nha << i if !self.include?(v) }
|
88
|
+
nha
|
89
|
+
end
|
90
|
+
|
91
|
+
def <<(e)
|
92
|
+
self.set(self.length,e)
|
93
|
+
self
|
94
|
+
end
|
95
|
+
|
96
|
+
def <=>(ha)
|
97
|
+
(0..self.length-1).each do |i|
|
98
|
+
ieq = (self.fetch(i) <=> ha.fetch(i))
|
99
|
+
return ieq if ieq != 0
|
100
|
+
end
|
101
|
+
self.length <=> ha.length
|
102
|
+
end
|
103
|
+
|
104
|
+
def ===(ha)
|
105
|
+
self.==(ha)
|
106
|
+
end
|
107
|
+
|
108
|
+
alias_method :get, :[]
|
109
|
+
private :get
|
110
|
+
|
111
|
+
def [](i,l=nil)
|
112
|
+
if l
|
113
|
+
i = i...i+l
|
114
|
+
elsif ! i.kind_of?(Range)
|
115
|
+
return self.at(i)
|
116
|
+
end
|
117
|
+
nha = self.class.new
|
118
|
+
i.each { |j| nha.set(nha.length,get(j)) if has_key?(j) }
|
119
|
+
nha
|
120
|
+
end
|
121
|
+
|
122
|
+
alias set []=
|
123
|
+
def []=(i,b,c=nil)
|
124
|
+
if c
|
125
|
+
rng = (Integer(i)..Integer(i+b))
|
126
|
+
b = c
|
127
|
+
elsif i.kind_of? Range
|
128
|
+
rng = i
|
129
|
+
else
|
130
|
+
self.set(Integer(i),b)
|
131
|
+
return b
|
132
|
+
end
|
133
|
+
if b == nil
|
134
|
+
rng.each { |i| qdelete(i) }
|
135
|
+
self.reindex!
|
136
|
+
elsif b.kind_of?(Array) or b.kind_of?(self.class)
|
137
|
+
j = 0
|
138
|
+
rng.each { |i| self[i] = b[j]; j+=1 }
|
139
|
+
else
|
140
|
+
rng.each { |i| qdelete(i) }
|
141
|
+
self[rng.fist] = b
|
142
|
+
self.reindex!
|
143
|
+
end
|
144
|
+
end
|
145
|
+
|
146
|
+
def |(ha)
|
147
|
+
nha = self.dup
|
148
|
+
ha.each { |v| nha << v if !nha.has_value?(v) }
|
149
|
+
nha
|
150
|
+
end
|
151
|
+
|
152
|
+
def assoc(k)
|
153
|
+
(0...self.length).each { |i| return self.fetch(i) if self.fetch(i)[0] == k }
|
154
|
+
return nil
|
155
|
+
end
|
156
|
+
|
157
|
+
def at(i)
|
158
|
+
i = self.length + i if i <= -1
|
159
|
+
get(i)
|
160
|
+
#return nil if i < 0 or i >= self.length
|
161
|
+
#return self.fetch(i)
|
162
|
+
end
|
163
|
+
|
164
|
+
# clear okay
|
165
|
+
|
166
|
+
def collect
|
167
|
+
nha = self.class.new
|
168
|
+
(0...self.length).each { |i| nha << yield(self.fetch(i)) }
|
169
|
+
nha
|
170
|
+
end
|
171
|
+
|
172
|
+
def collect!
|
173
|
+
nha = self.class.new
|
174
|
+
(0...self.length).each { |i| nha << yield(self.fetch(i)) }
|
175
|
+
self.replace(nha)
|
176
|
+
end
|
177
|
+
|
178
|
+
def compact
|
179
|
+
nha, j = self.class.new, 0
|
180
|
+
(0..self.length-1).each do |i|
|
181
|
+
if self.fetch(i) != nil
|
182
|
+
nha.set(j,self.fetch(i))
|
183
|
+
j+=1
|
184
|
+
end
|
185
|
+
end
|
186
|
+
nha
|
187
|
+
end
|
188
|
+
|
189
|
+
def compact!
|
190
|
+
if self.has_value?(nil)
|
191
|
+
nha, j = self.class.new, 0
|
192
|
+
(0..self.length-1).each do |i|
|
193
|
+
if self.fetch(i) != nil
|
194
|
+
nha.set(j,self.fetch(i))
|
195
|
+
j+=1
|
196
|
+
end
|
197
|
+
end
|
198
|
+
return self.replace(nha)
|
199
|
+
else
|
200
|
+
return nil
|
201
|
+
end
|
202
|
+
end
|
203
|
+
|
204
|
+
def concat(ha)
|
205
|
+
(0...ha.length).each { |i| self.set(self.length,ha.fetch(i)) }
|
206
|
+
self
|
207
|
+
end
|
208
|
+
|
209
|
+
def count(e=nil)
|
210
|
+
if block_given?
|
211
|
+
cnt = 0
|
212
|
+
(0...self.length).each { |i| cnt += 1 if yield(self.fetch(i)) }
|
213
|
+
return cnt
|
214
|
+
else
|
215
|
+
cnt = 0
|
216
|
+
(0...self.length).each { |i| cnt += 1 if self.fetch(i) == e }
|
217
|
+
return cnt
|
218
|
+
end
|
219
|
+
end
|
220
|
+
|
221
|
+
alias qdelete delete
|
222
|
+
private :qdelete
|
223
|
+
|
224
|
+
def delete(e)
|
225
|
+
if has_value?(e)
|
226
|
+
qdelete_if { |i,v| v == e }
|
227
|
+
reindex!
|
228
|
+
return e
|
229
|
+
else
|
230
|
+
return yield if block_given?
|
231
|
+
return nil
|
232
|
+
end
|
233
|
+
end
|
234
|
+
|
235
|
+
def delete_at(i)
|
236
|
+
if self.has_key?(i)
|
237
|
+
e = self.fetch(i)
|
238
|
+
qdelete(i)
|
239
|
+
reindex!
|
240
|
+
return e
|
241
|
+
else
|
242
|
+
return nil
|
243
|
+
end
|
244
|
+
end
|
245
|
+
|
246
|
+
alias qdelete_if delete_if
|
247
|
+
private :qdelete_if
|
248
|
+
|
249
|
+
def delete_if
|
250
|
+
qdelete_if { |i,v| yield(v) }
|
251
|
+
reindex!
|
252
|
+
end
|
253
|
+
|
254
|
+
def each
|
255
|
+
(0...self.length).each { |i| yield(self.fetch(i)) }
|
256
|
+
end
|
257
|
+
|
258
|
+
def each_index
|
259
|
+
(0...self.length).each { |i| yield(i) }
|
260
|
+
end
|
261
|
+
|
262
|
+
# empty? okay as is
|
263
|
+
|
264
|
+
def eql?(ha)
|
265
|
+
return false if self.length != ha.length
|
266
|
+
return true if (0...self.length).all? { |i| self.fetch(i).eql?(ha.fetch(i)) }
|
267
|
+
return false
|
268
|
+
end
|
269
|
+
|
270
|
+
def fill(f,s=nil,l=nil)
|
271
|
+
if s.kind_of?(Range)
|
272
|
+
r = s
|
273
|
+
else
|
274
|
+
s = 0 if !s
|
275
|
+
l = self.length - s if !l
|
276
|
+
r = s...(s+l)
|
277
|
+
end
|
278
|
+
r.each{ |i| self.set(i,f) }
|
279
|
+
self
|
280
|
+
end
|
281
|
+
|
282
|
+
def first
|
283
|
+
return nil if self.empty?
|
284
|
+
self.fetch(0)
|
285
|
+
end
|
286
|
+
|
287
|
+
def flatten
|
288
|
+
nha = self.class.new
|
289
|
+
(0...self.length).each do |i|
|
290
|
+
sfi = self.fetch(i)
|
291
|
+
if sfi.kind_of?(self.class) or sfi.kind_of?(Array)
|
292
|
+
nha.concat(sfi.flatten)
|
293
|
+
else
|
294
|
+
nha.set(nha.length,sfi)
|
295
|
+
end
|
296
|
+
end
|
297
|
+
nha
|
298
|
+
end
|
299
|
+
|
300
|
+
def flatten!
|
301
|
+
return nil if !self.any? { |e| e.kind_of?(self.class) or e.kind_of?(Array) }
|
302
|
+
self.replace(self.flatten)
|
303
|
+
end
|
304
|
+
|
305
|
+
def include?(v)
|
306
|
+
self.has_value?(v)
|
307
|
+
end
|
308
|
+
|
309
|
+
# index okay
|
310
|
+
|
311
|
+
def join(sep='')
|
312
|
+
s = ''
|
313
|
+
(0...self.length).each { |i| s << "#{self.fetch(i)}#{sep}" }
|
314
|
+
return s.chomp(sep)
|
315
|
+
end
|
316
|
+
|
317
|
+
def last
|
318
|
+
self[self.length-1]
|
319
|
+
end
|
320
|
+
|
321
|
+
# length okay
|
322
|
+
|
323
|
+
alias map! collect!
|
324
|
+
|
325
|
+
def nitems
|
326
|
+
cnt = 0
|
327
|
+
(0...self.length).each { |i| cnt += 1 if self.fetch(i) != nil }
|
328
|
+
cnt
|
329
|
+
end
|
330
|
+
|
331
|
+
def pack(*args)
|
332
|
+
self.to_a.pack(*args)
|
333
|
+
end
|
334
|
+
|
335
|
+
def pop
|
336
|
+
self.delete_at(self.length-1)
|
337
|
+
end
|
338
|
+
|
339
|
+
def push(*e)
|
340
|
+
self.concat(e)
|
341
|
+
end
|
342
|
+
|
343
|
+
def rassoc(k)
|
344
|
+
(0...self.length).each { |i| return self.fetch(i) if self.fetch(i)[1] == k }
|
345
|
+
return nil
|
346
|
+
end
|
347
|
+
|
348
|
+
def reindex
|
349
|
+
nha, j, k, tl = self.class.new, 0, 0, self.length
|
350
|
+
while k < tl
|
351
|
+
if self.has_key?(j)
|
352
|
+
nha.set(k,self.fetch(j))
|
353
|
+
j+=1; k+=1
|
354
|
+
else
|
355
|
+
j+=1
|
356
|
+
end
|
357
|
+
end
|
358
|
+
nha
|
359
|
+
end
|
360
|
+
|
361
|
+
def reindex!
|
362
|
+
self.replace(self.reindex)
|
363
|
+
end
|
364
|
+
|
365
|
+
def reject!
|
366
|
+
chg=nil
|
367
|
+
qdelete_if { |i,v| r=yield(v); chg=true if r; r }
|
368
|
+
return nil if !chg
|
369
|
+
reindex!
|
370
|
+
end
|
371
|
+
|
372
|
+
#def replace(ha)
|
373
|
+
# if ha.length < self.length
|
374
|
+
# (ha.length..self.length-1).each { |i| self.delete(i) }
|
375
|
+
# (0..ha.length-1).each { |i| self.set(i,ha[i]) }
|
376
|
+
# end
|
377
|
+
#end
|
378
|
+
|
379
|
+
def reverse
|
380
|
+
nha = self.class.new
|
381
|
+
(0...self.length).each { |i| nha.set(self.length-1-i,self.fetch(i)) }
|
382
|
+
nha
|
383
|
+
end
|
384
|
+
|
385
|
+
def reverse!
|
386
|
+
(0...self.length/2).each do |i|
|
387
|
+
ri = self.length-1-i
|
388
|
+
tmp = self.fetch(ri)
|
389
|
+
self.set(ri,self.fetch(i))
|
390
|
+
self.set(i,tmp)
|
391
|
+
end
|
392
|
+
self
|
393
|
+
end
|
394
|
+
|
395
|
+
def reverse_each
|
396
|
+
i = self.length - 1
|
397
|
+
while i >= 0
|
398
|
+
yield(self.fetch(i))
|
399
|
+
i -= 1
|
400
|
+
end
|
401
|
+
end
|
402
|
+
|
403
|
+
def rindex(e)
|
404
|
+
i = self.length - 1
|
405
|
+
while i >= 0
|
406
|
+
return i if self.fetch(i) == e
|
407
|
+
i -= 1
|
408
|
+
end
|
409
|
+
return nil
|
410
|
+
end
|
411
|
+
|
412
|
+
def shift
|
413
|
+
e1 = self[0]
|
414
|
+
tl = self.length - 1
|
415
|
+
(1..tl).each { |i| self.set(i-1,self.fetch(i)) }
|
416
|
+
self.delete_at(tl)
|
417
|
+
e1
|
418
|
+
end
|
419
|
+
|
420
|
+
# size okay
|
421
|
+
|
422
|
+
def slice(*args)
|
423
|
+
self[*args]
|
424
|
+
end
|
425
|
+
|
426
|
+
def slice!(*args)
|
427
|
+
result = self[*args]
|
428
|
+
self[*args] = nil
|
429
|
+
result
|
430
|
+
end
|
431
|
+
|
432
|
+
def sort
|
433
|
+
raise "SparseArray does not currently support sorting with blocks" if block_given?
|
434
|
+
nha = self.dup
|
435
|
+
qsort(nha,0,nha.length-1)
|
436
|
+
end
|
437
|
+
|
438
|
+
def qsort(ha, l, r)
|
439
|
+
l_hold = l
|
440
|
+
r_hold = r
|
441
|
+
pivot = ha[l]
|
442
|
+
while l < r
|
443
|
+
r -= 1 while (ha[r] <=> pivot) >= 0 and l < r
|
444
|
+
if l != r
|
445
|
+
ha[l] = ha[r]
|
446
|
+
l += 1
|
447
|
+
end
|
448
|
+
l += 1 while (ha[l] <=> pivot) <= 0 and l < r
|
449
|
+
if l != r
|
450
|
+
ha[r] = ha[l]
|
451
|
+
r -= 1
|
452
|
+
end
|
453
|
+
end
|
454
|
+
ha[l] = pivot
|
455
|
+
pivot = l
|
456
|
+
l = l_hold
|
457
|
+
r = r_hold
|
458
|
+
qsort(ha,l,pivot-1) if l < pivot
|
459
|
+
qsort(ha,pivot+1,r) if r > pivot
|
460
|
+
ha
|
461
|
+
end
|
462
|
+
|
463
|
+
def sort!
|
464
|
+
raise "SparseArray does not currently support sorting with blocks" if block_given?
|
465
|
+
qsort(self,0,self.length-1)
|
466
|
+
end
|
467
|
+
|
468
|
+
def to_a
|
469
|
+
a = []
|
470
|
+
(0..self.length-1).each { |i| a << self.fetch(i) }
|
471
|
+
a
|
472
|
+
end
|
473
|
+
|
474
|
+
def to_ary
|
475
|
+
self
|
476
|
+
end
|
477
|
+
|
478
|
+
def to_h
|
479
|
+
h = Hash.new
|
480
|
+
self.each { |k,v| h[k] = v }
|
481
|
+
h
|
482
|
+
end
|
483
|
+
|
484
|
+
def to_s
|
485
|
+
self.join
|
486
|
+
end
|
487
|
+
|
488
|
+
def uniq
|
489
|
+
nha = self.class.new
|
490
|
+
(0..self.length-1).each do |i|
|
491
|
+
nha[nha.length] = self[i] if !nha.has_value?(self[i])
|
492
|
+
end
|
493
|
+
nha
|
494
|
+
end
|
495
|
+
|
496
|
+
def uniq!
|
497
|
+
j = 0
|
498
|
+
(1..self.length-1).each do |i|
|
499
|
+
if !self[0..j].has_value?(self[i])
|
500
|
+
self[j+1] = self[i]
|
501
|
+
j+=1
|
502
|
+
end
|
503
|
+
end
|
504
|
+
(j+1..self.length-1).each { |i| qdelete(i) }
|
505
|
+
end
|
506
|
+
|
507
|
+
def unshift(e)
|
508
|
+
i = self.length - 1
|
509
|
+
while i >= 0
|
510
|
+
self.set(i+1,self.fetch(i))
|
511
|
+
return i if self.fetch(i) == e
|
512
|
+
i -= 1
|
513
|
+
end
|
514
|
+
self.set(0,e)
|
515
|
+
self
|
516
|
+
end
|
517
|
+
|
518
|
+
def values_at(*ix)
|
519
|
+
nha = self.class.new
|
520
|
+
ix.each {|i| nha[nha.length] = self.at(i)}
|
521
|
+
nha
|
522
|
+
end
|
523
|
+
|
524
|
+
end
|
525
|
+
|
526
|
+
|
527
|
+
|
528
|
+
=begin test
|
529
|
+
|
530
|
+
# This is a mostly complete testcase for SparseArray.
|
531
|
+
# SparseArray is tested by comparison to standard Array.
|
532
|
+
|
533
|
+
require 'test/unit'
|
534
|
+
|
535
|
+
class TC_SparseArray < Test::Unit::TestCase
|
536
|
+
|
537
|
+
def aha(a)
|
538
|
+
return a, SparseArray[*a]
|
539
|
+
end
|
540
|
+
|
541
|
+
def test_conversions
|
542
|
+
a, ha = aha [1,3,'a',8,nil,[1]]
|
543
|
+
assert_equal(ha, ha.to_ary) # these need to be opposite
|
544
|
+
assert_equal(a, ha.to_a) #
|
545
|
+
assert_equal(a.to_s, ha.to_s)
|
546
|
+
end
|
547
|
+
|
548
|
+
def test_set_operations
|
549
|
+
a, ha = aha [1,3,5,8,9]
|
550
|
+
b, hb = aha [2,3,6,8,9]
|
551
|
+
assert_equal(a | b, (ha | hb).to_a)
|
552
|
+
assert_equal(a & b, (ha & hb).to_a)
|
553
|
+
assert_equal(a + b, (ha + hb).to_a)
|
554
|
+
assert_equal(a - b, (ha - hb).to_a)
|
555
|
+
end
|
556
|
+
|
557
|
+
def test_multiple
|
558
|
+
a, ha = aha [1,3]
|
559
|
+
assert_equal(a*3,(ha*3).to_a)
|
560
|
+
end
|
561
|
+
|
562
|
+
def test_assign
|
563
|
+
a, ha = aha [1,2,3,4]
|
564
|
+
a[1..2] = [8,9]
|
565
|
+
ha[1..2] = [8,9]
|
566
|
+
assert_equal(a, ha.to_a)
|
567
|
+
end
|
568
|
+
def test_assoc
|
569
|
+
a, ha = aha [[1,2],[3,4],[3,6]]
|
570
|
+
assert_equal(a.assoc(3), ha.assoc(3).to_a)
|
571
|
+
end
|
572
|
+
def test_at
|
573
|
+
a, ha = aha [4,5,6,6]
|
574
|
+
assert_equal(a.at(0), ha.at(0))
|
575
|
+
assert_equal(a.at(2), ha.at(2))
|
576
|
+
assert_equal(a.at(4), ha.at(4))
|
577
|
+
assert_equal(a.at(9), ha.at(9))
|
578
|
+
assert_equal(a.at(-1), ha.at(-1))
|
579
|
+
assert_equal(a.at(-3), ha.at(-3))
|
580
|
+
assert_equal(a.at(-4), ha.at(-4))
|
581
|
+
assert_equal(a.at(-5), ha.at(-5))
|
582
|
+
end
|
583
|
+
def test_collect
|
584
|
+
a, ha = aha [4,5,6,6]
|
585
|
+
assert_equal(a.collect{|e|e}, ha.collect{|e|e}.to_a)
|
586
|
+
assert_equal(a.collect!{|e|e}, ha.collect!{|e|e}.to_a)
|
587
|
+
assert_equal(a,ha.to_a)
|
588
|
+
end
|
589
|
+
def test_compact
|
590
|
+
a, ha = aha [4,nil,5,nil,6]
|
591
|
+
assert_equal(a.compact, ha.compact.to_a)
|
592
|
+
end
|
593
|
+
def test_concat
|
594
|
+
a, ha = aha [1,3,5,8,9]
|
595
|
+
b, hb = aha [2,3,6,8,9]
|
596
|
+
assert_equal(a.concat(b),ha.concat(hb).to_a)
|
597
|
+
end
|
598
|
+
def test_count
|
599
|
+
ha = SparseArray[9,3,9,5,nil,nil,9,3]
|
600
|
+
assert_equal(2,ha.count)
|
601
|
+
assert_equal(2,ha.count(3))
|
602
|
+
assert_equal(3,ha.count{|e|e==9})
|
603
|
+
end
|
604
|
+
def test_delete
|
605
|
+
a, ha = aha [1,3,5,8,9,'a','b','c','c','d']
|
606
|
+
# test delete
|
607
|
+
assert_equal(a.delete(1),ha.delete(1))
|
608
|
+
assert_equal(a,ha.to_a)
|
609
|
+
assert_equal(a.delete('a'),ha.delete('a'))
|
610
|
+
assert_equal(a,ha.to_a)
|
611
|
+
# test delete_at
|
612
|
+
assert_equal(a.delete_at(0),ha.delete_at(0))
|
613
|
+
assert_equal(a,ha.to_a)
|
614
|
+
# test delete_if
|
615
|
+
assert_equal(a.delete_if{|v|v=='c'},ha.delete_if{|v|v=='c'}.to_a)
|
616
|
+
assert_equal(a,ha.to_a)
|
617
|
+
end
|
618
|
+
def test_each
|
619
|
+
a, ha = aha [4,'a',nil,'b']
|
620
|
+
# test each
|
621
|
+
ca, cha = '', ''
|
622
|
+
a.each{|e| ca += e.to_s}
|
623
|
+
ha.each{|e| cha += e.to_s}
|
624
|
+
assert_equal(ca,cha)
|
625
|
+
assert_equal(a,ha.to_a)
|
626
|
+
# test each_index
|
627
|
+
ca, cha = '', ''
|
628
|
+
a.each_index{|i| ca += i.to_s}
|
629
|
+
ha.each_index{|i| cha += i.to_s}
|
630
|
+
assert_equal(ca,cha)
|
631
|
+
assert_equal(a,ha.to_a)
|
632
|
+
end
|
633
|
+
def test_eql?
|
634
|
+
a, ha = aha [4,'a',nil,'b']
|
635
|
+
b, hb = aha [4,'a',nil,'b']
|
636
|
+
assert_equal(a,b)
|
637
|
+
assert_equal(ha,hb)
|
638
|
+
assert_equal(a.eql?(b),ha.eql?(hb))
|
639
|
+
assert_equal(b.eql?(a),hb.eql?(ha))
|
640
|
+
assert(ha.eql?(hb))
|
641
|
+
assert(hb.eql?(ha))
|
642
|
+
end
|
643
|
+
def test_empty?
|
644
|
+
a, ha = aha []
|
645
|
+
assert_equal(a.empty?,ha.empty?)
|
646
|
+
a, ha = aha [1,2,3]
|
647
|
+
assert_equal(a.empty?,ha.empty?)
|
648
|
+
end
|
649
|
+
def test_fill
|
650
|
+
a, ha = aha ['a','b','c','d']
|
651
|
+
assert_equal(a.fill('x'),ha.fill('x').to_a)
|
652
|
+
assert_equal(a,ha.to_a)
|
653
|
+
assert_equal(a.fill('y',2,2),ha.fill('y',2,2).to_a)
|
654
|
+
assert_equal(a,ha.to_a)
|
655
|
+
assert_equal(a.fill('z',0..1),ha.fill('z',0..1).to_a)
|
656
|
+
assert_equal(a,ha.to_a)
|
657
|
+
end
|
658
|
+
def test_first
|
659
|
+
a, ha = aha [2,3,4]
|
660
|
+
assert_equal(a.first,ha.first)
|
661
|
+
end
|
662
|
+
def test_flatten
|
663
|
+
a, ha = aha [2,[3],'a',[[1,2],4],nil,5]
|
664
|
+
assert_equal(a.flatten,ha.flatten.to_a)
|
665
|
+
a, ha = aha [2,[3],'a',[[1,2],4],nil,5]
|
666
|
+
assert_equal(a.flatten!,ha.flatten!.to_a)
|
667
|
+
assert_equal(a,ha.to_a)
|
668
|
+
a, ha = aha [2,3,'a',nil,5]
|
669
|
+
assert_equal(a.flatten!,ha.flatten!)
|
670
|
+
end
|
671
|
+
def test_include?
|
672
|
+
a, ha = aha ['a','b','c','d']
|
673
|
+
assert_equal(a.include?('b'),ha.include?('b'))
|
674
|
+
assert_equal(a.include?('x'),ha.include?('x'))
|
675
|
+
end
|
676
|
+
def test_index
|
677
|
+
a, ha = aha ['a','b','b','c','d']
|
678
|
+
assert_equal(a.index('b'),ha.index('b'))
|
679
|
+
assert_equal(a.index('x'),ha.index('x'))
|
680
|
+
end
|
681
|
+
def test_join
|
682
|
+
a, ha = aha [2,3,4]
|
683
|
+
assert_equal(a.join,ha.join)
|
684
|
+
assert_equal(a.join(','),ha.join(','))
|
685
|
+
end
|
686
|
+
def test_last
|
687
|
+
a, ha = aha [2,3,4]
|
688
|
+
assert_equal(a.last,ha.last)
|
689
|
+
end
|
690
|
+
def test_length
|
691
|
+
a, ha = aha [2,3,4]
|
692
|
+
assert_equal(a.length,ha.length)
|
693
|
+
end
|
694
|
+
def test_map!
|
695
|
+
a, ha = aha [4,5,6,6]
|
696
|
+
assert_equal(a.map!{|e|e}, ha.map!{|e|e}.to_a)
|
697
|
+
assert_equal(a,ha.to_a)
|
698
|
+
end
|
699
|
+
def test_nitems
|
700
|
+
a, ha = aha [4,5,nil,6,nil]
|
701
|
+
assert_equal(a.nitems, ha.nitems)
|
702
|
+
end
|
703
|
+
def test_pop
|
704
|
+
a, ha = aha [4,5,nil,6,nil]
|
705
|
+
assert_equal(a.pop, ha.pop)
|
706
|
+
assert_equal(a, ha.to_a)
|
707
|
+
assert_equal(a.pop, ha.pop)
|
708
|
+
assert_equal(a, ha.to_a)
|
709
|
+
end
|
710
|
+
def test_push
|
711
|
+
a, ha = aha [4,5,nil,6,nil]
|
712
|
+
args = [1,2,3]
|
713
|
+
assert_equal(a.push(*args), ha.push(*args).to_a)
|
714
|
+
assert_equal(a, ha.to_a)
|
715
|
+
end
|
716
|
+
def test_rassoc
|
717
|
+
a, ha = aha [[1,2],[1,3],[1,3]]
|
718
|
+
assert_equal(a.rassoc(3), ha.rassoc(3).to_a)
|
719
|
+
end
|
720
|
+
def test_reject!
|
721
|
+
a, ha = aha ['a','b','c','c','d']
|
722
|
+
assert_equal(a.reject!{|v|v=='c'},ha.reject!{|v|v=='c'}.to_a)
|
723
|
+
assert_equal(a,ha.to_a)
|
724
|
+
assert_equal(a.reject!{|v|v=='x'},ha.reject!{|v|v=='x'})
|
725
|
+
assert_equal(a,ha.to_a)
|
726
|
+
end
|
727
|
+
def test_reverse
|
728
|
+
a, ha = aha ['a','b','c','c','d']
|
729
|
+
assert_equal(a.reverse,ha.reverse.to_a)
|
730
|
+
assert_equal(a.reverse!,ha.reverse!.to_a)
|
731
|
+
assert_equal(a,ha.to_a)
|
732
|
+
a, ha = aha [1,2,3,'a','b','c']
|
733
|
+
assert_equal(a.reverse!,ha.reverse!.to_a)
|
734
|
+
assert_equal(a,ha.to_a)
|
735
|
+
end
|
736
|
+
def test_reverse_each
|
737
|
+
a, ha = aha [4,'a',nil,'b']
|
738
|
+
# test each
|
739
|
+
ca, cha = '', ''
|
740
|
+
a.reverse_each{|e| ca += e.to_s}
|
741
|
+
ha.reverse_each{|e| cha += e.to_s}
|
742
|
+
assert_equal(ca,cha)
|
743
|
+
assert_equal(a,ha.to_a)
|
744
|
+
end
|
745
|
+
def test_rindex
|
746
|
+
a, ha = aha ['a','b','c','c','d']
|
747
|
+
assert_equal(a.rindex('c'),ha.rindex('c'))
|
748
|
+
assert_equal(a.rindex('x'),ha.rindex('x'))
|
749
|
+
end
|
750
|
+
def test_shift
|
751
|
+
a, ha = aha ['a','b','c','c','d']
|
752
|
+
assert_equal(a.shift,ha.shift)
|
753
|
+
assert_equal(a,ha.to_a)
|
754
|
+
end
|
755
|
+
|
756
|
+
def test_slice
|
757
|
+
a, ha = aha [1,2,3,4]
|
758
|
+
# test []
|
759
|
+
assert_equal(a[1], ha[1])
|
760
|
+
assert_equal(a[1..2], ha[1..2].to_a)
|
761
|
+
assert_equal(a[1...2], ha[1...2].to_a)
|
762
|
+
assert_equal(a[1..7], ha[1..7].to_a)
|
763
|
+
assert_equal(a[1,2], ha[1,2].to_a)
|
764
|
+
# test slice
|
765
|
+
assert_equal(a.slice(1), ha.slice(1))
|
766
|
+
assert_equal(a.slice(1..2), ha.slice(1..2).to_a)
|
767
|
+
assert_equal(a.slice(1...2), ha.slice(1...2).to_a)
|
768
|
+
assert_equal(a.slice(1...2), ha.slice(1...2).to_a)
|
769
|
+
assert_equal(a.slice(1,2), ha.slice(1,2).to_a)
|
770
|
+
# test slice!
|
771
|
+
assert_equal(a.slice!(1..2), ha.slice!(1..2).to_a)
|
772
|
+
assert_equal(a, ha.to_a)
|
773
|
+
end
|
774
|
+
|
775
|
+
def test_sort
|
776
|
+
a, ha = aha [1,2,3,4]
|
777
|
+
# test sort
|
778
|
+
assert_equal(a.sort, ha.sort.to_a)
|
779
|
+
#assert_equal(a.sort{|x,y| y<=>x}, ha.sort{|x,y| y<=>x}.to_a)
|
780
|
+
# test sort!
|
781
|
+
assert_equal(a.sort!, ha.sort!.to_a)
|
782
|
+
assert_equal(a, ha.to_a)
|
783
|
+
end
|
784
|
+
|
785
|
+
def test_uniq
|
786
|
+
a, ha = aha [1,1,2,3,3,4,5,6,6]
|
787
|
+
assert_equal(a.uniq, ha.uniq.to_a)
|
788
|
+
end
|
789
|
+
|
790
|
+
def test_uniq!
|
791
|
+
a, ha = aha [1,1,2,3,3,4,5,6,6]
|
792
|
+
a.uniq!; ha.uniq!
|
793
|
+
assert_equal(a, ha.to_a)
|
794
|
+
end
|
795
|
+
|
796
|
+
def test_values_at
|
797
|
+
a, ha = aha ['a','b','c','d']
|
798
|
+
assert_equal(a.values_at(1,3),ha.values_at(1,3).to_a)
|
799
|
+
end
|
800
|
+
|
801
|
+
def test_unshift
|
802
|
+
a, ha = aha ['a','b','c','c','d']
|
803
|
+
assert_equal(a.unshift('x'),ha.unshift('x').to_a)
|
804
|
+
assert_equal(a,ha.to_a)
|
805
|
+
end
|
806
|
+
end
|
807
|
+
|
808
|
+
=end
|
809
|
+
|