facets 2.5.2 → 2.6.0
Sign up to get free protection for your applications and to get access to all the features.
- data/HISTORY.rdoc +2245 -0
- data/MANIFEST +20 -725
- data/{README → README.rdoc} +0 -0
- data/RELEASE +37 -48
- data/doc/log/stats/index.html +39 -0
- data/doc/notes/CHANGES +2529 -0
- data/lib/{more → core}/facets/binding/opvars.rb +0 -0
- data/lib/core/facets/integer/length.rb +16 -0
- data/lib/core/facets/kernel/state.rb +50 -0
- data/lib/core/facets/module/extend.rb +2 -2
- data/lib/core/facets/string/camelcase.rb +33 -9
- data/lib/core/facets/string/lowercase.rb +1 -0
- data/lib/core/facets/string/methodize.rb +10 -1
- data/lib/core/facets/string/modulize.rb +8 -0
- data/lib/core/facets/string/pathize.rb +10 -0
- data/lib/core/facets/string/snakecase.rb +2 -2
- data/lib/core/facets/string/underscore.rb +21 -0
- data/lib/core/facets/string/uppercase.rb +23 -0
- data/lib/more/facets/censor.rb +97 -0
- data/lib/more/facets/minitar.rb +11 -11
- data/lib/more/facets/platform.rb +47 -0
- data/lib/more/facets/pry.rb +32 -0
- data/lib/more/facets/string/obfuscate.rb +65 -0
- data/lib/more/facets/string/stylize.rb +169 -0
- data/lib/more/facets/string/words.rb +10 -13
- data/meta/modified +1 -0
- data/meta/package +1 -0
- data/meta/version +1 -0
- data/test/core/integer/test_length.rb +12 -0
- metadata +41 -822
- data/CHANGES +0 -133
- data/VERSION +0 -1
- data/doc/changelogs/CHANGELOG-0.10.30 +0 -239
- data/doc/changelogs/CHANGELOG-1.8.54 +0 -450
- data/doc/changelogs/CHANGELOG-2.4.5 +0 -1654
- data/doc/rdoc/core/classes/Array.html +0 -1208
- data/doc/rdoc/core/classes/Binding.html +0 -364
- data/doc/rdoc/core/classes/Class.html +0 -444
- data/doc/rdoc/core/classes/Comparable.html +0 -250
- data/doc/rdoc/core/classes/Dir.html +0 -395
- data/doc/rdoc/core/classes/Enumerable.html +0 -1262
- data/doc/rdoc/core/classes/Enumerable/Enumerator.html +0 -243
- data/doc/rdoc/core/classes/Enumerator.html +0 -242
- data/doc/rdoc/core/classes/Exception.html +0 -163
- data/doc/rdoc/core/classes/FalseClass.html +0 -131
- data/doc/rdoc/core/classes/File.html +0 -576
- data/doc/rdoc/core/classes/FileTest.html +0 -116
- data/doc/rdoc/core/classes/Float.html +0 -159
- data/doc/rdoc/core/classes/Functor.html +0 -171
- data/doc/rdoc/core/classes/Hash.html +0 -2184
- data/doc/rdoc/core/classes/Indexable.html +0 -629
- data/doc/rdoc/core/classes/InstanceVariables.html +0 -306
- data/doc/rdoc/core/classes/Integer.html +0 -583
- data/doc/rdoc/core/classes/Kernel.html +0 -2269
- data/doc/rdoc/core/classes/Lazy.html +0 -96
- data/doc/rdoc/core/classes/Lazy/Future.html +0 -100
- data/doc/rdoc/core/classes/Lazy/Promise.html +0 -114
- data/doc/rdoc/core/classes/Lazy/PromiseSafe.html +0 -99
- data/doc/rdoc/core/classes/MatchData.html +0 -204
- data/doc/rdoc/core/classes/Module.html +0 -1316
- data/doc/rdoc/core/classes/NilClass.html +0 -217
- data/doc/rdoc/core/classes/Numeric.html +0 -251
- data/doc/rdoc/core/classes/Object.html +0 -161
- data/doc/rdoc/core/classes/ObjectSpace.html +0 -114
- data/doc/rdoc/core/classes/Proc.html +0 -302
- data/doc/rdoc/core/classes/Range.html +0 -360
- data/doc/rdoc/core/classes/Regexp.html +0 -191
- data/doc/rdoc/core/classes/Stackable.html +0 -262
- data/doc/rdoc/core/classes/String.html +0 -2332
- data/doc/rdoc/core/classes/Struct.html +0 -121
- data/doc/rdoc/core/classes/Symbol.html +0 -441
- data/doc/rdoc/core/classes/Time.html +0 -521
- data/doc/rdoc/core/classes/TrueClass.html +0 -131
- data/doc/rdoc/core/classes/UnboundMethod.html +0 -200
- data/doc/rdoc/core/created.rid +0 -1
- data/doc/rdoc/core/files/README.html +0 -287
- data/doc/rdoc/core/files/doc/README_core.html +0 -230
- data/doc/rdoc/core/files/lib/core/facets/array/combination_rb.html +0 -96
- data/doc/rdoc/core/files/lib/core/facets/array/conjoin_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/array/delete_rb.html +0 -101
- data/doc/rdoc/core/files/lib/core/facets/array/delete_unless_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/array/delete_values_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/array/index_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/array/indexable_rb.html +0 -97
- data/doc/rdoc/core/files/lib/core/facets/array/merge_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/array/not_empty_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/array/only_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/array/pad_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/array/permutation_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/array/product_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/array/recursively_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/array/rotate_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/array/select_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/array/splice_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/array/stackable_rb.html +0 -97
- data/doc/rdoc/core/files/lib/core/facets/array/traverse_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/array_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/binding/caller_rb.html +0 -97
- data/doc/rdoc/core/files/lib/core/facets/binding/callstack_rb.html +0 -96
- data/doc/rdoc/core/files/lib/core/facets/binding/defined_rb.html +0 -96
- data/doc/rdoc/core/files/lib/core/facets/binding/eval_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/binding/local_variables_rb.html +0 -96
- data/doc/rdoc/core/files/lib/core/facets/binding/self_rb.html +0 -96
- data/doc/rdoc/core/files/lib/core/facets/binding_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/bitmask_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/blank_rb.html +0 -97
- data/doc/rdoc/core/files/lib/core/facets/boolean_rb.html +0 -126
- data/doc/rdoc/core/files/lib/core/facets/cattr_rb.html +0 -100
- data/doc/rdoc/core/files/lib/core/facets/class/cattr_accessor_rb.html +0 -96
- data/doc/rdoc/core/files/lib/core/facets/class/cattr_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/class/cattr_reader_rb.html +0 -96
- data/doc/rdoc/core/files/lib/core/facets/class/cattr_writer_rb.html +0 -96
- data/doc/rdoc/core/files/lib/core/facets/class/descendents_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/class/methodize_rb.html +0 -96
- data/doc/rdoc/core/files/lib/core/facets/class/pathize_rb.html +0 -96
- data/doc/rdoc/core/files/lib/core/facets/class/prepend_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/class/subclasses_rb.html +0 -96
- data/doc/rdoc/core/files/lib/core/facets/class/to_proc_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/class_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/comparable/at_least_rb.html +0 -96
- data/doc/rdoc/core/files/lib/core/facets/comparable/at_most_rb.html +0 -96
- data/doc/rdoc/core/files/lib/core/facets/comparable/bound_rb.html +0 -96
- data/doc/rdoc/core/files/lib/core/facets/comparable/cap_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/comparable/clip_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/comparable/cmp_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/comparable/comparable_rb.html +0 -109
- data/doc/rdoc/core/files/lib/core/facets/comparable_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/dir/ascend_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/dir/descend_rb.html +0 -96
- data/doc/rdoc/core/files/lib/core/facets/dir/multiglob_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/dir/parent_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/dir/recurse_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/dir_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/enumerable/accumulate_rb.html +0 -96
- data/doc/rdoc/core/files/lib/core/facets/enumerable/cluster_by_rb.html +0 -96
- data/doc/rdoc/core/files/lib/core/facets/enumerable/collect_rb.html +0 -101
- data/doc/rdoc/core/files/lib/core/facets/enumerable/commonality_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/enumerable/compact_map_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/enumerable/count_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/enumerable/divide_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/enumerable/duplicates_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/enumerable/each_by_rb.html +0 -96
- data/doc/rdoc/core/files/lib/core/facets/enumerable/entropy_rb.html +0 -96
- data/doc/rdoc/core/files/lib/core/facets/enumerable/frequency_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/enumerable/graph_rb.html +0 -96
- data/doc/rdoc/core/files/lib/core/facets/enumerable/group_by_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/enumerable/inject_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/enumerable/map_send_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/enumerable/map_with_index_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/enumerable/mash_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/enumerable/mode_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/enumerable/modulate_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/enumerable/none_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/enumerable/occur_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/enumerable/one_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/enumerable/probability_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/enumerable/split_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/enumerable/sum_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/enumerable/take_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/enumerable/uniq_by_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/enumerable_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/exception/detail_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/exception/suppress_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/exception_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/file/append_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/file/create_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/file/null_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/file/read_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/file/rewrite_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/file/rootname_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/file/split_all_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/file/split_root_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/file/write_rb.html +0 -102
- data/doc/rdoc/core/files/lib/core/facets/file/writelines_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/file_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/filetest/root_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/filetest_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/float/round_rb.html +0 -96
- data/doc/rdoc/core/files/lib/core/facets/float_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/functor_rb.html +0 -151
- data/doc/rdoc/core/files/lib/core/facets/hash/alias_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/hash/argumentize_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/hash/at_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/hash/autonew_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/hash/collate_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/hash/dearray_values_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/hash/delete_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/hash/diff_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/hash/except_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/hash/group_by_value_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/hash/insert_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/hash/inverse_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/hash/join_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/hash/keys_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/hash/mash_rb.html +0 -96
- data/doc/rdoc/core/files/lib/core/facets/hash/merge_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/hash/new_with_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/hash/op_add_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/hash/op_and_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/hash/op_mul_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/hash/op_or_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/hash/op_push_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/hash/op_rb.html +0 -101
- data/doc/rdoc/core/files/lib/core/facets/hash/op_sub_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/hash/recursive_merge_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/hash/recursively_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/hash/rekey_rb.html +0 -96
- data/doc/rdoc/core/files/lib/core/facets/hash/replace_each_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/hash/select_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/hash/slice_rb.html +0 -96
- data/doc/rdoc/core/files/lib/core/facets/hash/stringify_keys_rb.html +0 -96
- data/doc/rdoc/core/files/lib/core/facets/hash/swap_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/hash/symbolize_keys_rb.html +0 -96
- data/doc/rdoc/core/files/lib/core/facets/hash/to_h_rb.html +0 -96
- data/doc/rdoc/core/files/lib/core/facets/hash/to_options_rb.html +0 -96
- data/doc/rdoc/core/files/lib/core/facets/hash/to_proc_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/hash/to_struct_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/hash/traverse_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/hash/update_each_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/hash/update_keys_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/hash/update_rb.html +0 -103
- data/doc/rdoc/core/files/lib/core/facets/hash/update_values_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/hash/weave_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/hash/zipnew_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/hash_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/indexable_rb.html +0 -113
- data/doc/rdoc/core/files/lib/core/facets/integer/even_rb.html +0 -96
- data/doc/rdoc/core/files/lib/core/facets/integer/factorial_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/integer/multiple_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/integer/odd_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/integer/of_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/integer/ordinal_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/integer_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/kernel/__callee___rb.html +0 -96
- data/doc/rdoc/core/files/lib/core/facets/kernel/__class___rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/kernel/__dir___rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/kernel/__get___rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/kernel/__here___rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/kernel/__method___rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/kernel/__set___rb.html +0 -96
- data/doc/rdoc/core/files/lib/core/facets/kernel/as_rb.html +0 -96
- data/doc/rdoc/core/files/lib/core/facets/kernel/ask_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/kernel/attr_singleton_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/kernel/callstack_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/kernel/complete_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/kernel/constant_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/kernel/d_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/kernel/deep_copy_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/kernel/demo_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/kernel/ergo_rb.html +0 -96
- data/doc/rdoc/core/files/lib/core/facets/kernel/here_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/kernel/in_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/kernel/instance_assign_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/kernel/instance_class_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/kernel/instance_exec_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/kernel/instance_rb.html +0 -96
- data/doc/rdoc/core/files/lib/core/facets/kernel/instance_send_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/kernel/instance_variables_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/kernel/maybe_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/kernel/not_nil_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/kernel/object_class_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/kernel/object_hexid_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/kernel/object_send_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/kernel/p_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/kernel/populate_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/kernel/qua_class_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/kernel/require_all_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/kernel/require_local_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/kernel/resc_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/kernel/respond_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/kernel/returning_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/kernel/silence_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/kernel/singleton_class_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/kernel/tap_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/kernel/try_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/kernel/val_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/kernel/with_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/kernel_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/lazy_rb.html +0 -120
- data/doc/rdoc/core/files/lib/core/facets/matchdata/match_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/matchdata/matchset_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/matchdata_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/metaid_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/module/abstract_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/module/alias_accessor_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/module/alias_method_chain_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/module/alias_module_function_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/module/ancestor_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/module/basename_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/module/can_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/module/class_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/module/conflict_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/module/extend_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/module/include_function_module_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/module/instance_methods_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/module/integrate_rb.html +0 -96
- data/doc/rdoc/core/files/lib/core/facets/module/is_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/module/methodize_rb.html +0 -96
- data/doc/rdoc/core/files/lib/core/facets/module/modspace_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/module/module_load_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/module/nesting_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/module/op_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/module/pathize_rb.html +0 -96
- data/doc/rdoc/core/files/lib/core/facets/module/prepend_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/module/redefine_method_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/module/redirect_method_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/module/rename_method_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/module/revise_rb.html +0 -99
- data/doc/rdoc/core/files/lib/core/facets/module/spacename_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/module/wrap_method_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/module_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/nilclass/ergo_rb.html +0 -96
- data/doc/rdoc/core/files/lib/core/facets/nilclass/to_f_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/nilclass_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/numeric/approx_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/numeric/distance_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/numeric/round_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/numeric_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/objectspace/classes_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/objectspace_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/proc/bind_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/proc/compose_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/proc/curry_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/proc/to_method_rb.html +0 -96
- data/doc/rdoc/core/files/lib/core/facets/proc/update_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/proc_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/range/combine_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/range/overlap_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/range/to_r_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/range/umbrella_rb.html +0 -96
- data/doc/rdoc/core/files/lib/core/facets/range/within_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/range_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/regexp/arity_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/regexp/to_re_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/regexp_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/stackable_rb.html +0 -120
- data/doc/rdoc/core/files/lib/core/facets/string/align_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/string/bracket_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/string/bytes_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/string/camelcase_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/string/capitalized_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/string/chars_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/string/chomp_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/string/cleave_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/string/compress_lines_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/string/contains_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/string/divide_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/string/each_char_rb.html +0 -96
- data/doc/rdoc/core/files/lib/core/facets/string/each_word_rb.html +0 -96
- data/doc/rdoc/core/files/lib/core/facets/string/end_with_rb.html +0 -96
- data/doc/rdoc/core/files/lib/core/facets/string/expand_tab_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/string/file_rb.html +0 -96
- data/doc/rdoc/core/files/lib/core/facets/string/fold_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/string/indent_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/string/interpolate_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/string/line_wrap_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/string/lines_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/string/margin_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/string/methodize_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/string/modulize_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/string/mscan_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/string/natcmp_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/string/nchar_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/string/op_sub_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/string/outdent_rb.html +0 -96
- data/doc/rdoc/core/files/lib/core/facets/string/pathize_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/string/range_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/string/rewrite_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/string/shatter_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/string/snakecase_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/string/splice_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/string/start_with_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/string/subtract_rb.html +0 -100
- data/doc/rdoc/core/files/lib/core/facets/string/tab_rb.html +0 -99
- data/doc/rdoc/core/files/lib/core/facets/string/tabto_rb.html +0 -96
- data/doc/rdoc/core/files/lib/core/facets/string/titlecase_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/string/to_re_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/string/variablize_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/string/word_wrap_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/string/words_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/string/xor_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/string_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/struct/attributes_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/struct_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/symbol/chomp_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/symbol/generate_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/symbol/not_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/symbol/plain_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/symbol/query_rb.html +0 -96
- data/doc/rdoc/core/files/lib/core/facets/symbol/re_s_rb.html +0 -96
- data/doc/rdoc/core/files/lib/core/facets/symbol/setter_rb.html +0 -96
- data/doc/rdoc/core/files/lib/core/facets/symbol/succ_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/symbol/to_proc_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/symbol/variablize_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/symbol_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/time/advance_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/time/ago_rb.html +0 -96
- data/doc/rdoc/core/files/lib/core/facets/time/change_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/time/elapse_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/time/hence_rb.html +0 -96
- data/doc/rdoc/core/files/lib/core/facets/time/round_rb.html +0 -96
- data/doc/rdoc/core/files/lib/core/facets/time/set_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/time/stamp_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/time/to_time_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/time/trunc_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/time_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/to_hash_rb.html +0 -97
- data/doc/rdoc/core/files/lib/core/facets/unboundmethod/arguments_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/unboundmethod/name_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/unboundmethod_rb.html +0 -92
- data/doc/rdoc/core/fr_class_index.html +0 -85
- data/doc/rdoc/core/fr_file_index.html +0 -381
- data/doc/rdoc/core/fr_method_index.html +0 -520
- data/doc/rdoc/core/index.html +0 -26
- data/doc/rdoc/core/rdoc-style.css +0 -177
- data/doc/rdoc/more/classes/ANSICode.html +0 -493
- data/doc/rdoc/more/classes/Advisable.html +0 -269
- data/doc/rdoc/more/classes/Advisable/Method.html +0 -223
- data/doc/rdoc/more/classes/Archive.html +0 -89
- data/doc/rdoc/more/classes/Archive/Tar.html +0 -89
- data/doc/rdoc/more/classes/Archive/Tar/Minitar.html +0 -469
- data/doc/rdoc/more/classes/Archive/Tar/Minitar/Input.html +0 -355
- data/doc/rdoc/more/classes/Archive/Tar/Minitar/Output.html +0 -216
- data/doc/rdoc/more/classes/Archive/Tar/Minitar/Reader.html +0 -283
- data/doc/rdoc/more/classes/Archive/Tar/Minitar/Writer.html +0 -378
- data/doc/rdoc/more/classes/Argvector.html +0 -487
- data/doc/rdoc/more/classes/Association.html +0 -319
- data/doc/rdoc/more/classes/Association/Kernel.html +0 -131
- data/doc/rdoc/more/classes/Autoarray.html +0 -166
- data/doc/rdoc/more/classes/BBCode.html +0 -532
- data/doc/rdoc/more/classes/BaseX.html +0 -194
- data/doc/rdoc/more/classes/BiCrypt.html +0 -541
- data/doc/rdoc/more/classes/BinReadable.html +0 -485
- data/doc/rdoc/more/classes/BinReadable/ByteOrder.html +0 -223
- data/doc/rdoc/more/classes/Binding.html +0 -146
- data/doc/rdoc/more/classes/BlankSlate.html +0 -129
- data/doc/rdoc/more/classes/Buildable.html +0 -152
- data/doc/rdoc/more/classes/BuildingBlock.html +0 -360
- data/doc/rdoc/more/classes/Capsule.html +0 -408
- data/doc/rdoc/more/classes/Capsule/MissingFile.html +0 -96
- data/doc/rdoc/more/classes/Cloneable.html +0 -129
- data/doc/rdoc/more/classes/ConsoleUtils.html +0 -238
- data/doc/rdoc/more/classes/Coroutine.html +0 -285
- data/doc/rdoc/more/classes/Crypt.html +0 -275
- data/doc/rdoc/more/classes/CssFilter.html +0 -471
- data/doc/rdoc/more/classes/CssTree.html +0 -149
- data/doc/rdoc/more/classes/Dictionary.html +0 -1255
- data/doc/rdoc/more/classes/Downloader.html +0 -512
- data/doc/rdoc/more/classes/Duration.html +0 -691
- data/doc/rdoc/more/classes/Duration/Numeric.html +0 -389
- data/doc/rdoc/more/classes/Duration/Time.html +0 -124
- data/doc/rdoc/more/classes/Enumerable.html +0 -401
- data/doc/rdoc/more/classes/Enumerable/Elementor.html +0 -170
- data/doc/rdoc/more/classes/Enumerable/Enumerator.html +0 -116
- data/doc/rdoc/more/classes/Enumerable/Filterable.html +0 -246
- data/doc/rdoc/more/classes/EnumerablePass.html +0 -214
- data/doc/rdoc/more/classes/Enumerator.html +0 -95
- data/doc/rdoc/more/classes/Enumerator/Filter.html +0 -104
- data/doc/rdoc/more/classes/Equatable.html +0 -188
- data/doc/rdoc/more/classes/Expirable.html +0 -195
- data/doc/rdoc/more/classes/FileList.html +0 -955
- data/doc/rdoc/more/classes/Fileable.html +0 -178
- data/doc/rdoc/more/classes/Fileable/DSL.html +0 -303
- data/doc/rdoc/more/classes/Hash.html +0 -171
- data/doc/rdoc/more/classes/Hash2Xml.html +0 -105
- data/doc/rdoc/more/classes/Hook.html +0 -162
- data/doc/rdoc/more/classes/HtmlFilter.html +0 -329
- data/doc/rdoc/more/classes/IORedirect.html +0 -220
- data/doc/rdoc/more/classes/InfinityClass.html +0 -448
- data/doc/rdoc/more/classes/InfinityClass/Numeric.html +0 -195
- data/doc/rdoc/more/classes/Ini.html +0 -447
- data/doc/rdoc/more/classes/Instantiable.html +0 -140
- data/doc/rdoc/more/classes/Instantize.html +0 -160
- data/doc/rdoc/more/classes/Interval.html +0 -877
- data/doc/rdoc/more/classes/It.html +0 -185
- data/doc/rdoc/more/classes/LRUCache.html +0 -321
- data/doc/rdoc/more/classes/LRUCache/Item.html +0 -114
- data/doc/rdoc/more/classes/LRUCache/Sentinel.html +0 -100
- data/doc/rdoc/more/classes/LinkedList.html +0 -432
- data/doc/rdoc/more/classes/LinkedList/Node.html +0 -149
- data/doc/rdoc/more/classes/Matcher.html +0 -335
- data/doc/rdoc/more/classes/Matcher/MatchData.html +0 -115
- data/doc/rdoc/more/classes/Memoizer.html +0 -240
- data/doc/rdoc/more/classes/MissingArgument.html +0 -97
- data/doc/rdoc/more/classes/Module.html +0 -1224
- data/doc/rdoc/more/classes/Multiton.html +0 -205
- data/doc/rdoc/more/classes/Multiton/Inclusive.html +0 -93
- data/doc/rdoc/more/classes/Multiton/MetaMethods.html +0 -221
- data/doc/rdoc/more/classes/NackClass.html +0 -98
- data/doc/rdoc/more/classes/Net.html +0 -88
- data/doc/rdoc/more/classes/Net/SMTP.html +0 -140
- data/doc/rdoc/more/classes/NullClass.html +0 -202
- data/doc/rdoc/more/classes/Numeric/Multipliers.html +0 -456
- data/doc/rdoc/more/classes/ObjectReflection.html +0 -172
- data/doc/rdoc/more/classes/OpEsc.html +0 -137
- data/doc/rdoc/more/classes/OpenCascade.html +0 -179
- data/doc/rdoc/more/classes/OpenCollection.html +0 -138
- data/doc/rdoc/more/classes/OpenHash.html +0 -157
- data/doc/rdoc/more/classes/OpenModule.html +0 -135
- data/doc/rdoc/more/classes/OpenObject.html +0 -608
- data/doc/rdoc/more/classes/OpenStructable.html +0 -326
- data/doc/rdoc/more/classes/PQueue.html +0 -607
- data/doc/rdoc/more/classes/Paramix.html +0 -201
- data/doc/rdoc/more/classes/Paramix/Delegator.html +0 -215
- data/doc/rdoc/more/classes/PathList.html +0 -159
- data/doc/rdoc/more/classes/PathList/Finder.html +0 -135
- data/doc/rdoc/more/classes/Platform.html +0 -444
- data/doc/rdoc/more/classes/Pool.html +0 -204
- data/doc/rdoc/more/classes/Proc.html +0 -180
- data/doc/rdoc/more/classes/ProgressBar.html +0 -356
- data/doc/rdoc/more/classes/Prototype.html +0 -243
- data/doc/rdoc/more/classes/RWDelegator.html +0 -194
- data/doc/rdoc/more/classes/Random.html +0 -145
- data/doc/rdoc/more/classes/Random/Array.html +0 -339
- data/doc/rdoc/more/classes/Random/Hash.html +0 -378
- data/doc/rdoc/more/classes/Random/Object.html +0 -119
- data/doc/rdoc/more/classes/Random/String.html +0 -299
- data/doc/rdoc/more/classes/Random/String/Self.html +0 -153
- data/doc/rdoc/more/classes/Recorder.html +0 -203
- data/doc/rdoc/more/classes/Reference.html +0 -196
- data/doc/rdoc/more/classes/Registerable.html +0 -157
- data/doc/rdoc/more/classes/Semaphore.html +0 -260
- data/doc/rdoc/more/classes/Settings.html +0 -288
- data/doc/rdoc/more/classes/Settings/Setting.html +0 -223
- data/doc/rdoc/more/classes/Settings/SettingCollection.html +0 -144
- data/doc/rdoc/more/classes/SimpleStringIO.html +0 -135
- data/doc/rdoc/more/classes/Snapshot.html +0 -194
- data/doc/rdoc/more/classes/Snapshot/ValueHolder.html +0 -163
- data/doc/rdoc/more/classes/SparseArray.html +0 -1397
- data/doc/rdoc/more/classes/Stash.html +0 -232
- data/doc/rdoc/more/classes/String/Mask.html +0 -555
- data/doc/rdoc/more/classes/String/Words.html +0 -328
- data/doc/rdoc/more/classes/Struct.html +0 -130
- data/doc/rdoc/more/classes/SyncArray.html +0 -127
- data/doc/rdoc/more/classes/SyncHash.html +0 -158
- data/doc/rdoc/more/classes/SyncHash/Delegator.html +0 -211
- data/doc/rdoc/more/classes/SyncHash/Inheritor.html +0 -211
- data/doc/rdoc/more/classes/System.html +0 -1117
- data/doc/rdoc/more/classes/Timer.html +0 -464
- data/doc/rdoc/more/classes/Timer/Dummy.html +0 -139
- data/doc/rdoc/more/classes/TracePoint.html +0 -455
- data/doc/rdoc/more/classes/Tuple.html +0 -900
- data/doc/rdoc/more/classes/TypeCast.html +0 -158
- data/doc/rdoc/more/classes/TypeCast/Class.html +0 -127
- data/doc/rdoc/more/classes/TypeCast/Object.html +0 -117
- data/doc/rdoc/more/classes/TypeCastException.html +0 -96
- data/doc/rdoc/more/classes/Uninheritable.html +0 -120
- data/doc/rdoc/more/classes/VersionNumber.html +0 -408
- data/doc/rdoc/more/classes/X.html +0 -117
- data/doc/rdoc/more/classes/XOXO.html +0 -189
- data/doc/rdoc/more/classes/ZipUtils.html +0 -568
- data/doc/rdoc/more/classes/ZipUtils/DryRun.html +0 -391
- data/doc/rdoc/more/classes/ZipUtils/NoWrite.html +0 -391
- data/doc/rdoc/more/classes/ZipUtils/Verbose.html +0 -361
- data/doc/rdoc/more/created.rid +0 -1
- data/doc/rdoc/more/files/README.html +0 -286
- data/doc/rdoc/more/files/doc/README_more.html +0 -141
- data/doc/rdoc/more/files/lib/more/facets/1stclassmethod_rb.html +0 -181
- data/doc/rdoc/more/files/lib/more/facets/advisable_rb.html +0 -124
- data/doc/rdoc/more/files/lib/more/facets/ansicode_rb.html +0 -200
- data/doc/rdoc/more/files/lib/more/facets/argvector_rb.html +0 -142
- data/doc/rdoc/more/files/lib/more/facets/association_rb.html +0 -158
- data/doc/rdoc/more/files/lib/more/facets/attr_rb.html +0 -92
- data/doc/rdoc/more/files/lib/more/facets/autoarray_rb.html +0 -125
- data/doc/rdoc/more/files/lib/more/facets/autoreload_rb.html +0 -134
- data/doc/rdoc/more/files/lib/more/facets/basex_rb.html +0 -92
- data/doc/rdoc/more/files/lib/more/facets/bbcode_rb.html +0 -138
- data/doc/rdoc/more/files/lib/more/facets/bicrypt_rb.html +0 -124
- data/doc/rdoc/more/files/lib/more/facets/binding/opvars_rb.html +0 -96
- data/doc/rdoc/more/files/lib/more/facets/binreadable_rb.html +0 -141
- data/doc/rdoc/more/files/lib/more/facets/blankslate_rb.html +0 -92
- data/doc/rdoc/more/files/lib/more/facets/buildable_rb.html +0 -230
- data/doc/rdoc/more/files/lib/more/facets/capsule_rb.html +0 -143
- data/doc/rdoc/more/files/lib/more/facets/class_extension_rb.html +0 -155
- data/doc/rdoc/more/files/lib/more/facets/classmethods_rb.html +0 -213
- data/doc/rdoc/more/files/lib/more/facets/cloneable_rb.html +0 -134
- data/doc/rdoc/more/files/lib/more/facets/consoleutils_rb.html +0 -92
- data/doc/rdoc/more/files/lib/more/facets/coroutine_rb.html +0 -163
- data/doc/rdoc/more/files/lib/more/facets/crypt_rb.html +0 -141
- data/doc/rdoc/more/files/lib/more/facets/cssfilter_rb.html +0 -121
- data/doc/rdoc/more/files/lib/more/facets/daemonize_rb.html +0 -118
- data/doc/rdoc/more/files/lib/more/facets/dependency_rb.html +0 -158
- data/doc/rdoc/more/files/lib/more/facets/dictionary_rb.html +0 -201
- data/doc/rdoc/more/files/lib/more/facets/downloader_rb.html +0 -137
- data/doc/rdoc/more/files/lib/more/facets/duplicable_rb.html +0 -100
- data/doc/rdoc/more/files/lib/more/facets/duration_rb.html +0 -92
- data/doc/rdoc/more/files/lib/more/facets/elementor_rb.html +0 -149
- data/doc/rdoc/more/files/lib/more/facets/elementwise_rb.html +0 -96
- data/doc/rdoc/more/files/lib/more/facets/enumerablepass_rb.html +0 -154
- data/doc/rdoc/more/files/lib/more/facets/equatable_rb.html +0 -146
- data/doc/rdoc/more/files/lib/more/facets/expirable_rb.html +0 -116
- data/doc/rdoc/more/files/lib/more/facets/fileable_rb.html +0 -138
- data/doc/rdoc/more/files/lib/more/facets/filelist_rb.html +0 -165
- data/doc/rdoc/more/files/lib/more/facets/filter_rb.html +0 -97
- data/doc/rdoc/more/files/lib/more/facets/heap_rb.html +0 -132
- data/doc/rdoc/more/files/lib/more/facets/hook_rb.html +0 -96
- data/doc/rdoc/more/files/lib/more/facets/htmlfilter_rb.html +0 -153
- data/doc/rdoc/more/files/lib/more/facets/infinity_rb.html +0 -153
- data/doc/rdoc/more/files/lib/more/facets/inheritor_rb.html +0 -124
- data/doc/rdoc/more/files/lib/more/facets/ini_rb.html +0 -105
- data/doc/rdoc/more/files/lib/more/facets/instantiable_rb.html +0 -119
- data/doc/rdoc/more/files/lib/more/facets/instantise_rb.html +0 -96
- data/doc/rdoc/more/files/lib/more/facets/instantize_rb.html +0 -160
- data/doc/rdoc/more/files/lib/more/facets/interval_rb.html +0 -163
- data/doc/rdoc/more/files/lib/more/facets/ioredirect_rb.html +0 -133
- data/doc/rdoc/more/files/lib/more/facets/iteration_rb.html +0 -94
- data/doc/rdoc/more/files/lib/more/facets/kernel/meta_rb.html +0 -96
- data/doc/rdoc/more/files/lib/more/facets/linkedlist_rb.html +0 -159
- data/doc/rdoc/more/files/lib/more/facets/lrucache_rb.html +0 -129
- data/doc/rdoc/more/files/lib/more/facets/main_rb.html +0 -126
- data/doc/rdoc/more/files/lib/more/facets/matcher_rb.html +0 -97
- data/doc/rdoc/more/files/lib/more/facets/memoize_rb.html +0 -164
- data/doc/rdoc/more/files/lib/more/facets/memoizer_rb.html +0 -152
- data/doc/rdoc/more/files/lib/more/facets/methodspace_rb.html +0 -138
- data/doc/rdoc/more/files/lib/more/facets/minitar_rb.html +0 -203
- data/doc/rdoc/more/files/lib/more/facets/multipliers_rb.html +0 -132
- data/doc/rdoc/more/files/lib/more/facets/multiton_rb.html +0 -187
- data/doc/rdoc/more/files/lib/more/facets/nackclass_rb.html +0 -120
- data/doc/rdoc/more/files/lib/more/facets/net/smtp_tls_rb.html +0 -143
- data/doc/rdoc/more/files/lib/more/facets/nilstatus_rb.html +0 -92
- data/doc/rdoc/more/files/lib/more/facets/nullclass_rb.html +0 -122
- data/doc/rdoc/more/files/lib/more/facets/opencascade_rb.html +0 -114
- data/doc/rdoc/more/files/lib/more/facets/opencollection_rb.html +0 -123
- data/doc/rdoc/more/files/lib/more/facets/openhash_rb.html +0 -107
- data/doc/rdoc/more/files/lib/more/facets/openmodule_rb.html +0 -92
- data/doc/rdoc/more/files/lib/more/facets/openobject_rb.html +0 -169
- data/doc/rdoc/more/files/lib/more/facets/opesc_rb.html +0 -94
- data/doc/rdoc/more/files/lib/more/facets/orderedhash_rb.html +0 -143
- data/doc/rdoc/more/files/lib/more/facets/ostructable_rb.html +0 -92
- data/doc/rdoc/more/files/lib/more/facets/overload_rb.html +0 -119
- data/doc/rdoc/more/files/lib/more/facets/paramix_rb.html +0 -135
- data/doc/rdoc/more/files/lib/more/facets/partial_rb.html +0 -124
- data/doc/rdoc/more/files/lib/more/facets/pathlist_rb.html +0 -133
- data/doc/rdoc/more/files/lib/more/facets/platform_rb.html +0 -103
- data/doc/rdoc/more/files/lib/more/facets/pool_rb.html +0 -131
- data/doc/rdoc/more/files/lib/more/facets/pqueue_rb.html +0 -128
- data/doc/rdoc/more/files/lib/more/facets/progressbar_rb.html +0 -126
- data/doc/rdoc/more/files/lib/more/facets/prototype_rb.html +0 -102
- data/doc/rdoc/more/files/lib/more/facets/random_rb.html +0 -149
- data/doc/rdoc/more/files/lib/more/facets/rbsystem_rb.html +0 -144
- data/doc/rdoc/more/files/lib/more/facets/recorder_rb.html +0 -154
- data/doc/rdoc/more/files/lib/more/facets/reference_rb.html +0 -130
- data/doc/rdoc/more/files/lib/more/facets/reflection_rb.html +0 -134
- data/doc/rdoc/more/files/lib/more/facets/registerable_rb.html +0 -98
- data/doc/rdoc/more/files/lib/more/facets/rwdelegator_rb.html +0 -122
- data/doc/rdoc/more/files/lib/more/facets/semaphore_rb.html +0 -120
- data/doc/rdoc/more/files/lib/more/facets/settings_rb.html +0 -141
- data/doc/rdoc/more/files/lib/more/facets/snapshot_rb.html +0 -177
- data/doc/rdoc/more/files/lib/more/facets/sparse_array_rb.html +0 -92
- data/doc/rdoc/more/files/lib/more/facets/stash_rb.html +0 -166
- data/doc/rdoc/more/files/lib/more/facets/string/mask_rb.html +0 -96
- data/doc/rdoc/more/files/lib/more/facets/string/words_rb.html +0 -96
- data/doc/rdoc/more/files/lib/more/facets/succ_rb.html +0 -92
- data/doc/rdoc/more/files/lib/more/facets/syncarray_rb.html +0 -125
- data/doc/rdoc/more/files/lib/more/facets/synchash_rb.html +0 -138
- data/doc/rdoc/more/files/lib/more/facets/thread_rb.html +0 -132
- data/doc/rdoc/more/files/lib/more/facets/timer_rb.html +0 -174
- data/doc/rdoc/more/files/lib/more/facets/tracepoint_rb.html +0 -172
- data/doc/rdoc/more/files/lib/more/facets/tuple_rb.html +0 -160
- data/doc/rdoc/more/files/lib/more/facets/typecast_rb.html +0 -215
- data/doc/rdoc/more/files/lib/more/facets/uninheritable_rb.html +0 -129
- data/doc/rdoc/more/files/lib/more/facets/version_rb.html +0 -132
- data/doc/rdoc/more/files/lib/more/facets/xmlhash_rb.html +0 -97
- data/doc/rdoc/more/files/lib/more/facets/xoxo_rb.html +0 -136
- data/doc/rdoc/more/files/lib/more/facets/ziputils_rb.html +0 -105
- data/doc/rdoc/more/fr_class_index.html +0 -185
- data/doc/rdoc/more/fr_file_index.html +0 -156
- data/doc/rdoc/more/fr_method_index.html +0 -1132
- data/doc/rdoc/more/index.html +0 -26
- data/doc/rdoc/more/rdoc-style.css +0 -177
- data/lib/core/facets/kernel/__here__.rb +0 -8
- data/lib/more/facets/buildable.rb +0 -344
- data/lib/more/facets/cssfilter.rb +0 -254
- data/lib/more/facets/htmlfilter.rb +0 -595
- data/lib/more/facets/kernel/meta.rb +0 -32
- data/lib/more/facets/prototype.rb +0 -88
- data/lib/more/facets/rwdelegator.rb +0 -74
@@ -1,1262 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
-
<!DOCTYPE html
|
3
|
-
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
-
<html>
|
6
|
-
<head>
|
7
|
-
<title>Module: Enumerable</title>
|
8
|
-
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
9
|
-
<link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
|
10
|
-
|
11
|
-
<script language="JavaScript" type="text/javascript">
|
12
|
-
// <![CDATA[
|
13
|
-
|
14
|
-
function toggleSource( id )
|
15
|
-
{
|
16
|
-
var elem
|
17
|
-
var link
|
18
|
-
|
19
|
-
if( document.getElementById )
|
20
|
-
{
|
21
|
-
elem = document.getElementById( id )
|
22
|
-
link = document.getElementById( "l_" + id )
|
23
|
-
}
|
24
|
-
else if ( document.all )
|
25
|
-
{
|
26
|
-
elem = eval( "document.all." + id )
|
27
|
-
link = eval( "document.all.l_" + id )
|
28
|
-
}
|
29
|
-
else
|
30
|
-
return false;
|
31
|
-
|
32
|
-
if( elem.style.display == "block" )
|
33
|
-
{
|
34
|
-
elem.style.display = "none"
|
35
|
-
link.innerHTML = "+"
|
36
|
-
}
|
37
|
-
else
|
38
|
-
{
|
39
|
-
elem.style.display = "block"
|
40
|
-
link.innerHTML = "-"
|
41
|
-
}
|
42
|
-
}
|
43
|
-
|
44
|
-
function openCode( url )
|
45
|
-
{
|
46
|
-
window.open( url, "SOURCE_CODE", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=480,width=750" ).focus();
|
47
|
-
}
|
48
|
-
// ]]>
|
49
|
-
</script>
|
50
|
-
</head>
|
51
|
-
|
52
|
-
<body>
|
53
|
-
<table width="100%" border='0' cellpadding='0' cellspacing='0' class='banner'><tr>
|
54
|
-
<td class="file-title"><span class="file-title-prefix">Module</span><br />Enumerable</td>
|
55
|
-
<td align="right">
|
56
|
-
<table cellspacing="0" cellpadding="2">
|
57
|
-
<tr valign="top">
|
58
|
-
<td>In:</td>
|
59
|
-
<td>
|
60
|
-
<a href="../files/lib/core/facets/to_hash_rb.html">lib/core/facets/to_hash.rb</a>
|
61
|
-
<a href="../files/lib/core/facets/enumerable/take_rb.html">lib/core/facets/enumerable/take.rb</a>
|
62
|
-
<a href="../files/lib/core/facets/enumerable/one_rb.html">lib/core/facets/enumerable/one.rb</a>
|
63
|
-
<a href="../files/lib/core/facets/enumerable/cluster_by_rb.html">lib/core/facets/enumerable/cluster_by.rb</a>
|
64
|
-
<a href="../files/lib/core/facets/enumerable/group_by_rb.html">lib/core/facets/enumerable/group_by.rb</a>
|
65
|
-
<a href="../files/lib/core/facets/enumerable/sum_rb.html">lib/core/facets/enumerable/sum.rb</a>
|
66
|
-
<a href="../files/lib/core/facets/enumerable/mode_rb.html">lib/core/facets/enumerable/mode.rb</a>
|
67
|
-
<a href="../files/lib/core/facets/enumerable/commonality_rb.html">lib/core/facets/enumerable/commonality.rb</a>
|
68
|
-
<a href="../files/lib/core/facets/enumerable/occur_rb.html">lib/core/facets/enumerable/occur.rb</a>
|
69
|
-
<a href="../files/lib/core/facets/enumerable/frequency_rb.html">lib/core/facets/enumerable/frequency.rb</a>
|
70
|
-
<a href="../files/lib/core/facets/enumerable/divide_rb.html">lib/core/facets/enumerable/divide.rb</a>
|
71
|
-
<a href="../files/lib/core/facets/enumerable/inject_rb.html">lib/core/facets/enumerable/inject.rb</a>
|
72
|
-
<a href="../files/lib/core/facets/enumerable/duplicates_rb.html">lib/core/facets/enumerable/duplicates.rb</a>
|
73
|
-
<a href="../files/lib/core/facets/enumerable/none_rb.html">lib/core/facets/enumerable/none.rb</a>
|
74
|
-
<a href="../files/lib/core/facets/enumerable/uniq_by_rb.html">lib/core/facets/enumerable/uniq_by.rb</a>
|
75
|
-
<a href="../files/lib/core/facets/enumerable/accumulate_rb.html">lib/core/facets/enumerable/accumulate.rb</a>
|
76
|
-
<a href="../files/lib/core/facets/enumerable/mash_rb.html">lib/core/facets/enumerable/mash.rb</a>
|
77
|
-
<a href="../files/lib/core/facets/enumerable/modulate_rb.html">lib/core/facets/enumerable/modulate.rb</a>
|
78
|
-
<a href="../files/lib/core/facets/enumerable/entropy_rb.html">lib/core/facets/enumerable/entropy.rb</a>
|
79
|
-
<a href="../files/lib/core/facets/enumerable/split_rb.html">lib/core/facets/enumerable/split.rb</a>
|
80
|
-
<a href="../files/lib/core/facets/enumerable/map_send_rb.html">lib/core/facets/enumerable/map_send.rb</a>
|
81
|
-
<a href="../files/lib/core/facets/enumerable/probability_rb.html">lib/core/facets/enumerable/probability.rb</a>
|
82
|
-
<a href="../files/lib/core/facets/enumerable/map_with_index_rb.html">lib/core/facets/enumerable/map_with_index.rb</a>
|
83
|
-
<a href="../files/lib/core/facets/enumerable/count_rb.html">lib/core/facets/enumerable/count.rb</a>
|
84
|
-
<a href="../files/lib/core/facets/enumerable/each_by_rb.html">lib/core/facets/enumerable/each_by.rb</a>
|
85
|
-
<a href="../files/lib/core/facets/enumerable/compact_map_rb.html">lib/core/facets/enumerable/compact_map.rb</a>
|
86
|
-
</td>
|
87
|
-
</tr>
|
88
|
-
</table>
|
89
|
-
</td>
|
90
|
-
</tr>
|
91
|
-
</table>
|
92
|
-
<!-- banner header -->
|
93
|
-
|
94
|
-
<div id="bodyContent">
|
95
|
-
<div id="content">
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
<div class="sectiontitle">Methods</div>
|
101
|
-
<span style="padding-right: 5px;"><a href="#M000454">accumulate</a></span>
|
102
|
-
<span style="padding-right: 5px;"><a href="#M000441">cluster_by</a></span>
|
103
|
-
<span style="padding-right: 5px;"><a href="#M000464">collect_with_index</a></span>
|
104
|
-
<span style="padding-right: 5px;"><a href="#M000445">commonality</a></span>
|
105
|
-
<span style="padding-right: 5px;"><a href="#M000468">compact_collect</a></span>
|
106
|
-
<span style="padding-right: 5px;"><a href="#M000467">compact_map</a></span>
|
107
|
-
<span style="padding-right: 5px;"><a href="#M000465">count</a></span>
|
108
|
-
<span style="padding-right: 5px;"><a href="#M000448">divide</a></span>
|
109
|
-
<span style="padding-right: 5px;"><a href="#M000451">duplicates</a></span>
|
110
|
-
<span style="padding-right: 5px;"><a href="#M000466">each_by</a></span>
|
111
|
-
<span style="padding-right: 5px;"><a href="#M000458">entropy</a></span>
|
112
|
-
<span style="padding-right: 5px;"><a href="#M000447">frequency</a></span>
|
113
|
-
<span style="padding-right: 5px;"><a href="#M000456">graph</a></span>
|
114
|
-
<span style="padding-right: 5px;"><a href="#M000442">group_by</a></span>
|
115
|
-
<span style="padding-right: 5px;"><a href="#M000459">ideal_entropy</a></span>
|
116
|
-
<span style="padding-right: 5px;"><a href="#M000449">inject!</a></span>
|
117
|
-
<span style="padding-right: 5px;"><a href="#M000461">map_send</a></span>
|
118
|
-
<span style="padding-right: 5px;"><a href="#M000463">map_with_index</a></span>
|
119
|
-
<span style="padding-right: 5px;"><a href="#M000455">mash</a></span>
|
120
|
-
<span style="padding-right: 5px;"><a href="#M000444">mode</a></span>
|
121
|
-
<span style="padding-right: 5px;"><a href="#M000457">modulate</a></span>
|
122
|
-
<span style="padding-right: 5px;"><a href="#M000452">none?</a></span>
|
123
|
-
<span style="padding-right: 5px;"><a href="#M000450">nonuniq</a></span>
|
124
|
-
<span style="padding-right: 5px;"><a href="#M000446">occur</a></span>
|
125
|
-
<span style="padding-right: 5px;"><a href="#M000440">one?</a></span>
|
126
|
-
<span style="padding-right: 5px;"><a href="#M000462">probability</a></span>
|
127
|
-
<span style="padding-right: 5px;"><a href="#M000460">split</a></span>
|
128
|
-
<span style="padding-right: 5px;"><a href="#M000443">sum</a></span>
|
129
|
-
<span style="padding-right: 5px;"><a href="#M000439">take</a></span>
|
130
|
-
<span style="padding-right: 5px;"><a href="#M000433">to_h</a></span>
|
131
|
-
<span style="padding-right: 5px;"><a href="#M000437">to_h_assoc</a></span>
|
132
|
-
<span style="padding-right: 5px;"><a href="#M000434">to_h_auto</a></span>
|
133
|
-
<span style="padding-right: 5px;"><a href="#M000436">to_h_flat</a></span>
|
134
|
-
<span style="padding-right: 5px;"><a href="#M000438">to_h_multi</a></span>
|
135
|
-
<span style="padding-right: 5px;"><a href="#M000435">to_h_splat</a></span>
|
136
|
-
<span style="padding-right: 5px;"><a href="#M000453">uniq_by</a></span>
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
<div class="sectiontitle">Classes and Modules</div>
|
141
|
-
Class <a href="Enumerable/Enumerator.html" class="link">Enumerable::Enumerator</a><br />
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
<div class="sectiontitle">Public Instance methods</div>
|
147
|
-
<div class="method">
|
148
|
-
<div class="title">
|
149
|
-
<a name="M000454"></a><b>accumulate</b>()
|
150
|
-
</div>
|
151
|
-
<div class="description">
|
152
|
-
<p>
|
153
|
-
Accumulate a set of a set.
|
154
|
-
</p>
|
155
|
-
<p>
|
156
|
-
For example, in an ORM design if Group has_many User then
|
157
|
-
</p>
|
158
|
-
<pre>
|
159
|
-
groups.accumulate.users
|
160
|
-
</pre>
|
161
|
-
<p>
|
162
|
-
will return a list of users from all groups.
|
163
|
-
</p>
|
164
|
-
<p>
|
165
|
-
CREDIT: George Moshchovitis
|
166
|
-
</p>
|
167
|
-
</div>
|
168
|
-
<div class="sourcecode">
|
169
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000454_source')" id="l_M000454_source">+</a> ]</p>
|
170
|
-
<div id="M000454_source" class="dyn-source">
|
171
|
-
<pre>
|
172
|
-
<span class="ruby-comment cmt"># File lib/core/facets/enumerable/accumulate.rb, line 16</span>
|
173
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">accumulate</span>
|
174
|
-
<span class="ruby-ivar">@_accumulate</span> <span class="ruby-operator">||=</span> <span class="ruby-constant">Functor</span>.<span class="ruby-identifier">new</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">op</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">args</span><span class="ruby-operator">|</span>
|
175
|
-
<span class="ruby-identifier">inject</span>([]) { <span class="ruby-operator">|</span><span class="ruby-identifier">a</span>, <span class="ruby-identifier">x</span><span class="ruby-operator">|</span> <span class="ruby-identifier">a</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">x</span>.<span class="ruby-identifier">send</span>(<span class="ruby-identifier">op</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">args</span>) }.<span class="ruby-identifier">flatten</span>
|
176
|
-
<span class="ruby-keyword kw">end</span>
|
177
|
-
<span class="ruby-keyword kw">end</span>
|
178
|
-
</pre>
|
179
|
-
</div>
|
180
|
-
</div>
|
181
|
-
</div>
|
182
|
-
<div class="method">
|
183
|
-
<div class="title">
|
184
|
-
<a name="M000441"></a><b>cluster_by</b>(&b)
|
185
|
-
</div>
|
186
|
-
<div class="description">
|
187
|
-
<p>
|
188
|
-
Similar to <a href="Enumerable.html#M000442">group_by</a> but returns an
|
189
|
-
array of the groups. Returned elements are sorted by block.
|
190
|
-
</p>
|
191
|
-
<pre>
|
192
|
-
%w{this is a test}.cluster_by {|x| x[0]}
|
193
|
-
</pre>
|
194
|
-
<p>
|
195
|
-
<em>produces</em>
|
196
|
-
</p>
|
197
|
-
<pre>
|
198
|
-
[ ['a'], ['is'], ['this', 'test'] ]
|
199
|
-
</pre>
|
200
|
-
<p>
|
201
|
-
CREDIT: Erik Veenstra
|
202
|
-
</p>
|
203
|
-
</div>
|
204
|
-
<div class="sourcecode">
|
205
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000441_source')" id="l_M000441_source">+</a> ]</p>
|
206
|
-
<div id="M000441_source" class="dyn-source">
|
207
|
-
<pre>
|
208
|
-
<span class="ruby-comment cmt"># File lib/core/facets/enumerable/cluster_by.rb, line 16</span>
|
209
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">cluster_by</span>(<span class="ruby-operator">&</span><span class="ruby-identifier">b</span>)
|
210
|
-
<span class="ruby-identifier">group_by</span>(<span class="ruby-operator">&</span><span class="ruby-identifier">b</span>).<span class="ruby-identifier">sort</span>.<span class="ruby-identifier">transpose</span>.<span class="ruby-identifier">pop</span> <span class="ruby-operator">||</span> [] <span class="ruby-comment cmt"># group_by(&b).values ?</span>
|
211
|
-
<span class="ruby-keyword kw">end</span>
|
212
|
-
</pre>
|
213
|
-
</div>
|
214
|
-
</div>
|
215
|
-
</div>
|
216
|
-
<div class="method">
|
217
|
-
<div class="title">
|
218
|
-
<a name="M000464"></a><b>collect_with_index</b>()
|
219
|
-
</div>
|
220
|
-
<div class="description">
|
221
|
-
<p>
|
222
|
-
Alias for <a href="Enumerable.html#M000463">map_with_index</a>
|
223
|
-
</p>
|
224
|
-
</div>
|
225
|
-
</div>
|
226
|
-
<div class="method">
|
227
|
-
<div class="title">
|
228
|
-
<a name="M000445"></a><b>commonality</b>( &block )
|
229
|
-
</div>
|
230
|
-
<div class="description">
|
231
|
-
<p>
|
232
|
-
Returns all items that are equal in terms of the supplied block. If no
|
233
|
-
block is given objects are considered to be equal if they return the same
|
234
|
-
value for Object#hash and if obj1 == obj2.
|
235
|
-
</p>
|
236
|
-
<pre>
|
237
|
-
[1, 2, 2, 3, 4, 4].commonality # => { 2 => [2], 4 => [4] }
|
238
|
-
|
239
|
-
["foo", "bar", "a"].commonality { |str| str.length }
|
240
|
-
# => { 3 => ["foo, "bar"] }
|
241
|
-
|
242
|
-
# Returns all persons that share their last name with another person.
|
243
|
-
persons.collisions { |person| person.last_name }
|
244
|
-
</pre>
|
245
|
-
<p>
|
246
|
-
CREDIT: Florian Gross
|
247
|
-
</p>
|
248
|
-
</div>
|
249
|
-
<div class="sourcecode">
|
250
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000445_source')" id="l_M000445_source">+</a> ]</p>
|
251
|
-
<div id="M000445_source" class="dyn-source">
|
252
|
-
<pre>
|
253
|
-
<span class="ruby-comment cmt"># File lib/core/facets/enumerable/commonality.rb, line 17</span>
|
254
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">commonality</span>( <span class="ruby-operator">&</span><span class="ruby-identifier">block</span> )
|
255
|
-
<span class="ruby-identifier">had_no_block</span> = <span class="ruby-operator">!</span><span class="ruby-identifier">block</span>
|
256
|
-
<span class="ruby-identifier">block</span> <span class="ruby-operator">||=</span> <span class="ruby-identifier">lambda</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">item</span><span class="ruby-operator">|</span> <span class="ruby-identifier">item</span> }
|
257
|
-
<span class="ruby-identifier">result</span> = <span class="ruby-constant">Hash</span>.<span class="ruby-identifier">new</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">hash</span>, <span class="ruby-identifier">key</span><span class="ruby-operator">|</span> <span class="ruby-identifier">hash</span>[<span class="ruby-identifier">key</span>] = <span class="ruby-constant">Array</span>.<span class="ruby-identifier">new</span> }
|
258
|
-
<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">item</span><span class="ruby-operator">|</span>
|
259
|
-
<span class="ruby-identifier">key</span> = <span class="ruby-identifier">block</span>.<span class="ruby-identifier">call</span>(<span class="ruby-identifier">item</span>)
|
260
|
-
<span class="ruby-identifier">result</span>[<span class="ruby-identifier">key</span>] <span class="ruby-operator"><<</span> <span class="ruby-identifier">item</span>
|
261
|
-
<span class="ruby-keyword kw">end</span>
|
262
|
-
<span class="ruby-identifier">result</span>.<span class="ruby-identifier">reject!</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">key</span>, <span class="ruby-identifier">values</span><span class="ruby-operator">|</span>
|
263
|
-
<span class="ruby-identifier">values</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator"><=</span> <span class="ruby-value">1</span>
|
264
|
-
<span class="ruby-keyword kw">end</span>
|
265
|
-
<span class="ruby-comment cmt">#return had_no_block ? result.values.flatten : result</span>
|
266
|
-
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">result</span>
|
267
|
-
<span class="ruby-keyword kw">end</span>
|
268
|
-
</pre>
|
269
|
-
</div>
|
270
|
-
</div>
|
271
|
-
</div>
|
272
|
-
<div class="method">
|
273
|
-
<div class="title">
|
274
|
-
<a name="M000468"></a><b>compact_collect</b>(trash=nil, &block)
|
275
|
-
</div>
|
276
|
-
<div class="description">
|
277
|
-
<p>
|
278
|
-
Alias for <a href="Enumerable.html#M000467">compact_map</a>
|
279
|
-
</p>
|
280
|
-
</div>
|
281
|
-
</div>
|
282
|
-
<div class="method">
|
283
|
-
<div class="title">
|
284
|
-
<a name="M000467"></a><b>compact_map</b>(trash=nil) {|*a| ...}
|
285
|
-
</div>
|
286
|
-
<div class="description">
|
287
|
-
<p>
|
288
|
-
A more versitle compact method. It can be used to collect and filter items
|
289
|
-
out in one single step.
|
290
|
-
</p>
|
291
|
-
<pre>
|
292
|
-
[1,2,3].compact_map do |n|
|
293
|
-
n < 1 ? nil : n
|
294
|
-
end
|
295
|
-
</pre>
|
296
|
-
<p>
|
297
|
-
<em>produces</em>
|
298
|
-
</p>
|
299
|
-
<pre>
|
300
|
-
[2,3]
|
301
|
-
</pre>
|
302
|
-
<p>
|
303
|
-
NOTE: Perhaps nicer to have as added functionality for compact.
|
304
|
-
</p>
|
305
|
-
<p>
|
306
|
-
CREDIT: Trans
|
307
|
-
</p>
|
308
|
-
</div>
|
309
|
-
<div class="aka">
|
310
|
-
This method is also aliased as
|
311
|
-
<a href="Enumerable.html#M000468">compact_collect</a>
|
312
|
-
</div>
|
313
|
-
<div class="sourcecode">
|
314
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000467_source')" id="l_M000467_source">+</a> ]</p>
|
315
|
-
<div id="M000467_source" class="dyn-source">
|
316
|
-
<pre>
|
317
|
-
<span class="ruby-comment cmt"># File lib/core/facets/enumerable/compact_map.rb, line 18</span>
|
318
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">compact_map</span>(<span class="ruby-identifier">trash</span>=<span class="ruby-keyword kw">nil</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span>)
|
319
|
-
<span class="ruby-identifier">y</span> = []
|
320
|
-
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">block_given?</span>
|
321
|
-
<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-operator">*</span><span class="ruby-identifier">a</span><span class="ruby-operator">|</span>
|
322
|
-
<span class="ruby-identifier">r</span> = <span class="ruby-keyword kw">yield</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">a</span>)
|
323
|
-
<span class="ruby-identifier">y</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">r</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">trash</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">r</span>
|
324
|
-
<span class="ruby-keyword kw">end</span>
|
325
|
-
<span class="ruby-keyword kw">else</span>
|
326
|
-
<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">r</span><span class="ruby-operator">|</span>
|
327
|
-
<span class="ruby-identifier">y</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">r</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">trash</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">r</span>
|
328
|
-
<span class="ruby-keyword kw">end</span>
|
329
|
-
<span class="ruby-keyword kw">end</span>
|
330
|
-
<span class="ruby-identifier">y</span>
|
331
|
-
<span class="ruby-keyword kw">end</span>
|
332
|
-
</pre>
|
333
|
-
</div>
|
334
|
-
</div>
|
335
|
-
</div>
|
336
|
-
<div class="method">
|
337
|
-
<div class="title">
|
338
|
-
<a name="M000465"></a><b>count</b>(*c)
|
339
|
-
</div>
|
340
|
-
<div class="description">
|
341
|
-
<p>
|
342
|
-
Count the number of items in an enumerable equal (==) to the given object.
|
343
|
-
</p>
|
344
|
-
<pre>
|
345
|
-
e = [ 'a', '1', 'a' ]
|
346
|
-
e.count('1') #=> 1
|
347
|
-
e.count('a') #=> 2
|
348
|
-
</pre>
|
349
|
-
<p>
|
350
|
-
Count can also handle multiple-valued blocks.
|
351
|
-
</p>
|
352
|
-
<pre>
|
353
|
-
e = { 'a' => 2, 'a' => 2, 'b' => 1 }
|
354
|
-
e.count('a',2) #=> 1
|
355
|
-
</pre>
|
356
|
-
<p>
|
357
|
-
CREDIT: Trans
|
358
|
-
</p>
|
359
|
-
</div>
|
360
|
-
<div class="sourcecode">
|
361
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000465_source')" id="l_M000465_source">+</a> ]</p>
|
362
|
-
<div id="M000465_source" class="dyn-source">
|
363
|
-
<pre>
|
364
|
-
<span class="ruby-comment cmt"># File lib/core/facets/enumerable/count.rb, line 19</span>
|
365
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">count</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">c</span>)
|
366
|
-
<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">select</span>{ <span class="ruby-operator">|</span><span class="ruby-operator">*</span><span class="ruby-identifier">i</span><span class="ruby-operator">|</span> <span class="ruby-identifier">i</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">c</span> }.<span class="ruby-identifier">length</span>
|
367
|
-
<span class="ruby-keyword kw">end</span>
|
368
|
-
</pre>
|
369
|
-
</div>
|
370
|
-
</div>
|
371
|
-
</div>
|
372
|
-
<div class="method">
|
373
|
-
<div class="title">
|
374
|
-
<a name="M000448"></a><b>divide</b>(pattern)
|
375
|
-
</div>
|
376
|
-
<div class="description">
|
377
|
-
<p>
|
378
|
-
Divide on matching pattern.
|
379
|
-
</p>
|
380
|
-
<pre>
|
381
|
-
['a1','b1','a2','b2'].divide(/^a/)
|
382
|
-
=> [['a1,'b1'],['a2','b2']]
|
383
|
-
</pre>
|
384
|
-
<p>
|
385
|
-
CREDIT: Trans
|
386
|
-
</p>
|
387
|
-
</div>
|
388
|
-
<div class="sourcecode">
|
389
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000448_source')" id="l_M000448_source">+</a> ]</p>
|
390
|
-
<div id="M000448_source" class="dyn-source">
|
391
|
-
<pre>
|
392
|
-
<span class="ruby-comment cmt"># File lib/core/facets/enumerable/divide.rb, line 10</span>
|
393
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">divide</span>(<span class="ruby-identifier">pattern</span>)
|
394
|
-
<span class="ruby-identifier">memo</span> = []
|
395
|
-
<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">obj</span><span class="ruby-operator">|</span>
|
396
|
-
<span class="ruby-identifier">memo</span>.<span class="ruby-identifier">push</span> [] <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">pattern</span> <span class="ruby-operator">===</span> <span class="ruby-identifier">obj</span>
|
397
|
-
<span class="ruby-identifier">memo</span>.<span class="ruby-identifier">last</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">obj</span>
|
398
|
-
<span class="ruby-keyword kw">end</span>
|
399
|
-
<span class="ruby-identifier">memo</span>
|
400
|
-
<span class="ruby-keyword kw">end</span>
|
401
|
-
</pre>
|
402
|
-
</div>
|
403
|
-
</div>
|
404
|
-
</div>
|
405
|
-
<div class="method">
|
406
|
-
<div class="title">
|
407
|
-
<a name="M000451"></a><b>duplicates</b>()
|
408
|
-
</div>
|
409
|
-
<div class="description">
|
410
|
-
<p>
|
411
|
-
Alias for <a href="Enumerable.html#M000450">nonuniq</a>
|
412
|
-
</p>
|
413
|
-
</div>
|
414
|
-
</div>
|
415
|
-
<div class="method">
|
416
|
-
<div class="title">
|
417
|
-
<a name="M000466"></a><b>each_by</b>(steps=nil, &block)
|
418
|
-
</div>
|
419
|
-
<div class="description">
|
420
|
-
<p>
|
421
|
-
Iterate through slices. If slice <tt>steps</tt> is not given, the arity of
|
422
|
-
the block is used.
|
423
|
-
</p>
|
424
|
-
<pre>
|
425
|
-
x = []
|
426
|
-
[1,2,3,4].each_by{ |a,b| x << [a,b] }
|
427
|
-
x #=> [ [1,2], [3,4] ]
|
428
|
-
|
429
|
-
x = []
|
430
|
-
[1,2,3,4,5,6].each_by(3){ |a| x << a }
|
431
|
-
x #=> [ [1,2,3], [4,5,6] ]
|
432
|
-
</pre>
|
433
|
-
<p>
|
434
|
-
This is just like each_slice, except that it will check the arity of the
|
435
|
-
block. If each_slice ever suppots this this method can be deprecated.
|
436
|
-
</p>
|
437
|
-
<p>
|
438
|
-
CREDIT: Trans
|
439
|
-
</p>
|
440
|
-
</div>
|
441
|
-
<div class="sourcecode">
|
442
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000466_source')" id="l_M000466_source">+</a> ]</p>
|
443
|
-
<div id="M000466_source" class="dyn-source">
|
444
|
-
<pre>
|
445
|
-
<span class="ruby-comment cmt"># File lib/core/facets/enumerable/each_by.rb, line 22</span>
|
446
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">each_by</span>(<span class="ruby-identifier">steps</span>=<span class="ruby-keyword kw">nil</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span>)
|
447
|
-
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">steps</span>
|
448
|
-
<span class="ruby-identifier">each_slice</span>(<span class="ruby-identifier">steps</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span>)
|
449
|
-
<span class="ruby-keyword kw">else</span>
|
450
|
-
<span class="ruby-identifier">steps</span> = <span class="ruby-identifier">block</span>.<span class="ruby-identifier">arity</span>.<span class="ruby-identifier">abs</span>
|
451
|
-
<span class="ruby-identifier">each_slice</span>(<span class="ruby-identifier">steps</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span>)
|
452
|
-
<span class="ruby-comment cmt">#each_slice(steps) {|i| block.call(*i)}</span>
|
453
|
-
<span class="ruby-keyword kw">end</span>
|
454
|
-
<span class="ruby-keyword kw">end</span>
|
455
|
-
</pre>
|
456
|
-
</div>
|
457
|
-
</div>
|
458
|
-
</div>
|
459
|
-
<div class="method">
|
460
|
-
<div class="title">
|
461
|
-
<a name="M000458"></a><b>entropy</b>()
|
462
|
-
</div>
|
463
|
-
<div class="description">
|
464
|
-
<p>
|
465
|
-
Shannon‘s <a href="Enumerable.html#M000458">entropy</a> for an array
|
466
|
-
- returns the average bits per symbol required to encode the array. Lower
|
467
|
-
values mean less "<a href="Enumerable.html#M000458">entropy</a>"
|
468
|
-
- i.e. less unique information in the array.
|
469
|
-
</p>
|
470
|
-
<pre>
|
471
|
-
%w{ a b c d e e e }.entropy #=>
|
472
|
-
</pre>
|
473
|
-
<p>
|
474
|
-
CREDIT: Derek
|
475
|
-
</p>
|
476
|
-
</div>
|
477
|
-
<div class="sourcecode">
|
478
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000458_source')" id="l_M000458_source">+</a> ]</p>
|
479
|
-
<div id="M000458_source" class="dyn-source">
|
480
|
-
<pre>
|
481
|
-
<span class="ruby-comment cmt"># File lib/core/facets/enumerable/entropy.rb, line 14</span>
|
482
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">entropy</span>
|
483
|
-
<span class="ruby-identifier">arr</span> = <span class="ruby-identifier">to_a</span>
|
484
|
-
<span class="ruby-identifier">probHash</span> = <span class="ruby-identifier">arr</span>.<span class="ruby-identifier">probability</span>
|
485
|
-
<span class="ruby-comment cmt"># h is the Shannon entropy of the array</span>
|
486
|
-
<span class="ruby-identifier">h</span> = <span class="ruby-value">-1</span>.<span class="ruby-identifier">to_f</span> <span class="ruby-operator">*</span> <span class="ruby-identifier">probHash</span>.<span class="ruby-identifier">keys</span>.<span class="ruby-identifier">inject</span>(<span class="ruby-value">0</span>.<span class="ruby-identifier">to_f</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">sum</span>, <span class="ruby-identifier">i</span><span class="ruby-operator">|</span>
|
487
|
-
<span class="ruby-identifier">sum</span> <span class="ruby-operator">+</span> (<span class="ruby-identifier">probHash</span>[<span class="ruby-identifier">i</span>] <span class="ruby-operator">*</span> (<span class="ruby-constant">Math</span>.<span class="ruby-identifier">log</span>(<span class="ruby-identifier">probHash</span>[<span class="ruby-identifier">i</span>])<span class="ruby-operator">/</span><span class="ruby-constant">Math</span>.<span class="ruby-identifier">log</span>(<span class="ruby-value">2</span>.<span class="ruby-identifier">to_f</span>)))
|
488
|
-
<span class="ruby-keyword kw">end</span>
|
489
|
-
<span class="ruby-identifier">h</span>
|
490
|
-
<span class="ruby-keyword kw">end</span>
|
491
|
-
</pre>
|
492
|
-
</div>
|
493
|
-
</div>
|
494
|
-
</div>
|
495
|
-
<div class="method">
|
496
|
-
<div class="title">
|
497
|
-
<a name="M000447"></a><b>frequency</b>()
|
498
|
-
</div>
|
499
|
-
<div class="description">
|
500
|
-
<p>
|
501
|
-
Generates a hash mapping each unique symbol in the array to the absolute <a
|
502
|
-
href="Enumerable.html#M000447">frequency</a> it appears.
|
503
|
-
</p>
|
504
|
-
<p>
|
505
|
-
CREDIT: Brian Schröder
|
506
|
-
</p>
|
507
|
-
</div>
|
508
|
-
<div class="sourcecode">
|
509
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000447_source')" id="l_M000447_source">+</a> ]</p>
|
510
|
-
<div id="M000447_source" class="dyn-source">
|
511
|
-
<pre>
|
512
|
-
<span class="ruby-comment cmt"># File lib/core/facets/enumerable/frequency.rb, line 8</span>
|
513
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">frequency</span>
|
514
|
-
<span class="ruby-comment cmt">#probs = Hash.new(0)</span>
|
515
|
-
<span class="ruby-comment cmt">#each do |e|</span>
|
516
|
-
<span class="ruby-comment cmt"># probs[e] += 1</span>
|
517
|
-
<span class="ruby-comment cmt">#end</span>
|
518
|
-
<span class="ruby-comment cmt">#probs</span>
|
519
|
-
<span class="ruby-identifier">inject</span>(<span class="ruby-constant">Hash</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">0</span>)){<span class="ruby-operator">|</span><span class="ruby-identifier">h</span>,<span class="ruby-identifier">v</span><span class="ruby-operator">|</span> <span class="ruby-identifier">h</span>[<span class="ruby-identifier">v</span>]<span class="ruby-operator">+=</span><span class="ruby-value">1</span>; <span class="ruby-identifier">h</span>}
|
520
|
-
<span class="ruby-keyword kw">end</span>
|
521
|
-
</pre>
|
522
|
-
</div>
|
523
|
-
</div>
|
524
|
-
</div>
|
525
|
-
<div class="method">
|
526
|
-
<div class="title">
|
527
|
-
<a name="M000456"></a><b>graph</b>(&yld)
|
528
|
-
</div>
|
529
|
-
<div class="description">
|
530
|
-
<p>
|
531
|
-
Alias for <a href="Enumerable.html#M000455">mash</a>
|
532
|
-
</p>
|
533
|
-
</div>
|
534
|
-
</div>
|
535
|
-
<div class="method">
|
536
|
-
<div class="title">
|
537
|
-
<a name="M000442"></a><b>group_by</b>( {|| ...}
|
538
|
-
</div>
|
539
|
-
<div class="description">
|
540
|
-
<p>
|
541
|
-
<a href="Enumerable.html#M000442">group_by</a> is used to group items in a
|
542
|
-
collection by something they have in common. The common factor is the key
|
543
|
-
in the resulting hash, the array of like elements is the value.
|
544
|
-
</p>
|
545
|
-
<pre>
|
546
|
-
(1..5).group_by { |n| n % 3 }
|
547
|
-
#=> { 0 => [3], 1 => [1, 4], 2 => [2,5] }
|
548
|
-
|
549
|
-
["I had", 1, "dollar and", 50, "cents"].group_by { |e| e.class }
|
550
|
-
#=> { String => ["I had","dollar and","cents"], Fixnum => [1,50] }
|
551
|
-
</pre>
|
552
|
-
<p>
|
553
|
-
CREDIT: Erik Veenstra
|
554
|
-
</p>
|
555
|
-
</div>
|
556
|
-
<div class="sourcecode">
|
557
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000442_source')" id="l_M000442_source">+</a> ]</p>
|
558
|
-
<div id="M000442_source" class="dyn-source">
|
559
|
-
<pre>
|
560
|
-
<span class="ruby-comment cmt"># File lib/core/facets/enumerable/group_by.rb, line 17</span>
|
561
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">group_by</span> <span class="ruby-comment cmt">#:yield:</span>
|
562
|
-
<span class="ruby-comment cmt">#h = k = e = nil</span>
|
563
|
-
<span class="ruby-identifier">r</span> = <span class="ruby-constant">Hash</span>.<span class="ruby-identifier">new</span>
|
564
|
-
<span class="ruby-identifier">each</span>{ <span class="ruby-operator">|</span><span class="ruby-identifier">e</span><span class="ruby-operator">|</span> (<span class="ruby-identifier">r</span>[<span class="ruby-keyword kw">yield</span>(<span class="ruby-identifier">e</span>)] <span class="ruby-operator">||=</span> []) <span class="ruby-operator"><<</span> <span class="ruby-identifier">e</span> }
|
565
|
-
<span class="ruby-identifier">r</span>
|
566
|
-
<span class="ruby-keyword kw">end</span>
|
567
|
-
</pre>
|
568
|
-
</div>
|
569
|
-
</div>
|
570
|
-
</div>
|
571
|
-
<div class="method">
|
572
|
-
<div class="title">
|
573
|
-
<a name="M000459"></a><b>ideal_entropy</b>()
|
574
|
-
</div>
|
575
|
-
<div class="description">
|
576
|
-
<p>
|
577
|
-
Returns the maximum possible Shannon <a
|
578
|
-
href="Enumerable.html#M000458">entropy</a> of the array with given size
|
579
|
-
assuming that it is an "order-0" source (each element is selected
|
580
|
-
independently of the next).
|
581
|
-
</p>
|
582
|
-
<p>
|
583
|
-
CREDIT: Derek
|
584
|
-
</p>
|
585
|
-
</div>
|
586
|
-
<div class="sourcecode">
|
587
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000459_source')" id="l_M000459_source">+</a> ]</p>
|
588
|
-
<div id="M000459_source" class="dyn-source">
|
589
|
-
<pre>
|
590
|
-
<span class="ruby-comment cmt"># File lib/core/facets/enumerable/entropy.rb, line 30</span>
|
591
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">ideal_entropy</span>
|
592
|
-
<span class="ruby-identifier">arr</span> = <span class="ruby-identifier">to_a</span>
|
593
|
-
<span class="ruby-identifier">unitProb</span> = <span class="ruby-value">1.0</span>.<span class="ruby-identifier">to_f</span> <span class="ruby-operator">/</span> <span class="ruby-identifier">arr</span>.<span class="ruby-identifier">size</span>.<span class="ruby-identifier">to_f</span>
|
594
|
-
(<span class="ruby-value">-1</span>.<span class="ruby-identifier">to_f</span> <span class="ruby-operator">*</span> <span class="ruby-identifier">arr</span>.<span class="ruby-identifier">size</span>.<span class="ruby-identifier">to_f</span> <span class="ruby-operator">*</span> <span class="ruby-identifier">unitProb</span> <span class="ruby-operator">*</span> <span class="ruby-constant">Math</span>.<span class="ruby-identifier">log</span>(<span class="ruby-identifier">unitProb</span>)<span class="ruby-operator">/</span><span class="ruby-constant">Math</span>.<span class="ruby-identifier">log</span>(<span class="ruby-value">2</span>.<span class="ruby-identifier">to_f</span>))
|
595
|
-
<span class="ruby-keyword kw">end</span>
|
596
|
-
</pre>
|
597
|
-
</div>
|
598
|
-
</div>
|
599
|
-
</div>
|
600
|
-
<div class="method">
|
601
|
-
<div class="title">
|
602
|
-
<a name="M000449"></a><b>inject!</b>(s) {|k, i| ...}
|
603
|
-
</div>
|
604
|
-
<div class="description">
|
605
|
-
<p>
|
606
|
-
A small variation of Inject that save one from having to return the
|
607
|
-
aggregating or memo argument.
|
608
|
-
</p>
|
609
|
-
<p>
|
610
|
-
Say you want to <a href="Enumerable.html#M000465">count</a> letters.
|
611
|
-
</p>
|
612
|
-
<pre>
|
613
|
-
some_text.inject!(Hash.new(0)) {|h,l| h[l] += 1}
|
614
|
-
</pre>
|
615
|
-
<p>
|
616
|
-
vs
|
617
|
-
</p>
|
618
|
-
<pre>
|
619
|
-
some_text.inject(Hash.new(0)) {|h,l| h[l] +=1; h}
|
620
|
-
</pre>
|
621
|
-
<p>
|
622
|
-
CREDIT: David Black, Louis J Scoras
|
623
|
-
</p>
|
624
|
-
</div>
|
625
|
-
<div class="sourcecode">
|
626
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000449_source')" id="l_M000449_source">+</a> ]</p>
|
627
|
-
<div id="M000449_source" class="dyn-source">
|
628
|
-
<pre>
|
629
|
-
<span class="ruby-comment cmt"># File lib/core/facets/enumerable/inject.rb, line 16</span>
|
630
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">inject!</span>(<span class="ruby-identifier">s</span>)
|
631
|
-
<span class="ruby-identifier">k</span> = <span class="ruby-identifier">s</span>
|
632
|
-
<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">i</span><span class="ruby-operator">|</span> <span class="ruby-keyword kw">yield</span>(<span class="ruby-identifier">k</span>, <span class="ruby-identifier">i</span>) }
|
633
|
-
<span class="ruby-identifier">k</span>
|
634
|
-
<span class="ruby-keyword kw">end</span>
|
635
|
-
</pre>
|
636
|
-
</div>
|
637
|
-
</div>
|
638
|
-
</div>
|
639
|
-
<div class="method">
|
640
|
-
<div class="title">
|
641
|
-
<a name="M000461"></a><b>map_send</b>(meth, *args, &block)
|
642
|
-
</div>
|
643
|
-
<div class="description">
|
644
|
-
<p>
|
645
|
-
Send a message to each element and collect the result.
|
646
|
-
</p>
|
647
|
-
<p>
|
648
|
-
CREDIT: Sean O‘Halpin
|
649
|
-
</p>
|
650
|
-
</div>
|
651
|
-
<div class="sourcecode">
|
652
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000461_source')" id="l_M000461_source">+</a> ]</p>
|
653
|
-
<div id="M000461_source" class="dyn-source">
|
654
|
-
<pre>
|
655
|
-
<span class="ruby-comment cmt"># File lib/core/facets/enumerable/map_send.rb, line 7</span>
|
656
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">map_send</span>(<span class="ruby-identifier">meth</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">args</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span>)
|
657
|
-
<span class="ruby-identifier">map</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">e</span><span class="ruby-operator">|</span> <span class="ruby-identifier">e</span>.<span class="ruby-identifier">send</span>(<span class="ruby-identifier">meth</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">args</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span>)}
|
658
|
-
<span class="ruby-keyword kw">end</span>
|
659
|
-
</pre>
|
660
|
-
</div>
|
661
|
-
</div>
|
662
|
-
</div>
|
663
|
-
<div class="method">
|
664
|
-
<div class="title">
|
665
|
-
<a name="M000463"></a><b>map_with_index</b>() {|self[i], i| ...}
|
666
|
-
</div>
|
667
|
-
<div class="description">
|
668
|
-
<p>
|
669
|
-
Same as collect but with an iteration counter.
|
670
|
-
</p>
|
671
|
-
<pre>
|
672
|
-
a = [1,2,3].collect_with_index { |e,i| e*i }
|
673
|
-
a #=> [0,2,6]
|
674
|
-
</pre>
|
675
|
-
<p>
|
676
|
-
CREDIT: Gavin Sinclair
|
677
|
-
</p>
|
678
|
-
</div>
|
679
|
-
<div class="aka">
|
680
|
-
This method is also aliased as
|
681
|
-
<a href="Enumerable.html#M000464">collect_with_index</a>
|
682
|
-
</div>
|
683
|
-
<div class="sourcecode">
|
684
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000463_source')" id="l_M000463_source">+</a> ]</p>
|
685
|
-
<div id="M000463_source" class="dyn-source">
|
686
|
-
<pre>
|
687
|
-
<span class="ruby-comment cmt"># File lib/core/facets/enumerable/map_with_index.rb, line 10</span>
|
688
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">map_with_index</span>
|
689
|
-
<span class="ruby-identifier">r</span> = []
|
690
|
-
<span class="ruby-identifier">each_index</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">i</span><span class="ruby-operator">|</span>
|
691
|
-
<span class="ruby-identifier">r</span> <span class="ruby-operator"><<</span> <span class="ruby-keyword kw">yield</span>(<span class="ruby-keyword kw">self</span>[<span class="ruby-identifier">i</span>], <span class="ruby-identifier">i</span>)
|
692
|
-
<span class="ruby-keyword kw">end</span>
|
693
|
-
<span class="ruby-identifier">r</span>
|
694
|
-
<span class="ruby-keyword kw">end</span>
|
695
|
-
</pre>
|
696
|
-
</div>
|
697
|
-
</div>
|
698
|
-
</div>
|
699
|
-
<div class="method">
|
700
|
-
<div class="title">
|
701
|
-
<a name="M000455"></a><b>mash</b>(&yld)
|
702
|
-
</div>
|
703
|
-
<div class="description">
|
704
|
-
<p>
|
705
|
-
Like <tt>map</tt>/<tt>collect</tt>, but generates a <a
|
706
|
-
href="Hash.html">Hash</a>. The block is expected to return two values: the
|
707
|
-
key and the value for the new hash.
|
708
|
-
</p>
|
709
|
-
<pre>
|
710
|
-
numbers = (1..3)
|
711
|
-
squares = numbers.mash { |n| [n, n*n] } # { 1=>1, 2=>4, 3=>9 }
|
712
|
-
sq_roots = numbers.mash { |n| [n*n, n] } # { 1=>1, 4=>2, 9=>3 }
|
713
|
-
</pre>
|
714
|
-
<p>
|
715
|
-
The name "<a href="Enumerable.html#M000455">mash</a>" stands for
|
716
|
-
"map hash".
|
717
|
-
</p>
|
718
|
-
<p>
|
719
|
-
CREDIT: Andrew Dudzik (adudzik), Trans
|
720
|
-
</p>
|
721
|
-
</div>
|
722
|
-
<div class="aka">
|
723
|
-
This method is also aliased as
|
724
|
-
<a href="Enumerable.html#M000456">graph</a>
|
725
|
-
</div>
|
726
|
-
<div class="sourcecode">
|
727
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000455_source')" id="l_M000455_source">+</a> ]</p>
|
728
|
-
<div id="M000455_source" class="dyn-source">
|
729
|
-
<pre>
|
730
|
-
<span class="ruby-comment cmt"># File lib/core/facets/enumerable/mash.rb, line 14</span>
|
731
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">mash</span>(<span class="ruby-operator">&</span><span class="ruby-identifier">yld</span>)
|
732
|
-
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">yld</span>
|
733
|
-
<span class="ruby-identifier">inject</span>({}) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">h</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">kv</span><span class="ruby-operator">|</span> <span class="ruby-comment cmt"># Used to be inject({}) do |h,kv|</span>
|
734
|
-
<span class="ruby-identifier">r</span> = <span class="ruby-operator">*</span><span class="ruby-identifier">yld</span>[<span class="ruby-operator">*</span><span class="ruby-identifier">kv</span>] <span class="ruby-comment cmt"># The *-op works differnt from to_a on single element hash!!!</span>
|
735
|
-
<span class="ruby-identifier">nk</span>, <span class="ruby-identifier">nv</span> = <span class="ruby-operator">*</span><span class="ruby-identifier">r</span> <span class="ruby-comment cmt"># Used to be nk, nv = *yld[*kv].to_a.flatten</span>
|
736
|
-
<span class="ruby-identifier">h</span>[<span class="ruby-identifier">nk</span>] = <span class="ruby-identifier">nv</span>
|
737
|
-
<span class="ruby-identifier">h</span>
|
738
|
-
<span class="ruby-keyword kw">end</span>
|
739
|
-
<span class="ruby-keyword kw">else</span>
|
740
|
-
<span class="ruby-constant">Enumerator</span>.<span class="ruby-identifier">new</span>(<span class="ruby-keyword kw">self</span>,<span class="ruby-identifier">:graph</span>) <span class="ruby-comment cmt"># Used to be Hash[*self.to_a] or Hash[*self.to_a.flatten]</span>
|
741
|
-
<span class="ruby-keyword kw">end</span>
|
742
|
-
<span class="ruby-keyword kw">end</span>
|
743
|
-
</pre>
|
744
|
-
</div>
|
745
|
-
</div>
|
746
|
-
</div>
|
747
|
-
<div class="method">
|
748
|
-
<div class="title">
|
749
|
-
<a name="M000444"></a><b>mode</b>()
|
750
|
-
</div>
|
751
|
-
<div class="description">
|
752
|
-
<p>
|
753
|
-
In Statistics <a href="Enumerable.html#M000444">mode</a> is the value that
|
754
|
-
occurs most frequently in a given set of data.
|
755
|
-
</p>
|
756
|
-
<p>
|
757
|
-
CREDIT: Robert Klemme
|
758
|
-
</p>
|
759
|
-
</div>
|
760
|
-
<div class="sourcecode">
|
761
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000444_source')" id="l_M000444_source">+</a> ]</p>
|
762
|
-
<div id="M000444_source" class="dyn-source">
|
763
|
-
<pre>
|
764
|
-
<span class="ruby-comment cmt"># File lib/core/facets/enumerable/mode.rb, line 8</span>
|
765
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">mode</span>
|
766
|
-
<span class="ruby-identifier">max</span> = <span class="ruby-value">0</span>
|
767
|
-
<span class="ruby-identifier">c</span> = <span class="ruby-constant">Hash</span>.<span class="ruby-identifier">new</span> <span class="ruby-value">0</span>
|
768
|
-
<span class="ruby-identifier">each</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">x</span><span class="ruby-operator">|</span> <span class="ruby-identifier">cc</span> = <span class="ruby-identifier">c</span>[<span class="ruby-identifier">x</span>] <span class="ruby-operator">+=</span> <span class="ruby-value">1</span>; <span class="ruby-identifier">max</span> = <span class="ruby-identifier">cc</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">cc</span> <span class="ruby-operator">></span> <span class="ruby-identifier">max</span>}
|
769
|
-
<span class="ruby-identifier">c</span>.<span class="ruby-identifier">select</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">k</span>,<span class="ruby-identifier">v</span><span class="ruby-operator">|</span> <span class="ruby-identifier">v</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">max</span>}.<span class="ruby-identifier">map</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">k</span>,<span class="ruby-identifier">v</span><span class="ruby-operator">|</span> <span class="ruby-identifier">k</span>}
|
770
|
-
<span class="ruby-keyword kw">end</span>
|
771
|
-
</pre>
|
772
|
-
</div>
|
773
|
-
</div>
|
774
|
-
</div>
|
775
|
-
<div class="method">
|
776
|
-
<div class="title">
|
777
|
-
<a name="M000457"></a><b>modulate</b>(modulo)
|
778
|
-
</div>
|
779
|
-
<div class="description">
|
780
|
-
<p>
|
781
|
-
Modulate. Divide an array into groups by modulo of the index.
|
782
|
-
</p>
|
783
|
-
<p>
|
784
|
-
[2,4,6,8].<a href="Enumerable.html#M000457">modulate</a>(2) #=>
|
785
|
-
[[2,6],[4,8]]
|
786
|
-
</p>
|
787
|
-
<p>
|
788
|
-
CREDIT: Trans
|
789
|
-
</p>
|
790
|
-
<p>
|
791
|
-
NOTE: Would the better name for this be ‘collate’?
|
792
|
-
</p>
|
793
|
-
</div>
|
794
|
-
<div class="sourcecode">
|
795
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000457_source')" id="l_M000457_source">+</a> ]</p>
|
796
|
-
<div id="M000457_source" class="dyn-source">
|
797
|
-
<pre>
|
798
|
-
<span class="ruby-comment cmt"># File lib/core/facets/enumerable/modulate.rb, line 11</span>
|
799
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">modulate</span>(<span class="ruby-identifier">modulo</span>)
|
800
|
-
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">to_a</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">modulo</span> <span class="ruby-operator">==</span> <span class="ruby-value">1</span>
|
801
|
-
<span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-value str">'bad modulo'</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">size</span> <span class="ruby-operator">%</span> <span class="ruby-identifier">modulo</span> <span class="ruby-operator">!=</span> <span class="ruby-value">0</span>
|
802
|
-
<span class="ruby-identifier">r</span> = <span class="ruby-constant">Array</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">modulo</span>, [])
|
803
|
-
(<span class="ruby-value">0</span><span class="ruby-operator">...</span><span class="ruby-identifier">size</span>).<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">i</span><span class="ruby-operator">|</span>
|
804
|
-
<span class="ruby-identifier">r</span>[<span class="ruby-identifier">i</span> <span class="ruby-operator">%</span> <span class="ruby-identifier">modulo</span>] <span class="ruby-operator">+=</span> [<span class="ruby-keyword kw">self</span>[<span class="ruby-identifier">i</span>]]
|
805
|
-
<span class="ruby-keyword kw">end</span>
|
806
|
-
<span class="ruby-identifier">r</span>
|
807
|
-
<span class="ruby-keyword kw">end</span>
|
808
|
-
</pre>
|
809
|
-
</div>
|
810
|
-
</div>
|
811
|
-
</div>
|
812
|
-
<div class="method">
|
813
|
-
<div class="title">
|
814
|
-
<a name="M000452"></a><b>none?</b>( {|e| ...}
|
815
|
-
</div>
|
816
|
-
<div class="description">
|
817
|
-
<p>
|
818
|
-
Enumerable#none? is the logical opposite of the builtin method
|
819
|
-
Enumerable#any?. It returns <tt>true</tt> if and only if <em>none</em> of
|
820
|
-
the elements in the collection satisfy the predicate.
|
821
|
-
</p>
|
822
|
-
<p>
|
823
|
-
If no predicate is provided, Enumerable#none? returns <tt>true</tt> if and
|
824
|
-
only if <em>none</em> of the elements have a true value (i.e. not
|
825
|
-
<tt>nil</tt> or <tt>false</tt>).
|
826
|
-
</p>
|
827
|
-
<pre>
|
828
|
-
[].none? # true
|
829
|
-
[nil].none? # true
|
830
|
-
[5,8,9].none? # false
|
831
|
-
(1...10).none? { |n| n < 0 } # true
|
832
|
-
(1...10).none? { |n| n > 0 } # false
|
833
|
-
</pre>
|
834
|
-
<p>
|
835
|
-
CREDIT: Gavin Sinclair
|
836
|
-
</p>
|
837
|
-
</div>
|
838
|
-
<div class="sourcecode">
|
839
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000452_source')" id="l_M000452_source">+</a> ]</p>
|
840
|
-
<div id="M000452_source" class="dyn-source">
|
841
|
-
<pre>
|
842
|
-
<span class="ruby-comment cmt"># File lib/core/facets/enumerable/none.rb, line 21</span>
|
843
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">none?</span> <span class="ruby-comment cmt"># :yield: e</span>
|
844
|
-
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">block_given?</span>
|
845
|
-
<span class="ruby-keyword kw">not</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">any?</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">e</span><span class="ruby-operator">|</span> <span class="ruby-keyword kw">yield</span> <span class="ruby-identifier">e</span> }
|
846
|
-
<span class="ruby-keyword kw">else</span>
|
847
|
-
<span class="ruby-keyword kw">not</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">any?</span>
|
848
|
-
<span class="ruby-keyword kw">end</span>
|
849
|
-
<span class="ruby-keyword kw">end</span>
|
850
|
-
</pre>
|
851
|
-
</div>
|
852
|
-
</div>
|
853
|
-
</div>
|
854
|
-
<div class="method">
|
855
|
-
<div class="title">
|
856
|
-
<a name="M000450"></a><b>nonuniq</b>()
|
857
|
-
</div>
|
858
|
-
<div class="description">
|
859
|
-
<p>
|
860
|
-
Returns a list on non-unique,
|
861
|
-
</p>
|
862
|
-
<pre>
|
863
|
-
[1,1,2,2,3,4,5].nonuniq #=> [1,2]
|
864
|
-
</pre>
|
865
|
-
<p>
|
866
|
-
CREDIT: Martin DeMello
|
867
|
-
</p>
|
868
|
-
</div>
|
869
|
-
<div class="aka">
|
870
|
-
This method is also aliased as
|
871
|
-
<a href="Enumerable.html#M000451">duplicates</a>
|
872
|
-
</div>
|
873
|
-
<div class="sourcecode">
|
874
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000450_source')" id="l_M000450_source">+</a> ]</p>
|
875
|
-
<div id="M000450_source" class="dyn-source">
|
876
|
-
<pre>
|
877
|
-
<span class="ruby-comment cmt"># File lib/core/facets/enumerable/duplicates.rb, line 9</span>
|
878
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">nonuniq</span>
|
879
|
-
<span class="ruby-identifier">h1</span> = {}
|
880
|
-
<span class="ruby-identifier">h2</span> = {}
|
881
|
-
<span class="ruby-identifier">each</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">i</span><span class="ruby-operator">|</span>
|
882
|
-
<span class="ruby-identifier">h2</span>[<span class="ruby-identifier">i</span>] = <span class="ruby-keyword kw">true</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">h1</span>[<span class="ruby-identifier">i</span>]
|
883
|
-
<span class="ruby-identifier">h1</span>[<span class="ruby-identifier">i</span>] = <span class="ruby-keyword kw">true</span>
|
884
|
-
}
|
885
|
-
<span class="ruby-identifier">h2</span>.<span class="ruby-identifier">keys</span>
|
886
|
-
<span class="ruby-keyword kw">end</span>
|
887
|
-
</pre>
|
888
|
-
</div>
|
889
|
-
</div>
|
890
|
-
</div>
|
891
|
-
<div class="method">
|
892
|
-
<div class="title">
|
893
|
-
<a name="M000446"></a><b>occur</b>(n=nil) {|| ...}
|
894
|
-
</div>
|
895
|
-
<div class="description">
|
896
|
-
<p>
|
897
|
-
Returns an array of elements for the elements that <a
|
898
|
-
href="Enumerable.html#M000446">occur</a> n times. Or according to the
|
899
|
-
results of a given block.
|
900
|
-
</p>
|
901
|
-
<pre>
|
902
|
-
[1,1,2,3,3,4,5,5].occur(1) #=> [2,4]
|
903
|
-
[1,1,2,3,3,4,5,5].occur(2) #=> [1,3,5]
|
904
|
-
[1,1,2,3,3,4,5,5].occur(3) #=> []
|
905
|
-
|
906
|
-
[1,2,2,3,3,3].occur(1..1) #=> [1]
|
907
|
-
[1,2,2,3,3,3].occur(2..3) #=> [2,3]
|
908
|
-
|
909
|
-
[1,1,2,3,3,4,5,5].occur { |n| n == 1 } #=> [2,4]
|
910
|
-
[1,1,2,3,3,4,5,5].occur { |n| n > 1 } #=> [1,3,5]
|
911
|
-
</pre>
|
912
|
-
</div>
|
913
|
-
<div class="sourcecode">
|
914
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000446_source')" id="l_M000446_source">+</a> ]</p>
|
915
|
-
<div id="M000446_source" class="dyn-source">
|
916
|
-
<pre>
|
917
|
-
<span class="ruby-comment cmt"># File lib/core/facets/enumerable/occur.rb, line 16</span>
|
918
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">occur</span>(<span class="ruby-identifier">n</span>=<span class="ruby-keyword kw">nil</span>) <span class="ruby-comment cmt">#:yield:</span>
|
919
|
-
<span class="ruby-identifier">result</span> = <span class="ruby-constant">Hash</span>.<span class="ruby-identifier">new</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">hash</span>, <span class="ruby-identifier">key</span><span class="ruby-operator">|</span> <span class="ruby-identifier">hash</span>[<span class="ruby-identifier">key</span>] = <span class="ruby-constant">Array</span>.<span class="ruby-identifier">new</span> }
|
920
|
-
<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">item</span><span class="ruby-operator">|</span>
|
921
|
-
<span class="ruby-identifier">key</span> = <span class="ruby-identifier">item</span>
|
922
|
-
<span class="ruby-identifier">result</span>[<span class="ruby-identifier">key</span>] <span class="ruby-operator"><<</span> <span class="ruby-identifier">item</span>
|
923
|
-
<span class="ruby-keyword kw">end</span>
|
924
|
-
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">block_given?</span>
|
925
|
-
<span class="ruby-identifier">result</span>.<span class="ruby-identifier">reject!</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">key</span>, <span class="ruby-identifier">values</span><span class="ruby-operator">|</span> <span class="ruby-operator">!</span> <span class="ruby-keyword kw">yield</span>(<span class="ruby-identifier">values</span>.<span class="ruby-identifier">size</span>) }
|
926
|
-
<span class="ruby-keyword kw">else</span>
|
927
|
-
<span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">n</span>
|
928
|
-
<span class="ruby-keyword kw">if</span> <span class="ruby-constant">Range</span> <span class="ruby-operator">===</span> <span class="ruby-identifier">n</span>
|
929
|
-
<span class="ruby-identifier">result</span>.<span class="ruby-identifier">reject!</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">key</span>, <span class="ruby-identifier">values</span><span class="ruby-operator">|</span> <span class="ruby-operator">!</span> <span class="ruby-identifier">n</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">values</span>.<span class="ruby-identifier">size</span>) }
|
930
|
-
<span class="ruby-keyword kw">else</span>
|
931
|
-
<span class="ruby-identifier">result</span>.<span class="ruby-identifier">reject!</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">key</span>, <span class="ruby-identifier">values</span><span class="ruby-operator">|</span> <span class="ruby-identifier">values</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">!=</span> <span class="ruby-identifier">n</span> }
|
932
|
-
<span class="ruby-keyword kw">end</span>
|
933
|
-
<span class="ruby-keyword kw">end</span>
|
934
|
-
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">result</span>.<span class="ruby-identifier">values</span>.<span class="ruby-identifier">flatten</span>.<span class="ruby-identifier">uniq</span>
|
935
|
-
<span class="ruby-keyword kw">end</span>
|
936
|
-
</pre>
|
937
|
-
</div>
|
938
|
-
</div>
|
939
|
-
</div>
|
940
|
-
<div class="method">
|
941
|
-
<div class="title">
|
942
|
-
<a name="M000440"></a><b>one?</b>( {|e| ...}
|
943
|
-
</div>
|
944
|
-
<div class="description">
|
945
|
-
<p>
|
946
|
-
Enumerable#one? returns <tt>true</tt> if and only if <em>exactly one</em>
|
947
|
-
element in the collection satisfies the given predicate.
|
948
|
-
</p>
|
949
|
-
<p>
|
950
|
-
If no predicate is provided, Enumerable#one? returns <tt>true</tt> if and
|
951
|
-
only if <em>exactly one</em> element has a true value (i.e. not
|
952
|
-
<tt>nil</tt> or <tt>false</tt>).
|
953
|
-
</p>
|
954
|
-
<pre>
|
955
|
-
[].one? # false
|
956
|
-
[nil].one? # false
|
957
|
-
[5].one? # true
|
958
|
-
[5,8,9].one? # false
|
959
|
-
(1...10).one? { |n| n == 5 } # true
|
960
|
-
(1...10).one? { |n| n < 5 } # false
|
961
|
-
</pre>
|
962
|
-
<p>
|
963
|
-
CREDIT: Gavin Sinclair
|
964
|
-
</p>
|
965
|
-
</div>
|
966
|
-
<div class="sourcecode">
|
967
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000440_source')" id="l_M000440_source">+</a> ]</p>
|
968
|
-
<div id="M000440_source" class="dyn-source">
|
969
|
-
<pre>
|
970
|
-
<span class="ruby-comment cmt"># File lib/core/facets/enumerable/one.rb, line 21</span>
|
971
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">one?</span> <span class="ruby-comment cmt"># :yield: e</span>
|
972
|
-
<span class="ruby-identifier">matches</span> = <span class="ruby-value">0</span>
|
973
|
-
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">block_given?</span>
|
974
|
-
<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">e</span><span class="ruby-operator">|</span>
|
975
|
-
<span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">yield</span>(<span class="ruby-identifier">e</span>)
|
976
|
-
<span class="ruby-identifier">matches</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span>
|
977
|
-
<span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">false</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">matches</span> <span class="ruby-operator">></span> <span class="ruby-value">1</span>
|
978
|
-
<span class="ruby-keyword kw">end</span>
|
979
|
-
<span class="ruby-keyword kw">end</span>
|
980
|
-
<span class="ruby-keyword kw">return</span> (<span class="ruby-identifier">matches</span> <span class="ruby-operator">==</span> <span class="ruby-value">1</span>)
|
981
|
-
<span class="ruby-keyword kw">else</span>
|
982
|
-
<span class="ruby-identifier">one?</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">e</span><span class="ruby-operator">|</span> <span class="ruby-identifier">e</span> }
|
983
|
-
<span class="ruby-keyword kw">end</span>
|
984
|
-
<span class="ruby-keyword kw">end</span>
|
985
|
-
</pre>
|
986
|
-
</div>
|
987
|
-
</div>
|
988
|
-
</div>
|
989
|
-
<div class="method">
|
990
|
-
<div class="title">
|
991
|
-
<a name="M000462"></a><b>probability</b>()
|
992
|
-
</div>
|
993
|
-
<div class="description">
|
994
|
-
<p>
|
995
|
-
Generates a hash mapping each unique element in the array to the relative
|
996
|
-
<a href="Enumerable.html#M000447">frequency</a>, i.e. the probablity, of it
|
997
|
-
appearence.
|
998
|
-
</p>
|
999
|
-
<p>
|
1000
|
-
CREDIT: Brian Schröder
|
1001
|
-
</p>
|
1002
|
-
</div>
|
1003
|
-
<div class="sourcecode">
|
1004
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000462_source')" id="l_M000462_source">+</a> ]</p>
|
1005
|
-
<div id="M000462_source" class="dyn-source">
|
1006
|
-
<pre>
|
1007
|
-
<span class="ruby-comment cmt"># File lib/core/facets/enumerable/probability.rb, line 9</span>
|
1008
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">probability</span>
|
1009
|
-
<span class="ruby-identifier">probs</span> = <span class="ruby-constant">Hash</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">0</span><span class="ruby-value">.0</span>)
|
1010
|
-
<span class="ruby-identifier">size</span> = <span class="ruby-value">0</span><span class="ruby-value">.0</span>
|
1011
|
-
<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span> <span class="ruby-identifier">e</span> <span class="ruby-operator">|</span>
|
1012
|
-
<span class="ruby-identifier">probs</span>[<span class="ruby-identifier">e</span>] <span class="ruby-operator">+=</span> <span class="ruby-value">1.0</span>
|
1013
|
-
<span class="ruby-identifier">size</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1.0</span>
|
1014
|
-
<span class="ruby-keyword kw">end</span>
|
1015
|
-
<span class="ruby-identifier">probs</span>.<span class="ruby-identifier">keys</span>.<span class="ruby-identifier">each</span>{ <span class="ruby-operator">|</span><span class="ruby-identifier">e</span><span class="ruby-operator">|</span> <span class="ruby-identifier">probs</span>[<span class="ruby-identifier">e</span>] <span class="ruby-operator">/=</span> <span class="ruby-identifier">size</span> }
|
1016
|
-
<span class="ruby-identifier">probs</span>
|
1017
|
-
<span class="ruby-keyword kw">end</span>
|
1018
|
-
</pre>
|
1019
|
-
</div>
|
1020
|
-
</div>
|
1021
|
-
</div>
|
1022
|
-
<div class="method">
|
1023
|
-
<div class="title">
|
1024
|
-
<a name="M000460"></a><b>split</b>(pattern)
|
1025
|
-
</div>
|
1026
|
-
<div class="description">
|
1027
|
-
<p>
|
1028
|
-
Split on matching pattern. Unlike <a
|
1029
|
-
href="Enumerable.html#M000448">divide</a> this does not include matching
|
1030
|
-
elements.
|
1031
|
-
</p>
|
1032
|
-
<pre>
|
1033
|
-
['a1','a2','b1','a3','b2','a4'].split(/^b/)
|
1034
|
-
=> [['a1','a2'],['a3'],['a4']]
|
1035
|
-
</pre>
|
1036
|
-
<p>
|
1037
|
-
CREDIT: Trans
|
1038
|
-
</p>
|
1039
|
-
</div>
|
1040
|
-
<div class="sourcecode">
|
1041
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000460_source')" id="l_M000460_source">+</a> ]</p>
|
1042
|
-
<div id="M000460_source" class="dyn-source">
|
1043
|
-
<pre>
|
1044
|
-
<span class="ruby-comment cmt"># File lib/core/facets/enumerable/split.rb, line 10</span>
|
1045
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">split</span>(<span class="ruby-identifier">pattern</span>)
|
1046
|
-
<span class="ruby-identifier">memo</span> = []
|
1047
|
-
<span class="ruby-identifier">sect</span> = []
|
1048
|
-
<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">obj</span><span class="ruby-operator">|</span>
|
1049
|
-
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">pattern</span> <span class="ruby-operator">===</span> <span class="ruby-identifier">obj</span>
|
1050
|
-
<span class="ruby-identifier">memo</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">sect</span>
|
1051
|
-
<span class="ruby-identifier">sect</span> = []
|
1052
|
-
<span class="ruby-keyword kw">else</span>
|
1053
|
-
<span class="ruby-identifier">sect</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">obj</span>
|
1054
|
-
<span class="ruby-keyword kw">end</span>
|
1055
|
-
<span class="ruby-keyword kw">end</span>
|
1056
|
-
<span class="ruby-identifier">memo</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">sect</span>
|
1057
|
-
<span class="ruby-identifier">memo</span>.<span class="ruby-identifier">pop</span> <span class="ruby-keyword kw">while</span> <span class="ruby-identifier">memo</span>.<span class="ruby-identifier">last</span> <span class="ruby-operator">==</span> []
|
1058
|
-
<span class="ruby-identifier">memo</span>
|
1059
|
-
<span class="ruby-keyword kw">end</span>
|
1060
|
-
</pre>
|
1061
|
-
</div>
|
1062
|
-
</div>
|
1063
|
-
</div>
|
1064
|
-
<div class="method">
|
1065
|
-
<div class="title">
|
1066
|
-
<a name="M000443"></a><b>sum</b>(identity = 0, &block)
|
1067
|
-
</div>
|
1068
|
-
<div class="description">
|
1069
|
-
<p>
|
1070
|
-
Uses #+ to <a href="Enumerable.html#M000443">sum</a> the enumerated
|
1071
|
-
elements.
|
1072
|
-
</p>
|
1073
|
-
<pre>
|
1074
|
-
[1,2,3].sum #=> 6
|
1075
|
-
[3,3,3].sum #=> 9
|
1076
|
-
</pre>
|
1077
|
-
</div>
|
1078
|
-
<div class="sourcecode">
|
1079
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000443_source')" id="l_M000443_source">+</a> ]</p>
|
1080
|
-
<div id="M000443_source" class="dyn-source">
|
1081
|
-
<pre>
|
1082
|
-
<span class="ruby-comment cmt"># File lib/core/facets/enumerable/sum.rb, line 8</span>
|
1083
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">sum</span>(<span class="ruby-identifier">identity</span> = <span class="ruby-value">0</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span>)
|
1084
|
-
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">block_given?</span>
|
1085
|
-
<span class="ruby-identifier">map</span>(<span class="ruby-operator">&</span><span class="ruby-identifier">block</span>).<span class="ruby-identifier">sum</span>
|
1086
|
-
<span class="ruby-keyword kw">else</span>
|
1087
|
-
<span class="ruby-identifier">inject</span>{ <span class="ruby-operator">|</span><span class="ruby-identifier">sum</span>, <span class="ruby-identifier">element</span><span class="ruby-operator">|</span> <span class="ruby-identifier">sum</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">element</span> } <span class="ruby-operator">||</span> <span class="ruby-identifier">identity</span>
|
1088
|
-
<span class="ruby-keyword kw">end</span>
|
1089
|
-
<span class="ruby-keyword kw">end</span>
|
1090
|
-
</pre>
|
1091
|
-
</div>
|
1092
|
-
</div>
|
1093
|
-
</div>
|
1094
|
-
<div class="method">
|
1095
|
-
<div class="title">
|
1096
|
-
<a name="M000439"></a><b>take</b>(n)
|
1097
|
-
</div>
|
1098
|
-
<div class="description">
|
1099
|
-
<p>
|
1100
|
-
Return the first n items from the collection
|
1101
|
-
</p>
|
1102
|
-
</div>
|
1103
|
-
<div class="sourcecode">
|
1104
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000439_source')" id="l_M000439_source">+</a> ]</p>
|
1105
|
-
<div id="M000439_source" class="dyn-source">
|
1106
|
-
<pre>
|
1107
|
-
<span class="ruby-comment cmt"># File lib/core/facets/enumerable/take.rb, line 7</span>
|
1108
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">take</span>(<span class="ruby-identifier">n</span>)
|
1109
|
-
<span class="ruby-identifier">res</span> = []
|
1110
|
-
<span class="ruby-identifier">count</span> = <span class="ruby-value">0</span>
|
1111
|
-
<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">e</span><span class="ruby-operator">|</span>
|
1112
|
-
<span class="ruby-keyword kw">break</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">count</span> <span class="ruby-operator">>=</span> <span class="ruby-identifier">n</span>
|
1113
|
-
<span class="ruby-identifier">res</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">e</span>
|
1114
|
-
<span class="ruby-identifier">count</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span>
|
1115
|
-
<span class="ruby-keyword kw">end</span>
|
1116
|
-
<span class="ruby-identifier">res</span>
|
1117
|
-
<span class="ruby-keyword kw">end</span>
|
1118
|
-
</pre>
|
1119
|
-
</div>
|
1120
|
-
</div>
|
1121
|
-
</div>
|
1122
|
-
<div class="method">
|
1123
|
-
<div class="title">
|
1124
|
-
<a name="M000433"></a><b>to_h</b>(mode=nil)
|
1125
|
-
</div>
|
1126
|
-
<div class="description">
|
1127
|
-
<p>
|
1128
|
-
Convert an <a href="Enumerable.html">Enumerable</a> object into a hash by
|
1129
|
-
first turning it into an array.
|
1130
|
-
</p>
|
1131
|
-
<p>
|
1132
|
-
CREDIT: Trans
|
1133
|
-
</p>
|
1134
|
-
</div>
|
1135
|
-
<div class="sourcecode">
|
1136
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000433_source')" id="l_M000433_source">+</a> ]</p>
|
1137
|
-
<div id="M000433_source" class="dyn-source">
|
1138
|
-
<pre>
|
1139
|
-
<span class="ruby-comment cmt"># File lib/core/facets/to_hash.rb, line 226</span>
|
1140
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_h</span>(<span class="ruby-identifier">mode</span>=<span class="ruby-keyword kw">nil</span>)
|
1141
|
-
<span class="ruby-identifier">to_a</span>.<span class="ruby-identifier">to_h</span>(<span class="ruby-identifier">mode</span>)
|
1142
|
-
<span class="ruby-keyword kw">end</span>
|
1143
|
-
</pre>
|
1144
|
-
</div>
|
1145
|
-
</div>
|
1146
|
-
</div>
|
1147
|
-
<div class="method">
|
1148
|
-
<div class="title">
|
1149
|
-
<a name="M000437"></a><b>to_h_assoc</b>()
|
1150
|
-
</div>
|
1151
|
-
<div class="sourcecode">
|
1152
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000437_source')" id="l_M000437_source">+</a> ]</p>
|
1153
|
-
<div id="M000437_source" class="dyn-source">
|
1154
|
-
<pre>
|
1155
|
-
<span class="ruby-comment cmt"># File lib/core/facets/to_hash.rb, line 242</span>
|
1156
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_h_assoc</span>
|
1157
|
-
<span class="ruby-identifier">to_a</span>.<span class="ruby-identifier">to_h_assoc</span>
|
1158
|
-
<span class="ruby-keyword kw">end</span>
|
1159
|
-
</pre>
|
1160
|
-
</div>
|
1161
|
-
</div>
|
1162
|
-
</div>
|
1163
|
-
<div class="method">
|
1164
|
-
<div class="title">
|
1165
|
-
<a name="M000434"></a><b>to_h_auto</b>()
|
1166
|
-
</div>
|
1167
|
-
<div class="sourcecode">
|
1168
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000434_source')" id="l_M000434_source">+</a> ]</p>
|
1169
|
-
<div id="M000434_source" class="dyn-source">
|
1170
|
-
<pre>
|
1171
|
-
<span class="ruby-comment cmt"># File lib/core/facets/to_hash.rb, line 230</span>
|
1172
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_h_auto</span>
|
1173
|
-
<span class="ruby-identifier">to_a</span>.<span class="ruby-identifier">to_h_auto</span>
|
1174
|
-
<span class="ruby-keyword kw">end</span>
|
1175
|
-
</pre>
|
1176
|
-
</div>
|
1177
|
-
</div>
|
1178
|
-
</div>
|
1179
|
-
<div class="method">
|
1180
|
-
<div class="title">
|
1181
|
-
<a name="M000436"></a><b>to_h_flat</b>()
|
1182
|
-
</div>
|
1183
|
-
<div class="sourcecode">
|
1184
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000436_source')" id="l_M000436_source">+</a> ]</p>
|
1185
|
-
<div id="M000436_source" class="dyn-source">
|
1186
|
-
<pre>
|
1187
|
-
<span class="ruby-comment cmt"># File lib/core/facets/to_hash.rb, line 238</span>
|
1188
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_h_flat</span>
|
1189
|
-
<span class="ruby-identifier">to_a</span>.<span class="ruby-identifier">to_h_flat</span>
|
1190
|
-
<span class="ruby-keyword kw">end</span>
|
1191
|
-
</pre>
|
1192
|
-
</div>
|
1193
|
-
</div>
|
1194
|
-
</div>
|
1195
|
-
<div class="method">
|
1196
|
-
<div class="title">
|
1197
|
-
<a name="M000438"></a><b>to_h_multi</b>()
|
1198
|
-
</div>
|
1199
|
-
<div class="sourcecode">
|
1200
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000438_source')" id="l_M000438_source">+</a> ]</p>
|
1201
|
-
<div id="M000438_source" class="dyn-source">
|
1202
|
-
<pre>
|
1203
|
-
<span class="ruby-comment cmt"># File lib/core/facets/to_hash.rb, line 246</span>
|
1204
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_h_multi</span>
|
1205
|
-
<span class="ruby-identifier">to_a</span>.<span class="ruby-identifier">to_h_multi</span>
|
1206
|
-
<span class="ruby-keyword kw">end</span>
|
1207
|
-
</pre>
|
1208
|
-
</div>
|
1209
|
-
</div>
|
1210
|
-
</div>
|
1211
|
-
<div class="method">
|
1212
|
-
<div class="title">
|
1213
|
-
<a name="M000435"></a><b>to_h_splat</b>()
|
1214
|
-
</div>
|
1215
|
-
<div class="sourcecode">
|
1216
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000435_source')" id="l_M000435_source">+</a> ]</p>
|
1217
|
-
<div id="M000435_source" class="dyn-source">
|
1218
|
-
<pre>
|
1219
|
-
<span class="ruby-comment cmt"># File lib/core/facets/to_hash.rb, line 234</span>
|
1220
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_h_splat</span>
|
1221
|
-
<span class="ruby-identifier">to_a</span>.<span class="ruby-identifier">to_h_splat</span>
|
1222
|
-
<span class="ruby-keyword kw">end</span>
|
1223
|
-
</pre>
|
1224
|
-
</div>
|
1225
|
-
</div>
|
1226
|
-
</div>
|
1227
|
-
<div class="method">
|
1228
|
-
<div class="title">
|
1229
|
-
<a name="M000453"></a><b>uniq_by</b>( {|| ...}
|
1230
|
-
</div>
|
1231
|
-
<div class="description">
|
1232
|
-
<p>
|
1233
|
-
Like uniq, but determines uniqueness based on a given block.
|
1234
|
-
</p>
|
1235
|
-
<pre>
|
1236
|
-
(-5..5).to_a.uniq_by {|i| i*i }
|
1237
|
-
</pre>
|
1238
|
-
<p>
|
1239
|
-
produces
|
1240
|
-
</p>
|
1241
|
-
<pre>
|
1242
|
-
[-5, -4, -3, -2, -1, 0]
|
1243
|
-
</pre>
|
1244
|
-
</div>
|
1245
|
-
<div class="sourcecode">
|
1246
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000453_source')" id="l_M000453_source">+</a> ]</p>
|
1247
|
-
<div id="M000453_source" class="dyn-source">
|
1248
|
-
<pre>
|
1249
|
-
<span class="ruby-comment cmt"># File lib/core/facets/enumerable/uniq_by.rb, line 11</span>
|
1250
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">uniq_by</span> <span class="ruby-comment cmt">#:yield:</span>
|
1251
|
-
<span class="ruby-identifier">h</span> = {}; <span class="ruby-identifier">inject</span>([]) {<span class="ruby-operator">|</span><span class="ruby-identifier">a</span>,<span class="ruby-identifier">x</span><span class="ruby-operator">|</span> <span class="ruby-identifier">h</span>[<span class="ruby-keyword kw">yield</span>(<span class="ruby-identifier">x</span>)] <span class="ruby-operator">||=</span> <span class="ruby-identifier">a</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">x</span>}
|
1252
|
-
<span class="ruby-keyword kw">end</span>
|
1253
|
-
</pre>
|
1254
|
-
</div>
|
1255
|
-
</div>
|
1256
|
-
</div>
|
1257
|
-
</div>
|
1258
|
-
|
1259
|
-
</div>
|
1260
|
-
|
1261
|
-
</body>
|
1262
|
-
</html>
|