facets 2.8.4 → 2.9.0.pre.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/AUTHORS +2 -0
- data/HISTORY.rdoc +233 -94
- data/NOTICE +27 -0
- data/README.rdoc +131 -49
- data/Rakefile +190 -97
- data/lib/core/facets/applique/file_helpers.rb +33 -0
- data/lib/core/facets/array/after.rb +1 -0
- data/lib/core/facets/array/before.rb +39 -0
- data/lib/core/facets/{enumerable → array}/collapse.rb +0 -0
- data/lib/core/facets/array/collisions.rb +1 -0
- data/lib/core/facets/array/combination.rb +0 -16
- data/lib/core/facets/{enumerable → array}/commonality.rb +8 -6
- data/lib/core/facets/array/conjoin.rb +48 -17
- data/lib/core/facets/{string → array}/contains.rb +0 -0
- data/lib/core/facets/array/delete_unless.rb +1 -1
- data/lib/core/facets/array/divide.rb +20 -0
- data/lib/core/facets/array/duplicates.rb +1 -0
- data/lib/core/facets/{enumerable → array}/entropy.rb +8 -6
- data/lib/core/facets/array/extract_options.rb +31 -0
- data/lib/core/facets/array/from.rb +33 -0
- data/lib/core/facets/array/index.rb +2 -4
- data/lib/core/facets/array/indexable.rb +4 -46
- data/lib/core/facets/array/merge.rb +3 -2
- data/lib/core/facets/array/mode.rb +22 -0
- data/lib/core/facets/array/nonuniq.rb +37 -0
- data/lib/core/facets/array/only.rb +9 -3
- data/lib/core/facets/array/peek.rb +1 -0
- data/lib/core/facets/array/permutation.rb +2 -0
- data/lib/core/facets/array/poke.rb +1 -0
- data/lib/core/facets/{enumerable → array}/probability.rb +9 -6
- data/lib/core/facets/array/product.rb +1 -2
- data/lib/core/facets/array/pull.rb +30 -0
- data/lib/core/facets/array/recurse.rb +29 -0
- data/lib/core/facets/array/recursively.rb +39 -22
- data/lib/core/facets/array/rotate.rb +40 -32
- data/lib/core/facets/array/select.rb +14 -10
- data/lib/core/facets/array/splice.rb +2 -5
- data/lib/core/facets/{enumerable → array}/split.rb +2 -2
- data/lib/core/facets/array/store.rb +12 -0
- data/lib/core/facets/array/thru.rb +1 -0
- data/lib/core/facets/array/traverse.rb +10 -5
- data/lib/core/facets/array/uniq_by.rb +6 -8
- data/lib/core/facets/binding/__callee__.rb +1 -0
- data/lib/core/facets/binding/__method__.rb +1 -0
- data/lib/core/facets/binding/call_stack.rb +1 -0
- data/lib/core/facets/binding/caller.rb +6 -5
- data/lib/core/facets/binding/callstack.rb +1 -1
- data/lib/core/facets/binding/eval.rb +2 -6
- data/lib/core/facets/binding/local_variables.rb +5 -3
- data/lib/core/facets/binding/{opvars.rb → op.rb} +0 -0
- data/lib/core/facets/boolean.rb +27 -59
- data/lib/core/facets/class/descendants.rb +21 -34
- data/lib/core/facets/class/methodize.rb +6 -1
- data/lib/core/facets/class/pathize.rb +6 -1
- data/lib/core/facets/class/subclasses.rb +27 -1
- data/lib/core/facets/class/to_proc.rb +4 -1
- data/lib/core/facets/comparable/bound.rb +1 -1
- data/lib/core/facets/comparable/cmp.rb +3 -0
- data/lib/core/facets/comparable/op_get.rb +45 -0
- data/lib/core/facets/dir/ascend.rb +8 -12
- data/lib/core/facets/dir/each_child.rb +16 -0
- data/lib/core/facets/dir/multiglob.rb +15 -27
- data/lib/core/facets/dir/parent.rb +4 -1
- data/lib/core/facets/dir/recurse.rb +6 -3
- data/lib/core/facets/enumerable/accumulate.rb +47 -9
- data/lib/core/facets/enumerable/cluster_by.rb +1 -4
- data/lib/core/facets/enumerable/compact_map.rb +3 -5
- data/lib/core/facets/enumerable/count.rb +42 -30
- data/lib/core/facets/enumerable/defer.rb +1 -2
- data/lib/core/facets/enumerable/each_with_object.rb +2 -2
- data/lib/core/facets/enumerable/every.rb +16 -11
- data/lib/core/facets/enumerable/ewise.rb +11 -19
- data/lib/core/facets/enumerable/exclude.rb +4 -1
- data/lib/core/facets/enumerable/expand.rb +15 -0
- data/lib/core/facets/enumerable/filter.rb +9 -11
- data/lib/core/facets/enumerable/find_yield.rb +14 -9
- data/lib/core/facets/enumerable/frequency.rb +12 -6
- data/lib/core/facets/enumerable/graph.rb +2 -2
- data/lib/core/facets/enumerable/group_by.rb +13 -7
- data/lib/core/facets/enumerable/map_by.rb +35 -0
- data/lib/core/facets/enumerable/map_send.rb +12 -10
- data/lib/core/facets/enumerable/modulate.rb +1 -1
- data/lib/core/facets/enumerable/none.rb +5 -5
- data/lib/core/facets/enumerable/occur.rb +9 -7
- data/lib/core/facets/enumerable/one.rb +6 -6
- data/lib/core/facets/enumerable/per.rb +35 -13
- data/lib/core/facets/enumerable/recursively.rb +66 -0
- data/lib/core/facets/enumerable/take.rb +11 -15
- data/lib/core/facets/enumerable/uniq_by.rb +1 -4
- data/lib/core/facets/enumerable/visit.rb +4 -4
- data/lib/core/facets/enumerator.rb +17 -12
- data/lib/core/facets/enumerator/fx.rb +24 -8
- data/lib/core/facets/exception/detail.rb +1 -1
- data/lib/core/facets/exception/raised.rb +1 -1
- data/lib/core/facets/exception/suppress.rb +3 -1
- data/lib/core/facets/file/append.rb +2 -2
- data/lib/core/facets/file/create.rb +1 -1
- data/lib/core/facets/file/ext.rb +7 -7
- data/lib/core/facets/file/read_binary.rb +18 -0
- data/lib/core/facets/file/read_list.rb +34 -0
- data/lib/core/facets/file/rewrite.rb +9 -7
- data/lib/core/facets/file/rootname.rb +2 -12
- data/lib/core/facets/file/sanitize.rb +18 -0
- data/lib/core/facets/file/split_all.rb +1 -1
- data/lib/core/facets/file/write.rb +16 -14
- data/lib/core/facets/file/writelines.rb +5 -1
- data/lib/core/facets/functor.rb +53 -52
- data/lib/core/facets/hash/alias.rb +3 -3
- data/lib/core/facets/hash/argumentize.rb +10 -4
- data/lib/core/facets/hash/autonew.rb +10 -12
- data/lib/core/facets/hash/collate.rb +35 -49
- data/lib/core/facets/hash/count.rb +0 -2
- data/lib/core/facets/hash/data.rb +31 -4
- data/lib/core/facets/hash/{recursive_merge.rb → deep_merge.rb} +4 -10
- data/lib/core/facets/hash/delete.rb +4 -47
- data/lib/core/facets/hash/delete_at.rb +7 -0
- data/lib/core/facets/hash/delete_unless.rb +17 -0
- data/lib/core/facets/hash/delete_values.rb +32 -0
- data/lib/core/facets/hash/diff.rb +7 -1
- data/lib/core/facets/hash/except.rb +15 -17
- data/lib/core/facets/hash/inverse.rb +7 -4
- data/lib/core/facets/hash/join.rb +6 -3
- data/lib/core/facets/hash/new_with.rb +1 -1
- data/lib/core/facets/hash/op_and.rb +2 -2
- data/lib/core/facets/hash/op_mul.rb +4 -4
- data/lib/core/facets/hash/recurse.rb +29 -0
- data/lib/core/facets/hash/recursively.rb +50 -18
- data/lib/core/facets/hash/rekey.rb +50 -34
- data/lib/core/facets/hash/{merge.rb → reverse_merge.rb} +0 -0
- data/lib/core/facets/hash/select.rb +10 -6
- data/lib/core/facets/hash/slice.rb +24 -25
- data/lib/core/facets/hash/symbolize_keys.rb +74 -76
- data/lib/core/facets/hash/to_mod.rb +33 -0
- data/lib/core/facets/hash/to_proc.rb +11 -10
- data/lib/core/facets/hash/traverse.rb +4 -4
- data/lib/core/facets/hash/update.rb +1 -1
- data/lib/core/facets/hash/update_values.rb +2 -2
- data/lib/core/facets/hash/weave.rb +2 -7
- data/lib/core/facets/indexable.rb +59 -40
- data/lib/core/facets/{kernel/instance.rb → instance.rb} +3 -2
- data/lib/core/facets/integer/bit.rb +1 -0
- data/lib/core/facets/{bitmask.rb → integer/bitmask.rb} +9 -11
- data/lib/core/facets/integer/factorial.rb +1 -10
- data/lib/core/facets/integer/odd.rb +2 -4
- data/lib/core/facets/integer/of.rb +1 -1
- data/lib/core/facets/kernel/__dir__.rb +10 -6
- data/lib/core/facets/kernel/__get__.rb +8 -3
- data/lib/core/facets/kernel/__method__.rb +12 -6
- data/lib/core/facets/kernel/as.rb +61 -46
- data/lib/core/facets/kernel/ask.rb +11 -11
- data/lib/core/facets/kernel/assign.rb +40 -27
- data/lib/core/facets/kernel/assign_from.rb +1 -45
- data/lib/core/facets/kernel/attr_singleton.rb +22 -25
- data/lib/core/facets/kernel/blank.rb +84 -0
- data/lib/core/facets/kernel/call_stack.rb +56 -0
- data/lib/core/facets/kernel/callstack.rb +1 -52
- data/lib/core/facets/kernel/case.rb +8 -0
- data/lib/core/facets/kernel/clone.rb +1 -0
- data/lib/core/facets/kernel/complete.rb +10 -2
- data/lib/core/facets/kernel/constant.rb +4 -8
- data/lib/core/facets/kernel/d.rb +12 -8
- data/lib/core/facets/kernel/deep_clone.rb +1 -0
- data/lib/core/facets/kernel/deep_copy.rb +27 -2
- data/lib/core/facets/kernel/disable_warnings.rb +26 -0
- data/lib/core/facets/kernel/dup.rb +33 -0
- data/lib/core/facets/kernel/enable_warnings.rb +1 -0
- data/lib/core/facets/kernel/equate.rb +8 -5
- data/lib/core/facets/kernel/ergo.rb +4 -3
- data/lib/core/facets/kernel/extend.rb +17 -1
- data/lib/core/facets/kernel/extension.rb +3 -0
- data/lib/core/facets/kernel/here.rb +1 -2
- data/lib/core/facets/kernel/instance_class.rb +2 -1
- data/lib/core/facets/kernel/load_all.rb +1 -0
- data/lib/core/facets/kernel/load_relative.rb +1 -0
- data/lib/core/facets/kernel/maybe.rb +3 -2
- data/lib/core/facets/kernel/meta_alias.rb +9 -4
- data/lib/core/facets/kernel/meta_class.rb +4 -4
- data/lib/core/facets/kernel/meta_def.rb +0 -2
- data/lib/core/facets/kernel/meta_eval.rb +7 -5
- data/lib/core/facets/kernel/method.rb +5 -4
- data/lib/core/facets/kernel/not.rb +37 -0
- data/lib/core/facets/kernel/not_nil.rb +3 -2
- data/lib/core/facets/kernel/object_hexid.rb +9 -7
- data/lib/core/facets/kernel/object_send.rb +11 -10
- data/lib/core/facets/kernel/object_state.rb +21 -4
- data/lib/core/facets/kernel/p.rb +3 -3
- data/lib/core/facets/kernel/presence.rb +1 -0
- data/lib/core/facets/kernel/present.rb +1 -0
- data/lib/core/facets/kernel/qua_class.rb +15 -3
- data/lib/core/facets/kernel/replace.rb +1 -0
- data/lib/core/facets/kernel/require_all.rb +33 -17
- data/lib/core/facets/kernel/require_relative.rb +10 -10
- data/lib/core/facets/kernel/respond.rb +26 -7
- data/lib/core/facets/kernel/returning.rb +5 -1
- data/lib/core/facets/kernel/silence.rb +39 -41
- data/lib/core/facets/kernel/silence_warnings.rb +1 -0
- data/lib/core/facets/kernel/singleton_class.rb +2 -13
- data/lib/core/facets/kernel/super_method.rb +11 -0
- data/lib/core/facets/kernel/tap.rb +16 -7
- data/lib/core/facets/kernel/temporarily.rb +23 -0
- data/lib/core/facets/kernel/try.rb +43 -10
- data/lib/core/facets/kernel/try_dup.rb +19 -9
- data/lib/core/facets/kernel/writers.rb +91 -0
- data/lib/core/facets/matchdata/matchset.rb +4 -4
- data/lib/core/facets/method.rb +6 -0
- data/lib/core/facets/module/abstract.rb +10 -7
- data/lib/core/facets/module/alias_method_chain.rb +22 -4
- data/lib/core/facets/module/alias_module_function.rb +4 -4
- data/lib/core/facets/module/all_instance_methods.rb +19 -0
- data/lib/core/facets/module/ancestor.rb +1 -1
- data/lib/core/facets/module/anonymous.rb +25 -0
- data/lib/core/facets/module/attr_setter.rb +8 -13
- data/lib/core/facets/module/basename.rb +6 -6
- data/lib/core/facets/module/can.rb +8 -2
- data/lib/core/facets/module/class_method_defined.rb +1 -0
- data/lib/core/facets/module/extend.rb +1 -10
- data/lib/core/facets/module/instance_method.rb +3 -2
- data/lib/core/facets/module/instance_method_defined.rb +23 -0
- data/lib/core/facets/module/integrate.rb +48 -1
- data/lib/core/facets/module/is.rb +5 -5
- data/lib/core/facets/module/method_clash.rb +58 -0
- data/lib/core/facets/module/methodize.rb +7 -1
- data/lib/core/facets/module/modname.rb +22 -0
- data/lib/core/facets/module/nodef.rb +13 -0
- data/lib/core/facets/module/op.rb +37 -22
- data/lib/core/facets/module/op_add.rb +1 -0
- data/lib/core/facets/module/op_mul.rb +1 -0
- data/lib/core/facets/module/op_sub.rb +1 -0
- data/lib/core/facets/module/pathize.rb +8 -10
- data/lib/core/facets/module/redirect_method.rb +5 -5
- data/lib/core/facets/module/remove.rb +1 -0
- data/lib/core/facets/module/rename_method.rb +12 -2
- data/lib/core/facets/module/revise.rb +20 -41
- data/lib/core/facets/module/set.rb +1 -1
- data/lib/core/facets/module/singleton_method_defined.rb +1 -0
- data/lib/core/facets/module/spacename.rb +4 -4
- data/lib/core/facets/module/to_obj.rb +20 -0
- data/lib/core/facets/module/wrap_method.rb +16 -9
- data/lib/core/facets/na.rb +15 -0
- data/lib/core/facets/numeric/round.rb +4 -4
- data/lib/core/facets/numeric/round_at.rb +1 -0
- data/lib/core/facets/numeric/round_to.rb +1 -0
- data/lib/core/facets/object.rb +6 -0
- data/lib/core/facets/objectspace/reflect.rb +26 -11
- data/lib/core/facets/proc/bind.rb +7 -5
- data/lib/core/facets/proc/bind_to.rb +8 -0
- data/lib/{more/facets → core/facets/proc}/partial.rb +9 -15
- data/lib/core/facets/proc/to_method.rb +10 -5
- data/lib/core/facets/process.rb +6 -0
- data/lib/core/facets/process/daemon.rb +32 -0
- data/lib/core/facets/range/combine.rb +1 -1
- data/lib/core/facets/range/within.rb +1 -1
- data/lib/core/facets/regexp/multiline.rb +13 -0
- data/lib/core/facets/regexp/op_add.rb +18 -0
- data/lib/core/facets/regexp/op_or.rb +18 -0
- data/lib/core/facets/string/align.rb +24 -6
- data/lib/core/facets/string/bracket.rb +9 -50
- data/lib/core/facets/string/camelcase.rb +32 -23
- data/lib/core/facets/string/capitalized.rb +7 -4
- data/lib/core/facets/string/characters.rb +13 -0
- data/lib/core/facets/string/cleanlines.rb +3 -13
- data/lib/core/facets/string/cmp.rb +1 -0
- data/lib/core/facets/string/compress_lines.rb +4 -4
- data/lib/core/facets/string/divide.rb +1 -4
- data/lib/core/facets/string/each_char.rb +17 -15
- data/lib/core/facets/string/each_word.rb +5 -1
- data/lib/core/facets/string/edit_distance.rb +64 -2
- data/lib/core/facets/string/file.rb +21 -5
- data/lib/core/facets/string/indent.rb +46 -4
- data/lib/core/facets/string/interpolate.rb +3 -4
- data/lib/core/facets/string/{chomp.rb → lchomp.rb} +0 -0
- data/lib/core/facets/string/line_wrap.rb +2 -5
- data/lib/core/facets/string/lines.rb +1 -1
- data/lib/core/facets/string/methodize.rb +3 -2
- data/lib/core/facets/string/modulize.rb +3 -1
- data/lib/core/facets/string/natcmp.rb +35 -36
- data/lib/core/facets/string/nchar.rb +11 -5
- data/lib/core/facets/string/newlines.rb +10 -13
- data/lib/core/facets/string/op_div.rb +2 -2
- data/lib/core/facets/string/op_sub.rb +1 -1
- data/lib/core/facets/string/pathize.rb +12 -10
- data/lib/core/facets/string/quote.rb +93 -0
- data/lib/core/facets/string/range.rb +11 -7
- data/lib/core/facets/string/rewrite.rb +6 -10
- data/lib/core/facets/string/similarity.rb +24 -27
- data/lib/core/facets/string/splice.rb +6 -10
- data/lib/core/facets/string/squish.rb +22 -0
- data/lib/core/facets/string/start_with.rb +31 -8
- data/lib/core/facets/string/store.rb +7 -0
- data/lib/core/facets/string/titlecase.rb +1 -1
- data/lib/core/facets/string/unbracket.rb +1 -0
- data/lib/core/facets/string/underscore.rb +1 -0
- data/lib/core/facets/string/unindent.rb +1 -0
- data/lib/core/facets/string/unquote.rb +1 -0
- data/lib/core/facets/string/word_wrap.rb +2 -2
- data/lib/core/facets/string/xor.rb +4 -6
- data/lib/core/facets/symbol/as_s.rb +17 -0
- data/lib/core/facets/symbol/bang.rb +1 -0
- data/lib/core/facets/symbol/generate.rb +3 -3
- data/lib/core/facets/symbol/not.rb +1 -1
- data/lib/core/facets/symbol/op_div.rb +8 -6
- data/lib/core/facets/symbol/plain.rb +27 -1
- data/lib/core/facets/symbol/succ.rb +7 -3
- data/lib/core/facets/symbol/thrown.rb +2 -4
- data/lib/core/facets/symbol/to_proc.rb +8 -13
- data/lib/core/facets/symbol/variablize.rb +7 -5
- data/lib/core/facets/time/ago.rb +1 -1
- data/lib/core/facets/time/change.rb +19 -14
- data/lib/core/facets/time/dst_adjustment.rb +24 -0
- data/lib/core/facets/time/elapse.rb +3 -1
- data/lib/core/facets/time/future.rb +4 -4
- data/lib/core/facets/time/hence.rb +1 -97
- data/lib/core/facets/time/in.rb +93 -0
- data/lib/core/facets/time/round_to.rb +21 -0
- data/lib/core/facets/time/set.rb +9 -3
- data/lib/core/facets/time/stamp.rb +2 -1
- data/lib/core/facets/time/to_time.rb +2 -2
- data/lib/core/facets/time/trunc.rb +3 -3
- data/lib/core/facets/to_hash.rb +16 -12
- data/lib/core/facets/unboundmethod/name.rb +3 -3
- data/lib/more/facets/argvector.rb +23 -33
- data/lib/more/facets/atomicfile.rb +51 -0
- data/lib/more/facets/basicobject.rb +6 -6
- data/lib/more/facets/cgi.rb +3 -9
- data/lib/more/facets/continuation.rb +2 -2
- data/lib/more/facets/date.rb +56 -54
- data/lib/more/facets/erb.rb +15 -12
- data/lib/more/facets/fileutils.rb +1 -20
- data/lib/more/facets/fileutils/cp_rx.rb +1 -1
- data/lib/more/facets/fileutils/safe_ln.rb +1 -2
- data/lib/more/facets/fileutils/slice.rb +11 -99
- data/lib/more/facets/fileutils/wc.rb +5 -56
- data/lib/more/facets/fileutils/whereis.rb +8 -6
- data/lib/more/facets/fileutils/which.rb +5 -48
- data/lib/more/facets/find.rb +16 -0
- data/lib/more/facets/getoptlong.rb +11 -23
- data/lib/more/facets/main.rb +27 -40
- data/lib/more/facets/memoizable.rb +141 -0
- data/lib/{core → more}/facets/metaid.rb +2 -2
- data/lib/more/facets/multipliers.rb +6 -38
- data/lib/more/facets/multiton.rb +14 -13
- data/lib/more/facets/nullclass.rb +3 -39
- data/lib/more/facets/opesc.rb +42 -23
- data/lib/more/facets/ostruct.rb +32 -59
- data/lib/more/facets/pathname.rb +53 -43
- data/lib/more/facets/platform.rb +87 -100
- data/lib/more/facets/random.rb +129 -172
- data/lib/more/facets/rbconfig.rb +130 -25
- data/lib/more/facets/reference.rb +7 -23
- data/lib/more/facets/set.rb +5 -0
- data/lib/more/facets/shellwords.rb +22 -4
- data/lib/more/facets/thread.rb +48 -25
- data/lib/more/facets/timer.rb +50 -117
- data/lib/more/facets/tuple.rb +31 -74
- data/lib/more/facets/uri.rb +29 -67
- data/lib/more/facets/yaml.rb +28 -44
- data/lib/more/facets/zlib.rb +3 -3
- data/lib/tour/facets/array/median.rb +14 -0
- data/lib/tour/facets/array/percentile.rb +29 -0
- data/lib/{core/facets/class/prepend.rb → tour/facets/class/preallocate.rb} +10 -10
- data/lib/{more/facets → tour/facets/integer}/roman.rb +8 -7
- data/lib/{core → tour}/facets/kernel/demo.rb +3 -2
- data/lib/{core → tour}/facets/kernel/eigenclass.rb +1 -3
- data/lib/{core → tour}/facets/kernel/instance_exec.rb +3 -6
- data/lib/tour/facets/kernel/memo.rb +38 -0
- data/lib/tour/facets/kernel/trap_chain.rb +20 -0
- data/lib/tour/facets/method/memoize.rb +10 -0
- data/lib/tour/facets/module/attr_class_accessor.rb +33 -0
- data/lib/tour/facets/module/attr_inheritor.rb +13 -0
- data/lib/{more → tour}/facets/module/attr_tester.rb +0 -3
- data/lib/{more → tour}/facets/module/attr_validator.rb +0 -0
- data/lib/tour/facets/module/cattr.rb +240 -0
- data/lib/tour/facets/module/class_accessor.rb +27 -0
- data/lib/tour/facets/module/class_extend.rb +82 -0
- data/lib/{more/facets/inheritor.rb → tour/facets/module/class_inheritor.rb} +12 -38
- data/lib/tour/facets/module/copy_inheritor.rb +39 -0
- data/lib/tour/facets/module/enclosure.rb +62 -0
- data/lib/tour/facets/module/enclosures.rb +1 -0
- data/lib/tour/facets/module/include_as.rb +1 -0
- data/lib/{more/facets → tour/facets/module}/instance_function.rb +26 -16
- data/lib/tour/facets/module/memoize.rb +12 -0
- data/lib/tour/facets/module/method_space.rb +94 -0
- data/lib/{core → tour}/facets/module/module_load.rb +0 -0
- data/lib/{core → tour}/facets/module/prepend.rb +4 -4
- data/lib/tour/facets/regexp/op_or.rb +11 -0
- data/lib/tour/facets/string/crypt.rb +16 -0
- data/lib/tour/facets/string/roman.rb +1 -0
- data/meta/data.rb +29 -0
- data/meta/gemfile +10 -0
- data/meta/profile +24 -0
- data/qed/applique/file_helpers.rb +24 -0
- data/qed/core/array/combination.rdoc +19 -0
- data/qed/core/array/delete.rdoc +23 -0
- data/qed/core/array/index.rdoc +14 -0
- data/qed/core/array/merge.rdoc +15 -0
- data/qed/core/array/only.rdoc +9 -0
- data/qed/core/array/pad.rdoc +28 -0
- data/qed/core/array/permutation.rdoc +10 -0
- data/qed/core/array/product.rdoc +26 -0
- data/qed/core/array/recursively.rdoc +16 -0
- data/qed/core/array/rotate.rdoc +30 -0
- data/qed/core/array/select.rdoc +8 -0
- data/qed/core/array/uniq_by.rdoc +9 -0
- data/qed/core/binding/caller.rdoc +59 -0
- data/qed/core/binding/defined.rdoc +10 -0
- data/qed/core/binding/eval.rdoc +8 -0
- data/qed/core/binding/local_variables.rdoc +26 -0
- data/qed/core/binding/opvars.rdoc +16 -0
- data/qed/core/binding/self.rdoc +6 -0
- data/qed/core/class/descendants.rdoc +10 -0
- data/qed/core/class/to_proc.rdoc +8 -0
- data/qed/core/comparable/cap.rdoc +20 -0
- data/qed/core/comparable/clip.rdoc +37 -0
- data/qed/core/comparable/cmp.rdoc +18 -0
- data/qed/core/comparable/op_get.rdoc +29 -0
- data/qed/core/dir/ascend.rdoc +24 -0
- data/qed/core/dir/descend.rdoc +14 -0
- data/qed/core/dir/multiglob.rdoc +41 -0
- data/qed/core/dir/parent.rdoc +6 -0
- data/qed/core/dir/recurse.rdoc +41 -0
- data/qed/core/exception/detail.rdoc +12 -0
- data/qed/core/facets.rdoc +6 -0
- data/qed/core/filetest/root.rdoc +6 -0
- data/qed/core/hash/recursively.rdoc +21 -0
- data/qed/core/indexable.rdoc +95 -0
- data/qed/core/integer/bitmask.rdoc +46 -0
- data/qed/core/integer/even.rdoc +12 -0
- data/qed/core/integer/factorial.rdoc +10 -0
- data/qed/core/integer/length.rdoc +7 -0
- data/qed/core/integer/multiple.rdoc +10 -0
- data/qed/core/integer/odd.rdoc +12 -0
- data/qed/core/integer/of.rdoc +14 -0
- data/qed/core/integer/ordinal.rdoc +9 -0
- data/qed/core/matchdata/match.rdoc +7 -0
- data/qed/core/matchdata/matchset.rdoc +15 -0
- data/qed/core/string/align.rdoc +34 -0
- data/qed/core/string/bracket.rdoc +35 -0
- data/qed/core/string/bytes.rdoc +8 -0
- data/qed/core/string/camelcase.rdoc +67 -0
- data/qed/core/string/capitalized.rdoc +27 -0
- data/qed/core/string/characters.rdoc +11 -0
- data/qed/core/string/cleanlines.rdoc +10 -0
- data/qed/core/string/cleave.rdoc +49 -0
- data/qed/core/string/divide.rdoc +9 -0
- data/qed/core/string/each_char.rdoc +9 -0
- data/qed/core/string/each_word.rdoc +9 -0
- data/qed/core/string/end_with.rdoc +6 -0
- data/qed/core/string/expand_tabs.rdoc +69 -0
- data/qed/core/string/fold.rdoc +14 -0
- data/qed/core/string/indent.rdoc +65 -0
- data/qed/core/string/interpolate.rdoc +7 -0
- data/qed/core/string/lchomp.rdoc +14 -0
- data/qed/core/string/line_wrap.rdoc +7 -0
- data/qed/core/string/lines.rdoc +8 -0
- data/qed/core/string/margin.rdoc +92 -0
- data/qed/core/string/methodize.rdoc +22 -0
- data/qed/core/string/modulize.rdoc +22 -0
- data/qed/core/string/mscan.rdoc +10 -0
- data/qed/core/string/natcmp.rdoc +10 -0
- data/qed/core/string/nchar.rdoc +9 -0
- data/qed/core/string/newlines.rdoc +9 -0
- data/qed/core/string/op_sub.rdoc +7 -0
- data/qed/core/string/pathize.rdoc +22 -0
- data/qed/core/string/quote.rdoc +20 -0
- data/qed/core/string/range.rdoc +19 -0
- data/qed/core/string/rewrite.rdoc +9 -0
- data/qed/core/string/shatter.rdoc +9 -0
- data/qed/core/string/snakecase.rdoc +9 -0
- data/qed/core/string/splice.rdoc +28 -0
- data/qed/core/string/start_with.rdoc +7 -0
- data/qed/core/string/subtract.rdoc +8 -0
- data/qed/core/string/tab.rdoc +16 -0
- data/qed/core/string/tabto.rdoc +29 -0
- data/qed/core/string/titlecase.rdoc +8 -0
- data/qed/core/string/to_re.rdoc +22 -0
- data/qed/core/string/unfold.rdoc +9 -0
- data/qed/core/string/unindent.rdoc +65 -0
- data/qed/core/string/unquote.rdoc +6 -0
- data/qed/core/string/variablize.rdoc +7 -0
- data/qed/core/string/word_wrap.rdoc +54 -0
- data/qed/core/string/words.rdoc +13 -0
- data/qed/core/string/xor.rdoc +8 -0
- data/qed/more/basic_object.rdoc +22 -0
- data/qed/more/memoizable.rdoc +134 -0
- data/qed/more/mulititon.rdoc +156 -0
- data/qed/tour/module/cattr.rdoc +43 -0
- data/qed/tour/module/class_extend.rdoc +64 -0
- data/qed/tour/module/class_inheritor.rdoc +126 -0
- data/qed/tour/module/copy_inheritor.rdoc +30 -0
- data/qed/tour/module/method_space.rdoc +55 -0
- data/test/core/array/test_after.rb +17 -0
- data/test/core/array/test_before.rb +17 -0
- data/test/core/array/test_collapse.rb +10 -0
- data/test/core/array/test_combination.rb +9 -17
- data/test/core/array/test_commonality.rb +27 -0
- data/test/core/array/test_conjoin.rb +46 -0
- data/test/core/array/test_contains.rb +10 -0
- data/test/core/array/test_delete.rb +12 -15
- data/test/core/array/test_divide.rb +10 -0
- data/test/core/array/test_duplicates.rb +11 -0
- data/test/core/array/test_entropy.rb +15 -0
- data/test/core/array/test_extract_options.rb +20 -0
- data/test/core/array/test_first.rb +13 -0
- data/test/core/array/test_index.rb +6 -7
- data/test/core/array/test_last.rb +13 -0
- data/test/core/array/test_merge.rb +6 -9
- data/test/core/array/test_mode.rb +13 -0
- data/test/core/array/test_nonuniq.rb +17 -0
- data/test/core/array/test_not_empty.rb +13 -0
- data/test/core/array/test_only.rb +7 -15
- data/test/core/array/test_pad.rb +10 -11
- data/test/core/array/test_peek.rb +24 -0
- data/test/core/array/test_permutation.rb +11 -9
- data/test/core/array/test_poke.rb +17 -0
- data/test/core/array/test_probability.rb +11 -0
- data/test/core/array/test_product.rb +25 -12
- data/test/core/array/test_pull.rb +11 -0
- data/test/core/array/test_recurse.rb +17 -0
- data/test/core/array/test_recursively.rb +29 -0
- data/test/core/array/test_rotate.rb +17 -10
- data/test/core/array/test_select.rb +4 -9
- data/test/core/array/test_splice.rb +17 -0
- data/test/core/array/test_split.rb +18 -0
- data/test/core/array/test_store.rb +20 -0
- data/test/core/array/test_traverse.rb +18 -0
- data/test/core/array/test_uniq_by.rb +13 -0
- data/test/core/binding/test_caller.rb +31 -30
- data/test/core/binding/test_defined.rb +9 -11
- data/test/core/binding/test_eval.rb +6 -9
- data/test/core/binding/test_local_variables.rb +24 -16
- data/test/core/binding/test_op.rb +20 -0
- data/test/core/binding/test_self.rb +6 -11
- data/test/core/class/test_descendents.rb +9 -8
- data/test/core/class/test_subclasses.rb +17 -0
- data/test/core/class/test_to_proc.rb +7 -8
- data/test/core/comparable/test_bound.rb +28 -0
- data/test/core/comparable/test_cap.rb +14 -15
- data/test/core/comparable/test_clip.rb +22 -17
- data/test/core/comparable/test_cmp.rb +6 -29
- data/test/core/comparable/{test_comparable.rb → test_op_get.rb} +19 -15
- data/test/core/denumerable_tc.rb +154 -0
- data/test/core/dir/test_ascend.rb +11 -19
- data/test/core/dir/test_descend.rb +7 -12
- data/test/core/dir/test_each_child.rb +18 -0
- data/test/core/dir/test_multiglob.rb +11 -36
- data/test/core/dir/test_parent.rb +4 -5
- data/test/core/dir/test_recurse.rb +10 -34
- data/test/core/enumerable/test_accumulate.rb +36 -0
- data/test/core/enumerable/test_cluster_by.rb +14 -10
- data/test/core/enumerable/test_compact_map.rb +19 -15
- data/test/core/enumerable/test_count.rb +9 -12
- data/test/core/enumerable/test_defer.rb +13 -78
- data/test/core/enumerable/test_each_by.rb +29 -39
- data/test/core/enumerable/test_each_with_object.rb +14 -0
- data/test/core/enumerable/test_every.rb +11 -12
- data/test/core/enumerable/test_ewise.rb +15 -16
- data/test/core/enumerable/test_exclude.rb +11 -0
- data/test/core/enumerable/test_expand.rb +11 -0
- data/test/core/enumerable/test_filter.rb +15 -0
- data/test/core/enumerable/test_find_yield.rb +43 -29
- data/test/core/enumerable/test_frequency.rb +6 -6
- data/test/core/enumerable/test_graph.rb +38 -0
- data/test/core/enumerable/test_group_by.rb +18 -17
- data/test/core/enumerable/test_map_by.rb +23 -0
- data/test/core/enumerable/test_map_send.rb +10 -0
- data/test/core/enumerable/test_map_with_index.rb +9 -5
- data/test/core/enumerable/test_mash.rb +5 -30
- data/test/core/enumerable/test_modulate.rb +4 -5
- data/test/core/enumerable/test_none.rb +6 -4
- data/test/core/enumerable/test_occur.rb +7 -8
- data/test/core/enumerable/test_one.rb +7 -4
- data/test/core/enumerable/test_per.rb +7 -10
- data/test/core/enumerable/test_purge.rb +18 -0
- data/test/core/enumerable/test_recursively.rb +29 -0
- data/test/core/enumerable/test_sum.rb +9 -0
- data/test/core/enumerable/test_take.rb +5 -7
- data/test/core/enumerable/test_uniq_by.rb +13 -7
- data/test/core/enumerable/test_visit.rb +10 -0
- data/test/core/enumerator/test_fx.rb +12 -0
- data/test/core/enumerator/test_new.rb +17 -0
- data/test/core/enumerator_tc.rb +28 -0
- data/test/core/exception/test_detail.rb +16 -0
- data/test/core/exception/test_raised.rb +13 -0
- data/test/core/exception/test_suppress.rb +14 -0
- data/test/core/file/test_append.rb +19 -0
- data/test/core/file/test_create.rb +8 -26
- data/test/core/file/test_ext.rb +15 -19
- data/test/core/file/test_null.rb +4 -6
- data/test/core/file/test_read_binary.rb +15 -0
- data/test/core/file/test_read_list.rb +12 -0
- data/test/core/file/test_rewrite.rb +18 -27
- data/test/core/file/test_rootname.rb +9 -0
- data/test/core/file/test_sanitize.rb +28 -0
- data/test/core/file/test_split_all.rb +5 -27
- data/test/core/file/test_write.rb +10 -23
- data/test/core/file/test_writelines.rb +10 -15
- data/test/core/filetest/test_root.rb +10 -0
- data/test/core/functor_tc.rb +29 -0
- data/test/core/hash/test_alias.rb +8 -7
- data/test/core/hash/test_argumentize.rb +19 -0
- data/test/core/hash/test_at.rb +5 -6
- data/test/core/hash/test_autonew.rb +12 -5
- data/test/core/hash/test_collate.rb +41 -23
- data/test/core/hash/test_count.rb +10 -0
- data/test/core/hash/test_data.rb +31 -0
- data/test/core/hash/test_dearray_values.rb +7 -8
- data/test/core/hash/test_deep_merge.rb +23 -0
- data/test/core/hash/test_delete_at.rb +14 -0
- data/test/core/hash/test_delete_unless.rb +14 -0
- data/test/core/hash/test_delete_values.rb +22 -0
- data/test/core/hash/test_diff.rb +12 -0
- data/test/core/hash/test_expect.rb +16 -0
- data/test/core/hash/test_graph.rb +32 -0
- data/test/core/hash/test_insert.rb +10 -7
- data/test/core/hash/test_inverse.rb +8 -7
- data/test/core/hash/test_join.rb +28 -0
- data/test/core/hash/test_keys.rb +21 -12
- data/test/core/hash/test_new_with.rb +13 -0
- data/test/core/hash/test_op_add.rb +5 -6
- data/test/core/hash/test_op_and.rb +11 -12
- data/test/core/hash/test_op_mul.rb +5 -6
- data/test/core/hash/test_op_or.rb +5 -6
- data/test/core/hash/test_op_push.rb +18 -18
- data/test/core/hash/test_op_sub.rb +8 -9
- data/test/core/hash/test_recurse.rb +18 -0
- data/test/core/hash/test_recursively.rb +67 -0
- data/test/core/hash/test_rekey.rb +46 -48
- data/test/core/hash/test_replace_each.rb +5 -6
- data/test/core/hash/test_reverse_merge.rb +27 -0
- data/test/core/hash/test_select.rb +23 -18
- data/test/core/hash/test_slice.rb +7 -10
- data/test/core/hash/test_stringify_keys.rb +8 -11
- data/test/core/hash/test_swap.rb +5 -5
- data/test/core/hash/test_symbolize_keys.rb +9 -11
- data/test/core/hash/test_to_mod.rb +20 -0
- data/test/core/hash/test_to_proc.rb +19 -0
- data/test/core/hash/test_to_struct.rb +18 -0
- data/test/core/hash/test_traverse.rb +11 -12
- data/test/core/hash/test_update_each.rb +5 -6
- data/test/core/hash/test_update_keys.rb +6 -7
- data/test/core/hash/test_update_values.rb +6 -6
- data/test/core/hash/test_weave.rb +5 -9
- data/test/core/hash/test_zipnew.rb +4 -5
- data/test/core/indexable_tc.rb +177 -0
- data/test/core/integer/test_bitmask.rb +34 -27
- data/test/core/integer/test_even.rb +7 -6
- data/test/core/integer/test_factorial.rb +16 -9
- data/test/core/integer/test_multiple.rb +3 -4
- data/test/core/integer/test_odd.rb +7 -6
- data/test/core/integer/test_of.rb +12 -7
- data/test/core/integer/test_ordinal.rb +14 -8
- data/test/core/kernel/test_as.rb +48 -39
- data/test/core/kernel/test_ask.rb +8 -0
- data/test/core/kernel/test_assign.rb +29 -30
- data/test/core/kernel/test_assign_from.rb +31 -11
- data/test/core/kernel/test_attr_singleton.rb +16 -18
- data/test/core/kernel/test_blank.rb +83 -0
- data/test/core/kernel/test_callstack.rb +8 -5
- data/test/core/kernel/test_class.rb +10 -0
- data/test/core/kernel/test_complete.rb +15 -0
- data/test/core/kernel/test_constant.rb +7 -11
- data/test/core/kernel/test_d.rb +10 -0
- data/test/core/kernel/test_deep_copy.rb +33 -0
- data/test/core/kernel/test_dir.rb +16 -0
- data/test/core/kernel/test_disable_warnings.rb +26 -0
- data/test/core/kernel/test_dup.rb +66 -0
- data/test/core/kernel/test_ergo.rb +23 -0
- data/test/core/kernel/test_extension.rb +14 -0
- data/test/core/kernel/test_get.rb +34 -0
- data/test/core/kernel/test_here.rb +4 -10
- data/test/core/kernel/test_in.rb +5 -6
- data/test/core/kernel/test_instance_assign.rb +7 -8
- data/test/core/kernel/test_instance_class.rb +4 -5
- data/test/core/kernel/test_instance_send.rb +22 -0
- data/test/core/kernel/test_maybe.rb +9 -0
- data/test/core/kernel/test_meta_alias.rb +14 -0
- data/test/core/kernel/test_meta_class.rb +25 -0
- data/test/core/kernel/test_meta_def.rb +11 -0
- data/test/core/kernel/test_meta_eval.rb +14 -0
- data/test/core/kernel/test_method.rb +10 -10
- data/test/core/kernel/test_not.rb +44 -0
- data/test/core/kernel/test_not_nil.rb +16 -8
- data/test/core/kernel/test_object_class.rb +7 -8
- data/test/core/kernel/test_object_hexid.rb +4 -5
- data/test/core/kernel/test_object_send.rb +21 -0
- data/test/core/kernel/test_object_state.rb +72 -0
- data/test/core/kernel/test_presence.rb +29 -0
- data/test/core/kernel/test_qua_class.rb +19 -0
- data/test/core/kernel/test_replace.rb +64 -0
- data/test/core/kernel/test_require_all.rb +11 -0
- data/test/core/kernel/test_require_relative.rb +12 -0
- data/test/core/kernel/test_respond.rb +32 -0
- data/test/core/kernel/test_returning.rb +4 -7
- data/test/core/kernel/test_silence.rb +17 -8
- data/test/core/kernel/test_singleton_class.rb +11 -0
- data/test/core/kernel/test_source_location.rb +18 -0
- data/test/core/kernel/test_super_method.rb +20 -0
- data/test/core/kernel/test_tap.rb +24 -9
- data/test/core/kernel/test_temporarily.rb +21 -0
- data/test/core/kernel/test_true.rb +23 -0
- data/test/core/kernel/test_try.rb +27 -0
- data/test/core/kernel/test_try_dup.rb +46 -0
- data/test/core/kernel/test_val.rb +11 -12
- data/test/core/kernel/test_with.rb +14 -0
- data/test/core/kernel/test_writers.rb +49 -0
- data/test/core/matchdata/test_match.rb +4 -8
- data/test/core/matchdata/test_matchset.rb +8 -10
- data/test/core/module/test_abstract.rb +13 -16
- data/test/core/module/test_alias_accessor.rb +14 -13
- data/test/core/module/test_alias_method_chain.rb +21 -20
- data/test/core/module/test_alias_module_function.rb +14 -12
- data/test/core/module/test_all_instance_methods.rb +23 -0
- data/test/core/module/test_ancestor.rb +6 -5
- data/test/core/module/test_anonymous.rb +14 -0
- data/test/core/module/test_attr_setter.rb +24 -0
- data/test/core/module/test_basename.rb +4 -5
- data/test/core/module/test_can.rb +10 -11
- data/test/core/module/test_class.rb +10 -13
- data/test/core/module/test_class_def.rb +18 -0
- data/test/core/module/test_instance_method.rb +16 -0
- data/test/core/module/test_instance_method_defined.rb +26 -0
- data/test/core/module/test_integrate.rb +15 -14
- data/test/core/module/test_is.rb +34 -10
- data/test/core/module/test_method_clash.rb +50 -0
- data/test/core/module/test_methodize.rb +12 -5
- data/test/core/module/test_modname.rb +9 -0
- data/test/core/module/test_module_def.rb +18 -0
- data/test/core/module/test_nodef.rb +15 -0
- data/test/core/module/test_op.rb +23 -25
- data/test/core/module/test_pathize.rb +11 -9
- data/test/core/module/test_redefine_method.rb +14 -19
- data/test/core/module/test_redirect_method.rb +14 -15
- data/test/core/module/test_remove.rb +15 -0
- data/test/core/module/test_rename_method.rb +16 -17
- data/test/core/module/test_revise.rb +33 -34
- data/test/core/module/test_set.rb +26 -0
- data/test/core/module/test_spacename.rb +5 -8
- data/test/core/module/test_to_obj.rb +16 -0
- data/test/core/module/test_wrap_method.rb +15 -15
- data/test/core/nilclass/test_to_f.rb +4 -5
- data/test/core/numeric/test_approx.rb +4 -4
- data/test/core/numeric/test_distance.rb +6 -7
- data/test/core/numeric/test_length.rb +12 -0
- data/test/core/numeric/test_round.rb +42 -33
- data/test/core/numeric/test_spacing.rb +8 -7
- data/test/core/proc/test_bind.rb +7 -7
- data/test/core/proc/test_bind_to.rb +13 -0
- data/test/core/proc/test_compose.rb +8 -9
- data/test/core/proc/test_curry.rb +11 -13
- data/test/core/proc/test_partial.rb +23 -0
- data/test/core/proc/test_to_method.rb +28 -15
- data/test/core/proc/test_update.rb +11 -0
- data/test/core/range/test_combine.rb +13 -7
- data/test/core/range/test_overlap.rb +3 -7
- data/test/core/range/test_to_r.rb +6 -7
- data/test/core/range/test_umbrella.rb +28 -0
- data/test/core/range/test_within.rb +3 -27
- data/test/core/regexp/test_arity.rb +11 -8
- data/test/core/regexp/test_multiline.rb +15 -0
- data/test/core/regexp/test_op_add.rb +11 -0
- data/test/core/regexp/test_op_or.rb +12 -0
- data/test/core/regexp/test_to_re.rb +6 -7
- data/test/core/string/test_align.rb +13 -11
- data/test/core/string/test_bracket.rb +21 -52
- data/test/core/string/test_bytes.rb +4 -5
- data/test/core/string/test_camelcase.rb +43 -35
- data/test/core/string/test_capitalized.rb +14 -15
- data/test/core/string/test_characters.rb +11 -0
- data/test/core/string/test_cleanlines.rb +4 -5
- data/test/core/string/test_cleave.rb +17 -26
- data/test/core/string/test_cmp.rb +14 -0
- data/test/core/string/test_compress_lines.rb +14 -0
- data/test/core/string/test_divide.rb +4 -5
- data/test/core/string/test_each_char.rb +4 -5
- data/test/core/string/test_each_word.rb +4 -5
- data/test/core/string/test_edit_distance.rb +16 -0
- data/test/core/string/test_end_with.rb +9 -5
- data/test/core/string/test_exclude.rb +19 -0
- data/test/core/string/test_expand_tabs.rb +39 -26
- data/test/core/string/test_file.rb +11 -0
- data/test/core/string/test_fold.rb +6 -7
- data/test/core/string/test_indent.rb +51 -45
- data/test/core/string/test_index_all.rb +10 -0
- data/test/core/string/test_interpolate.rb +4 -8
- data/test/core/string/test_lchomp.rb +6 -7
- data/test/core/string/test_line_wrap.rb +5 -6
- data/test/core/string/test_lines.rb +4 -5
- data/test/core/string/test_lowercase.rb +14 -0
- data/test/core/string/test_margin.rb +17 -18
- data/test/core/string/test_methodize.rb +8 -9
- data/test/core/string/test_modulize.rb +8 -9
- data/test/core/string/test_mscan.rb +6 -7
- data/test/core/string/test_natcmp.rb +8 -12
- data/test/core/string/test_nchar.rb +7 -8
- data/test/core/string/test_newlines.rb +4 -5
- data/test/core/string/test_op_div.rb +11 -0
- data/test/core/string/test_op_sub.rb +4 -5
- data/test/core/string/test_pathize.rb +11 -12
- data/test/core/string/test_quote.rb +38 -0
- data/test/core/string/test_range.rb +12 -12
- data/test/core/string/test_rewrite.rb +5 -6
- data/test/core/string/test_shatter.rb +6 -7
- data/test/core/string/test_similarity.rb +10 -0
- data/test/core/string/test_snakecase.rb +7 -8
- data/test/core/string/test_splice.rb +13 -14
- data/test/core/string/test_squish.rb +23 -0
- data/test/core/string/test_start_with.rb +9 -5
- data/test/core/string/test_store.rb +12 -0
- data/test/core/string/test_subtract.rb +6 -7
- data/test/core/string/test_tab.rb +5 -6
- data/test/core/string/test_tabto.rb +5 -6
- data/test/core/string/test_titlecase.rb +4 -5
- data/test/core/string/test_to_re.rb +15 -15
- data/test/core/string/test_unbracket.rb +26 -0
- data/test/core/string/test_underscore.rb +17 -0
- data/test/core/string/test_unfold.rb +4 -5
- data/test/core/string/test_unindent.rb +100 -0
- data/test/core/string/test_unquote.rb +9 -0
- data/test/core/string/test_uppercase.rb +18 -0
- data/test/core/string/test_variablize.rb +4 -5
- data/test/core/string/test_word_wrap.rb +50 -27
- data/test/core/string/test_words.rb +7 -22
- data/test/core/string/test_xor.rb +4 -5
- data/test/core/symbol/test_as_s.rb +11 -0
- data/test/core/symbol/test_bang.rb +11 -0
- data/test/core/symbol/test_chomp.rb +6 -7
- data/test/core/symbol/test_generate.rb +8 -12
- data/test/core/symbol/test_not.rb +7 -5
- data/test/core/symbol/test_op_div.rb +11 -0
- data/test/core/symbol/test_plain.rb +4 -5
- data/test/core/symbol/test_query.rb +3 -4
- data/test/core/symbol/test_setter.rb +3 -4
- data/test/core/symbol/test_succ.rb +6 -7
- data/test/core/symbol/test_to_proc.rb +13 -13
- data/test/core/symbol/test_variablize.rb +10 -0
- data/test/core/time/test_ago.rb +127 -0
- data/test/core/time/test_change.rb +6 -8
- data/test/core/time/test_dst_adjustment.rb +10 -0
- data/test/core/time/test_elapse.rb +3 -5
- data/test/core/time/test_future.rb +21 -0
- data/test/core/time/test_hence.rb +9 -121
- data/test/core/time/test_in.rb +126 -0
- data/test/core/time/test_past.rb +21 -0
- data/test/core/time/test_round_to.rb +28 -0
- data/test/core/time/test_set.rb +39 -0
- data/test/core/time/test_stamp.rb +19 -14
- data/test/core/time/test_to_time.rb +5 -6
- data/test/core/time/test_trunc.rb +13 -16
- data/test/core/to_hash_tc.rb +163 -0
- data/test/core/unboundmethod/test_arguments.rb +8 -8
- data/test/core/unboundmethod/test_name.rb +6 -6
- data/test/more/test_argvector.rb +27 -27
- data/test/more/test_date.rb +28 -32
- data/test/more/test_memoizable.rb +38 -0
- data/test/more/test_multipliers.rb +45 -48
- data/test/more/test_ostruct.rb +91 -93
- data/test/more/test_random.rb +97 -90
- data/test/more/test_shellwords.rb +46 -11
- data/test/more/test_thread.rb +8 -9
- data/test/more/test_timer.rb +17 -32
- data/test/more/test_tuple.rb +29 -23
- data/test/more/test_uri.rb +10 -13
- data/test/tour/array/test_median.rb +10 -0
- data/test/tour/array/test_percentile.rb +10 -0
- data/test/tour/class/test_preallocate.rb +27 -0
- data/test/tour/module/test_cattr.rb +45 -0
- data/test/tour/module/test_class_extend.rb +66 -0
- data/test/tour/module/test_class_inheritor.rb +148 -0
- data/test/tour/module/test_copy_inheritor.rb +32 -0
- data/test/tour/module/test_enclosure.rb +20 -0
- data/test/tour/module/test_instance_function.rb +26 -0
- data/test/tour/module/test_memoize.rb +30 -0
- data/test/tour/module/test_method_space.rb +64 -0
- data/test/tour/module/test_module_load.rb +19 -0
- data/test/tour/module/test_prepend.rb +24 -0
- metadata +658 -278
- data/NOTES +0 -143
- data/demo/hook.rdoc +0 -49
- data/demo/scenario_require.rdoc +0 -7
- data/lib/core/facets-live.rb +0 -19
- data/lib/core/facets-load.rb +0 -12
- data/lib/core/facets/array/recursive.rb +0 -91
- data/lib/core/facets/array/stackable.rb +0 -33
- data/lib/core/facets/blank.rb +0 -60
- data/lib/core/facets/cattr.rb +0 -2
- data/lib/core/facets/class/cattr.rb +0 -112
- data/lib/core/facets/class/cattr_accessor.rb +0 -1
- data/lib/core/facets/class/cattr_reader.rb +0 -1
- data/lib/core/facets/class/cattr_writer.rb +0 -1
- data/lib/core/facets/class/descendents.rb +0 -1
- data/lib/core/facets/comparable/comparable.rb +0 -42
- data/lib/core/facets/duplicable.rb +0 -32
- data/lib/core/facets/enumerable/collisions.rb +0 -1
- data/lib/core/facets/enumerable/divide.rb +0 -33
- data/lib/core/facets/enumerable/duplicates.rb +0 -38
- data/lib/core/facets/enumerable/mode.rb +0 -16
- data/lib/core/facets/enumerable/recursive.rb +0 -75
- data/lib/core/facets/file/read.rb +0 -41
- data/lib/core/facets/hash/group_by_value.rb +0 -65
- data/lib/core/facets/hash/recursive.rb +0 -180
- data/lib/core/facets/hash/to_module.rb +0 -26
- data/lib/core/facets/kernel/__here__.rb +0 -14
- data/lib/core/facets/kernel/populate.rb +0 -2
- data/lib/core/facets/kernel/require_local.rb +0 -31
- data/lib/core/facets/kernel/resc.rb +0 -16
- data/lib/core/facets/kernel/set_from.rb +0 -2
- data/lib/core/facets/module/conflict.rb +0 -62
- data/lib/core/facets/module/instance_methods.rb +0 -38
- data/lib/core/facets/module/modspace.rb +0 -22
- data/lib/core/facets/module/module_require.rb +0 -1
- data/lib/core/facets/module/nesting.rb +0 -18
- data/lib/core/facets/stackable.rb +0 -86
- data/lib/core/facets/string/chars.rb +0 -20
- data/lib/core/facets/symbol/re_s.rb +0 -18
- data/lib/core/facets/time/advance.rb +0 -18
- data/lib/core/facets/time/round.rb +0 -17
- data/lib/more/facets/ansicode.rb +0 -306
- data/lib/more/facets/autoarray.rb +0 -34
- data/lib/more/facets/autoreload.rb +0 -150
- data/lib/more/facets/blankslate.rb +0 -10
- data/lib/more/facets/casting_hash.rb +0 -172
- data/lib/more/facets/class_extend.rb +0 -126
- data/lib/more/facets/cloneable.rb +0 -76
- data/lib/more/facets/daemonize.rb +0 -44
- data/lib/more/facets/dictionary.rb +0 -430
- data/lib/more/facets/duration.rb +0 -286
- data/lib/more/facets/enumargs.rb +0 -192
- data/lib/more/facets/equitable.rb +0 -120
- data/lib/more/facets/expirable.rb +0 -54
- data/lib/more/facets/filelist.rb +0 -497
- data/lib/more/facets/hashbuilder.rb +0 -101
- data/lib/more/facets/hook.rb +0 -38
- data/lib/more/facets/ini.rb +0 -267
- data/lib/more/facets/instantiable.rb +0 -47
- data/lib/more/facets/linkedlist.rb +0 -195
- data/lib/more/facets/matcher.rb +0 -140
- data/lib/more/facets/memoize.rb +0 -1
- data/lib/more/facets/memoizer.rb +0 -64
- data/lib/more/facets/methodspace.rb +0 -146
- data/lib/more/facets/module/attr.rb +0 -83
- data/lib/more/facets/module/attr_toggler.rb +0 -59
- data/lib/more/facets/module/class_extend.rb +0 -3
- data/lib/more/facets/once.rb +0 -59
- data/lib/more/facets/opencascade.rb +0 -94
- data/lib/more/facets/opencollection.rb +0 -43
- data/lib/more/facets/openhash.rb +0 -39
- data/lib/more/facets/openmodule.rb +0 -16
- data/lib/more/facets/openobject.rb +0 -267
- data/lib/more/facets/orderedhash.rb +0 -5
- data/lib/more/facets/ostructable.rb +0 -209
- data/lib/more/facets/pathlist.rb +0 -105
- data/lib/more/facets/preinitialize.rb +0 -157
- data/lib/more/facets/prepend.rb +0 -57
- data/lib/more/facets/rbsystem.rb +0 -222
- data/lib/more/facets/registerable.rb +0 -35
- data/lib/more/facets/semaphore.rb +0 -92
- data/lib/more/facets/stash.rb +0 -181
- data/lib/more/facets/succ.rb +0 -44
- data/lib/more/facets/version.rb +0 -136
- data/meta/authors +0 -1
- data/meta/collection +0 -1
- data/meta/contact +0 -1
- data/meta/contributors +0 -48
- data/meta/created +0 -1
- data/meta/description +0 -13
- data/meta/homepage +0 -1
- data/meta/license +0 -1
- data/meta/loadpath +0 -2
- data/meta/name +0 -1
- data/meta/released +0 -1
- data/meta/repository +0 -1
- data/meta/sitemap +0 -4
- data/meta/slogan +0 -1
- data/meta/summary +0 -1
- data/meta/version +0 -1
- data/script/conflicts +0 -63
- data/script/methods +0 -49
- data/test/core/array/test_indexable.rb +0 -118
- data/test/core/array/test_recursive.rb +0 -18
- data/test/core/array/test_stackable.rb +0 -22
- data/test/core/binding/test_opvars.rb +0 -24
- data/test/core/class/test_cattr.rb +0 -47
- data/test/core/class/test_cattr_accessor.rb +0 -2
- data/test/core/class/test_cattr_reader.rb +0 -1
- data/test/core/class/test_cattr_writer.rb +0 -1
- data/test/core/enumerable/test_commonality.rb +0 -15
- data/test/core/enumerable/test_entropy.rb +0 -15
- data/test/core/enumerable/test_inject.rb +0 -18
- data/test/core/enumerable/test_probability.rb +0 -11
- data/test/core/enumerable/test_recursive.rb +0 -18
- data/test/core/enumerable/test_split.rb +0 -19
- data/test/core/exception/test_exception.rb +0 -17
- data/test/core/file/test_file.rb +0 -85
- data/test/core/filetest/test_filetest.rb +0 -10
- data/test/core/hash/test_delete.rb +0 -28
- data/test/core/hash/test_mash.rb +0 -20
- data/test/core/hash/test_merge.rb +0 -14
- data/test/core/hash/test_op.rb +0 -1
- data/test/core/hash/test_recursive.rb +0 -23
- data/test/core/hash/test_to_module.rb +0 -21
- data/test/core/integer/test_length.rb +0 -12
- data/test/core/kernel/test_deepcopy.rb +0 -27
- data/test/core/kernel/test_resc.rb +0 -12
- data/test/core/module/test_conflict.rb +0 -24
- data/test/core/module/test_modspace.rb +0 -13
- data/test/core/module/test_nesting.rb +0 -21
- data/test/core/module/test_prepend.rb +0 -29
- data/test/core/string/test_chars.rb +0 -12
- data/test/core/string/test_outdent.rb +0 -65
- data/test/core/test_blank.rb +0 -12
- data/test/core/test_boolean.rb +0 -89
- data/test/core/test_functor.rb +0 -26
- data/test/core/test_metaid.rb +0 -39
- data/test/core/test_to_hash.rb +0 -244
- data/test/core/time/test_round.rb +0 -31
- data/test/more/test_ansicode.rb +0 -20
- data/test/more/test_autoarray.rb +0 -18
- data/test/more/test_basicobject.rb +0 -34
- data/test/more/test_class_extend.rb +0 -64
- data/test/more/test_cloneable.rb +0 -41
- data/test/more/test_continuation.rb +0 -15
- data/test/more/test_dictionary.rb +0 -145
- data/test/more/test_enumargs.rb +0 -70
- data/test/more/test_equitable.rb +0 -42
- data/test/more/test_getoptlong.rb +0 -26
- data/test/more/test_inheritor.rb +0 -148
- data/test/more/test_instance_function.rb +0 -31
- data/test/more/test_instantiable.rb +0 -37
- data/test/more/test_memoize.rb +0 -38
- data/test/more/test_methodspace.rb +0 -78
- data/test/more/test_multiton.rb +0 -184
- data/test/more/test_opencascade.rb +0 -61
- data/test/more/test_openobject.rb +0 -112
- data/test/more/test_partial.rb +0 -27
- data/test/more/test_prepend.rb +0 -28
- data/test/more/test_succ.rb +0 -35
data/lib/more/facets/pathname.rb
CHANGED
@@ -37,10 +37,9 @@ class Pathname
|
|
37
37
|
new(path)
|
38
38
|
end
|
39
39
|
|
40
|
-
#
|
40
|
+
# Start a path. Another alias for #new.
|
41
41
|
#
|
42
|
-
#
|
43
|
-
# p2 = p1 / 'usr' / 'share' #=> Pathname:/usr/share
|
42
|
+
# Pathname / 'usr'
|
44
43
|
#
|
45
44
|
def self./(path)
|
46
45
|
new(path)
|
@@ -65,13 +64,9 @@ class Pathname
|
|
65
64
|
Pathname.new('.')
|
66
65
|
end
|
67
66
|
|
68
|
-
# Try to get this into standard Pathname class.
|
69
|
-
alias_method :/, :+
|
70
|
-
|
71
|
-
# CREDIT Daniel Burger
|
72
|
-
|
73
67
|
# Platform dependent null device.
|
74
68
|
#
|
69
|
+
# CREDIT Daniel Burger
|
75
70
|
def self.null
|
76
71
|
case RUBY_PLATFORM
|
77
72
|
when /mswin/i
|
@@ -85,6 +80,9 @@ class Pathname
|
|
85
80
|
end
|
86
81
|
end
|
87
82
|
|
83
|
+
# Try to get this into standard Pathname class.
|
84
|
+
alias_method :/, :+
|
85
|
+
|
88
86
|
#
|
89
87
|
def rootname
|
90
88
|
self.class.new(File.rootname(to_s))
|
@@ -162,19 +160,21 @@ class Pathname
|
|
162
160
|
#
|
163
161
|
# Example use case:
|
164
162
|
#
|
165
|
-
# #
|
163
|
+
# # Locate any file but *.haml within app/**/*
|
166
164
|
# Pathname.new("app").visit do |f|
|
167
|
-
#
|
168
|
-
#
|
165
|
+
# next unless f.to_s =~ /\.haml$/
|
166
|
+
# f
|
169
167
|
# end
|
170
168
|
#
|
169
|
+
# TODO: Use #map instead of #each ?
|
170
|
+
#
|
171
171
|
# CREDIT: Jean-Denis Vauguet
|
172
172
|
def visit(options = {:all => false, :hidden => false})
|
173
173
|
if self.directory?
|
174
174
|
children.each do |entry|
|
175
175
|
next if entry.basename.to_s[0] == "." && !options[:hidden]
|
176
176
|
yield(entry) unless entry.directory? && !options[:all]
|
177
|
-
|
177
|
+
##entry.visit(:all => options[:all]) { |sub_entry| yield sub_entry } if entry.directory?
|
178
178
|
entry.visit(:all => options[:all], :hidden => options[:hidden]) do |sub_entry|
|
179
179
|
yield(sub_entry)
|
180
180
|
end if entry.directory?
|
@@ -184,37 +184,47 @@ class Pathname
|
|
184
184
|
end
|
185
185
|
end
|
186
186
|
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
187
|
+
## # Already included in 1.8.4+ version of Ruby (except for inclusion flag)
|
188
|
+
## if not instance_methods.include?(:ascend)
|
189
|
+
##
|
190
|
+
## # Calls the _block_ for every successive parent directory of the
|
191
|
+
## # directory path until the root (absolute path) or +.+ (relative path)
|
192
|
+
## # is reached.
|
193
|
+
## def ascend(inclusive=false,&block) # :yield:
|
194
|
+
## cur_dir = self
|
195
|
+
## yield( cur_dir.cleanpath ) if inclusive
|
196
|
+
## until cur_dir.root? or cur_dir == Pathname.new(".")
|
197
|
+
## cur_dir = cur_dir.parent
|
198
|
+
## yield cur_dir
|
199
|
+
## end
|
200
|
+
## end
|
201
|
+
##
|
202
|
+
## end
|
203
|
+
##
|
204
|
+
## # Already included in 1.8.4+ version of Ruby
|
205
|
+
## if ! instance_methods.include?(:descend)
|
206
|
+
##
|
207
|
+
## # Calls the _block_ for every successive subdirectory of the
|
208
|
+
## # directory path from the root (absolute path) until +.+
|
209
|
+
## # (relative path) is reached.
|
210
|
+
## def descend()
|
211
|
+
## @path.scan(%r{[^/]*/?})[0...-1].inject('') do |path, dir|
|
212
|
+
## yield Pathname.new(path << dir)
|
213
|
+
## path
|
214
|
+
## end
|
215
|
+
## end
|
216
|
+
##
|
217
|
+
## end
|
218
|
+
|
219
|
+
# Does a directory contain a matching entry?
|
220
|
+
# Or if the pathname is a file, same as #fnmatch.
|
221
|
+
def include?(pattern,*opts)
|
222
|
+
if directory?
|
223
|
+
glob_first(pattern,*opts)
|
224
|
+
else
|
225
|
+
fnmatch(pattern,*opts)
|
226
|
+
end
|
227
|
+
end
|
218
228
|
|
219
229
|
end
|
220
230
|
|
data/lib/more/facets/platform.rb
CHANGED
@@ -1,30 +1,41 @@
|
|
1
|
-
# Copyright (c) 2007 Eric Hodel
|
2
|
-
#
|
3
|
-
# Available list of platforms.
|
1
|
+
# Original version from RubyGems, Copyright (c) 2007 Eric Hodel
|
4
2
|
|
5
3
|
require 'rbconfig'
|
6
4
|
|
5
|
+
# Platform class
|
6
|
+
#
|
7
7
|
class Platform
|
8
8
|
|
9
|
+
# A pure-ruby gem that may use Gem::Specification#extensions to build
|
10
|
+
# binary files.
|
11
|
+
RUBY = 'ruby'
|
12
|
+
|
13
|
+
# A platform-specific gem that is built for the packaging ruby's platform.
|
14
|
+
# This will be replaced with Gem::Platform::local.
|
15
|
+
CURRENT = 'current'
|
16
|
+
|
9
17
|
@local = nil
|
10
18
|
@supported = nil
|
11
19
|
|
20
|
+
#
|
12
21
|
attr_accessor :cpu
|
13
22
|
|
23
|
+
#
|
14
24
|
attr_accessor :os
|
15
25
|
|
26
|
+
#
|
16
27
|
attr_accessor :version
|
17
28
|
|
18
|
-
RbConfig = Config unless defined? ::RbConfig
|
29
|
+
##RbConfig = Config unless defined? ::RbConfig
|
19
30
|
|
20
|
-
DEPRECATED_CONSTS = [
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
]
|
31
|
+
##DEPRECATED_CONSTS = [
|
32
|
+
## :DARWIN,
|
33
|
+
## :LINUX_586,
|
34
|
+
## :MSWIN32,
|
35
|
+
## :PPC_DARWIN,
|
36
|
+
## :WIN32,
|
37
|
+
## :X86_LINUX
|
38
|
+
##]
|
28
39
|
|
29
40
|
# Array of supported platforms (ie. pure-Ruby and local platform).
|
30
41
|
|
@@ -32,20 +43,22 @@ class Platform
|
|
32
43
|
@suported ||= [Platform::RUBY, Platform.local]
|
33
44
|
end
|
34
45
|
|
35
|
-
def self.const_missing(name) # TODO remove six months from 2007/12
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
end
|
46
|
+
##def self.const_missing(name) # TODO remove six months from 2007/12
|
47
|
+
## if DEPRECATED_CONSTS.include? name then
|
48
|
+
## raise NameError, "#{name} has been removed, use CURRENT instead"
|
49
|
+
## else
|
50
|
+
## super
|
51
|
+
## end
|
52
|
+
##end
|
42
53
|
|
54
|
+
#
|
43
55
|
def self.local
|
44
|
-
arch =
|
56
|
+
arch = Config::CONFIG['arch']
|
45
57
|
arch = "#{arch}_60" if arch =~ /mswin32$/
|
46
58
|
@local ||= new(arch)
|
47
59
|
end
|
48
60
|
|
61
|
+
#
|
49
62
|
def self.match(platform)
|
50
63
|
supported.any? do |local_platform|
|
51
64
|
platform.nil? or local_platform == platform or
|
@@ -53,6 +66,7 @@ class Platform
|
|
53
66
|
end
|
54
67
|
end
|
55
68
|
|
69
|
+
#
|
56
70
|
def self.new(arch) # :nodoc:
|
57
71
|
case arch
|
58
72
|
when Platform::CURRENT then
|
@@ -64,6 +78,7 @@ class Platform
|
|
64
78
|
end
|
65
79
|
end
|
66
80
|
|
81
|
+
#
|
67
82
|
def initialize(arch)
|
68
83
|
case arch
|
69
84
|
when Array then
|
@@ -92,26 +107,26 @@ class Platform
|
|
92
107
|
@cpu, os = nil, cpu if os.nil? # legacy jruby
|
93
108
|
|
94
109
|
@os, @version = case os
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
110
|
+
when /aix(\d+)/ then [ 'aix', $1 ]
|
111
|
+
when /cygwin/ then [ 'cygwin', nil ]
|
112
|
+
when /darwin(\d+)?/ then [ 'darwin', $1 ]
|
113
|
+
when /freebsd(\d+)/ then [ 'freebsd', $1 ]
|
114
|
+
when /hpux(\d+)/ then [ 'hpux', $1 ]
|
115
|
+
when /^java$/, /^jruby$/ then [ 'java', nil ]
|
116
|
+
when /^java([\d.]*)/ then [ 'java', $1 ]
|
117
|
+
when /linux/ then [ 'linux', $1 ]
|
118
|
+
when /mingw32/ then [ 'mingw32', nil ]
|
119
|
+
when /(mswin\d+)(\_(\d+))?/ then
|
120
|
+
os, version = $1, $3
|
121
|
+
@cpu = 'x86' if @cpu.nil? and os =~ /32$/
|
122
|
+
[os, version]
|
123
|
+
when /netbsdelf/ then [ 'netbsdelf', nil ]
|
124
|
+
when /openbsd(\d+\.\d+)/ then [ 'openbsd', $1 ]
|
125
|
+
when /solaris(\d+\.\d+)/ then [ 'solaris', $1 ]
|
126
|
+
# test
|
127
|
+
when /^(\w+_platform)(\d+)/ then [ $1, $2 ]
|
128
|
+
else [ 'unknown', nil ]
|
129
|
+
end
|
115
130
|
when Platform then
|
116
131
|
@cpu = arch.cpu
|
117
132
|
@os = arch.os
|
@@ -121,23 +136,28 @@ class Platform
|
|
121
136
|
end
|
122
137
|
end
|
123
138
|
|
139
|
+
#
|
124
140
|
def inspect
|
125
141
|
"#<%s:0x%x @cpu=%p, @os=%p, @version=%p>" % [self.class, object_id, *to_a]
|
126
142
|
end
|
127
143
|
|
144
|
+
#
|
128
145
|
def to_a
|
129
146
|
[@cpu, @os, @version]
|
130
147
|
end
|
131
148
|
|
149
|
+
#
|
132
150
|
def to_s
|
133
151
|
to_a.compact.join '-'
|
134
152
|
end
|
135
153
|
|
154
|
+
#
|
136
155
|
def ==(other)
|
137
156
|
self.class === other and
|
138
157
|
@cpu == other.cpu and @os == other.os and @version == other.version
|
139
158
|
end
|
140
159
|
|
160
|
+
#
|
141
161
|
def ===(other)
|
142
162
|
return nil unless Platform === other
|
143
163
|
|
@@ -151,22 +171,23 @@ class Platform
|
|
151
171
|
(@version.nil? or other.version.nil? or @version == other.version)
|
152
172
|
end
|
153
173
|
|
174
|
+
#
|
154
175
|
def =~(other)
|
155
176
|
case other
|
156
177
|
when Platform then # nop
|
157
178
|
when String then
|
158
179
|
# This data is from http://gems.rubyforge.org/gems/yaml on 19 Aug 2007
|
159
180
|
other = case other
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
181
|
+
when /^i686-darwin(\d)/ then ['x86', 'darwin', $1]
|
182
|
+
when /^i\d86-linux/ then ['x86', 'linux', nil]
|
183
|
+
when 'java', 'jruby' then [nil, 'java', nil]
|
184
|
+
when /mswin32(\_(\d+))?/ then ['x86', 'mswin32', $2]
|
185
|
+
when 'powerpc-darwin' then ['powerpc', 'darwin', nil]
|
186
|
+
when /powerpc-darwin(\d)/ then ['powerpc', 'darwin', $1]
|
187
|
+
when /sparc-solaris2.8/ then ['sparc', 'solaris', '2.8']
|
188
|
+
when /universal-darwin(\d)/ then ['universal', 'darwin', $1]
|
189
|
+
else other
|
190
|
+
end
|
170
191
|
|
171
192
|
other = Platform.new other
|
172
193
|
else
|
@@ -176,63 +197,29 @@ class Platform
|
|
176
197
|
self === other
|
177
198
|
end
|
178
199
|
|
179
|
-
|
180
|
-
#
|
181
|
-
#
|
182
|
-
|
183
|
-
RUBY = 'ruby'
|
184
|
-
|
185
|
-
##
|
186
|
-
# A platform-specific gem that is built for the packaging ruby's platform.
|
187
|
-
# This will be replaced with Gem::Platform::local.
|
188
|
-
|
189
|
-
CURRENT = 'current'
|
190
|
-
|
191
|
-
# Determine byte order of underlying machine.
|
200
|
+
# Byte order of CPU.
|
201
|
+
#
|
202
|
+
# TODO: This doesn't work well apearently. We need to use a chart for possible
|
203
|
+
# cpus instead, maybe.
|
192
204
|
def byte_order
|
193
|
-
|
205
|
+
if [0x12345678].pack("L") == "\x12\x34\x56\x78"
|
206
|
+
BigEndian
|
207
|
+
else
|
208
|
+
LittleEndian
|
209
|
+
end
|
194
210
|
end
|
195
211
|
|
212
|
+
#
|
213
|
+
alias_method :byteorder, :byte_order
|
214
|
+
|
215
|
+
#
|
196
216
|
def little_endian?
|
197
|
-
|
217
|
+
byte_order == :little
|
198
218
|
end
|
199
219
|
|
220
|
+
#
|
200
221
|
def big_endian?
|
201
|
-
|
202
|
-
end
|
203
|
-
|
204
|
-
# Copyright (c) 2003 Michael Neumann
|
205
|
-
module ByteOrder
|
206
|
-
Native = :Native
|
207
|
-
BigEndian = Big = Network = :BigEndian
|
208
|
-
LittleEndian = Little = :LittleEndian
|
209
|
-
|
210
|
-
# examines the byte order of the underlying machine
|
211
|
-
def byte_order
|
212
|
-
if [0x12345678].pack("L") == "\x12\x34\x56\x78"
|
213
|
-
BigEndian
|
214
|
-
else
|
215
|
-
LittleEndian
|
216
|
-
end
|
217
|
-
end
|
218
|
-
|
219
|
-
alias_method :byteorder, :byte_order
|
220
|
-
|
221
|
-
def little_endian?
|
222
|
-
byte_order == LittleEndian
|
223
|
-
end
|
224
|
-
|
225
|
-
def big_endian?
|
226
|
-
byte_order == BigEndian
|
227
|
-
end
|
228
|
-
|
229
|
-
alias_method :little?, :little_endian?
|
230
|
-
alias_method :big?, :big_endian?
|
231
|
-
alias_method :network?, :big_endian?
|
232
|
-
|
233
|
-
module_function :byte_order, :byteorder
|
234
|
-
module_function :little_endian?, :little?
|
235
|
-
module_function :big_endian?, :big?, :network?
|
222
|
+
byte_order == :big
|
236
223
|
end
|
237
224
|
|
238
225
|
end
|
data/lib/more/facets/random.rb
CHANGED
@@ -1,142 +1,129 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
1
|
+
require 'facets/hash/zipnew'
|
2
|
+
require 'facets/string/shatter'
|
3
|
+
require 'facets/kernel/maybe'
|
4
|
+
|
5
|
+
# = Randomization Extensions
|
4
6
|
#
|
5
|
-
# This library extends
|
6
|
-
# methods. Most of the methods are of one of two kinds. Either they "pick"
|
7
|
-
#
|
7
|
+
# This library extends Array, String, Hash and other classes with randomization
|
8
|
+
# methods. Most of the methods are of one of two kinds. Either they "pick" a
|
9
|
+
# random element from the reciever or they randomly "shuffle" the reciever.
|
8
10
|
#
|
9
11
|
# The most common example is Array#shuffle, which simply randmomizes the
|
10
12
|
# order of an array's elements.
|
11
13
|
#
|
12
|
-
# [1,2,3].shuffle
|
14
|
+
# [1,2,3].shuffle #~> [2,3,1]
|
13
15
|
#
|
14
16
|
# The other methods do similar things for their respective classes.
|
15
17
|
#
|
16
|
-
#
|
17
|
-
#
|
18
|
-
# * Ilmari Heikkinen <mailto:kig@misfiring.net>
|
19
|
-
# * Christian Neukirchen <mailto:chneukirchen@gmail.com>
|
20
|
-
# * Thomas Sawyer
|
21
|
-
#
|
22
|
-
# == Copying
|
18
|
+
# The classes are all extended via mixins which have been created within
|
19
|
+
# Ruby's Random class.
|
23
20
|
#
|
24
|
-
#
|
21
|
+
# Credit for this work is due to:
|
25
22
|
#
|
26
|
-
#
|
27
|
-
#
|
28
|
-
#
|
29
|
-
# software under the same terms as Ruby.
|
23
|
+
# * Ilmari Heikkinen
|
24
|
+
# * Christian Neukirchen
|
25
|
+
# * Thomas Sawyer
|
30
26
|
#
|
31
|
-
#
|
32
|
-
#
|
33
|
-
#
|
27
|
+
# NOTE: Inline QED tests are almost pointless here b/c... yea, it's random.
|
28
|
+
# So indtead of the usual `#=>` we use `#~>` which means approx. equal and
|
29
|
+
# prevens QED from making a hard assertion.
|
34
30
|
|
35
|
-
|
36
|
-
require 'facets/string/shatter'
|
37
|
-
|
38
|
-
# = Random
|
39
|
-
#
|
40
|
-
# Randomization core extension methods.
|
41
|
-
#
|
42
|
-
# This library extends Array, String and Hash with randomization methods.
|
43
|
-
# Most of the methods are of one of two kinds. Either they "pick" a random
|
44
|
-
# element from the reciever or they randomly "shuffle" the reciever.
|
45
|
-
#
|
46
|
-
# The most common example is Array#shuffle, which simply randmomizes the
|
47
|
-
# order of an array's elements.
|
48
|
-
#
|
49
|
-
# [1,2,3].shuffle #=> [2,3,1]
|
50
|
-
#
|
51
|
-
# The other methods do similar things for their respective classes.
|
52
|
-
#
|
53
|
-
module Random
|
31
|
+
class Random
|
54
32
|
|
55
33
|
class << self
|
56
34
|
# Alias for Kernel#rand.
|
57
35
|
alias_method :number, :rand
|
36
|
+
|
58
37
|
public :number
|
59
38
|
end
|
60
39
|
|
61
|
-
|
62
|
-
|
63
|
-
|
40
|
+
##def self.number(*args)
|
41
|
+
## ::Kernel.rand(*args)
|
42
|
+
##end
|
64
43
|
|
44
|
+
# Module method to generate a random letter.
|
65
45
|
#
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
elsif mod == ::Range
|
70
|
-
mod.send(:include, Random::Range)
|
71
|
-
elsif mod == ::Array
|
72
|
-
mod.send(:include, Random::Array)
|
73
|
-
elsif mod == ::Hash
|
74
|
-
mod.send(:include, Random::Hash)
|
75
|
-
elsif mod == ::String
|
76
|
-
mod.send(:include, Random::String)
|
77
|
-
else
|
78
|
-
raise TypeError
|
79
|
-
end
|
80
|
-
end
|
81
|
-
|
46
|
+
# Random.letter #~> "q"
|
47
|
+
# Random.letter #~> "r"
|
48
|
+
# Random.letter #~> "a"
|
82
49
|
#
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
# Random generator that returns true or false.
|
87
|
-
# Can also take a block that has a 50/50 chance to being executed.
|
88
|
-
#
|
89
|
-
# maybe #=> true
|
90
|
-
# maybe #=> false
|
91
|
-
#
|
92
|
-
def maybe(chance = 0.5, &block)
|
93
|
-
if block then
|
94
|
-
yield if rand < chance
|
95
|
-
else
|
96
|
-
rand < chance
|
97
|
-
end
|
98
|
-
end
|
99
|
-
|
50
|
+
def self.letter
|
51
|
+
(Random.number(26) + (Random.number(2) == 0 ? 65 : 97) ).chr
|
100
52
|
end
|
101
53
|
|
102
54
|
#
|
103
|
-
|
104
|
-
module Range
|
105
|
-
|
55
|
+
module RangeExtensions
|
106
56
|
# Return a random element from the range.
|
107
57
|
#
|
108
|
-
# (1..4).at_rand
|
109
|
-
# (1..4).at_rand
|
58
|
+
# (1..4).at_rand #~> 2
|
59
|
+
# (1..4).at_rand #~> 4
|
110
60
|
#
|
111
|
-
# (1.5..2.5).at_rand
|
112
|
-
# (1.5..2.5).at_rand
|
61
|
+
# (1.5..2.5).at_rand #~> 2.06309842754533
|
62
|
+
# (1.5..2.5).at_rand #~> 1.74976944931541
|
113
63
|
#
|
114
|
-
# ('a'..'z').at_rand
|
115
|
-
# ('a'..'z').at_rand
|
64
|
+
# ('a'..'z').at_rand #~> 'q'
|
65
|
+
# ('a'..'z').at_rand #~> 'f'
|
116
66
|
#
|
117
|
-
# CREDIT: Lavir the Whiolet
|
118
|
-
|
67
|
+
# CREDIT: Lavir the Whiolet, Thomas Sawyer
|
119
68
|
def at_rand
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
69
|
+
first, last = first(), last()
|
70
|
+
if first.respond_to?(:random_delta) # TODO: work on this!!!
|
71
|
+
begin
|
72
|
+
first.random_delta(last, exclude_end?)
|
73
|
+
rescue
|
74
|
+
to_a.at_rand
|
75
|
+
end
|
125
76
|
else
|
126
|
-
|
77
|
+
to_a.at_rand
|
127
78
|
end
|
79
|
+
##elsif first.respond_to?(:succ)
|
80
|
+
## # optimized algorithm
|
81
|
+
## if (Fixnum === first || Bignum === first) &&
|
82
|
+
## (Fixnum === last || Bignum === last)
|
83
|
+
## last -= 1 if exclude_end?
|
84
|
+
## return nil if last < first
|
85
|
+
## return Random.number(last - first + 1) + first
|
86
|
+
## end
|
87
|
+
## # standard algorithm
|
88
|
+
## return to_a.at_rand
|
89
|
+
##elsif Numeric === first && Numeric === last
|
90
|
+
## return nil if last < first
|
91
|
+
## return nil if exclude_end? && last == first
|
92
|
+
## return (last - first) * Random.number + first
|
93
|
+
##else
|
94
|
+
## return nil
|
95
|
+
##end
|
128
96
|
end
|
129
|
-
|
130
97
|
end
|
131
98
|
|
132
99
|
#
|
100
|
+
module IntegerExtensions
|
101
|
+
#
|
102
|
+
def random_delta(last, exclude_end)
|
103
|
+
first = self
|
104
|
+
last -= 1 if exclude_end
|
105
|
+
return nil if last < first
|
106
|
+
return Random.number(last - first + 1) + first
|
107
|
+
end
|
108
|
+
end
|
133
109
|
|
134
|
-
|
110
|
+
#
|
111
|
+
module NumericExtensions
|
112
|
+
#
|
113
|
+
def random_delta(last, exclude_end)
|
114
|
+
first = self
|
115
|
+
return nil if last < first
|
116
|
+
return nil if exclude_end && last == first
|
117
|
+
return (last - first) * Random.number + first
|
118
|
+
end
|
119
|
+
end
|
135
120
|
|
121
|
+
#
|
122
|
+
module ArrayExtensions
|
136
123
|
# Return a random element from the array.
|
137
124
|
#
|
138
|
-
# [1, 2, 3, 4].at_rand
|
139
|
-
# [1, 2, 3, 4].at_rand
|
125
|
+
# [1, 2, 3, 4].at_rand #~> 2
|
126
|
+
# [1, 2, 3, 4].at_rand #~> 4
|
140
127
|
#
|
141
128
|
def at_rand
|
142
129
|
at(Random.number(size))
|
@@ -146,8 +133,8 @@ module Random
|
|
146
133
|
# random element from the array.
|
147
134
|
#
|
148
135
|
# a = [1,2,3,4]
|
149
|
-
# a.at_rand!
|
150
|
-
# a
|
136
|
+
# a.at_rand! #~> 2
|
137
|
+
# a #~> [1,3,4]
|
151
138
|
#
|
152
139
|
def at_rand!
|
153
140
|
return delete_at( Random.number( size ) )
|
@@ -201,10 +188,10 @@ module Random
|
|
201
188
|
# _number_ given is greater than the size of the array,
|
202
189
|
# then all values are returned.
|
203
190
|
#
|
204
|
-
# [1, 2, 3, 4].rand_subset(1)
|
205
|
-
# [1, 2, 3, 4].rand_subset(4)
|
206
|
-
# [1, 2, 3, 4].rand_subset
|
207
|
-
# [1, 2, 3, 4].rand_subset
|
191
|
+
# [1, 2, 3, 4].rand_subset(1) #~> [2]
|
192
|
+
# [1, 2, 3, 4].rand_subset(4) #~> [2, 1, 3, 4]
|
193
|
+
# [1, 2, 3, 4].rand_subset #~> [1, 3, 4]
|
194
|
+
# [1, 2, 3, 4].rand_subset #~> [2, 3]
|
208
195
|
#
|
209
196
|
def rand_subset( number=nil, exclusive=true )
|
210
197
|
number = Random.number(size) unless number
|
@@ -217,7 +204,7 @@ module Random
|
|
217
204
|
|
218
205
|
# Randomize the order of an array.
|
219
206
|
#
|
220
|
-
# [1,2,3,4].shuffle
|
207
|
+
# [1,2,3,4].shuffle #~> [2,4,1,3]
|
221
208
|
#
|
222
209
|
def shuffle
|
223
210
|
dup.shuffle!
|
@@ -229,10 +216,10 @@ module Random
|
|
229
216
|
#
|
230
217
|
# a = [1,2,3,4]
|
231
218
|
# a.shuffle!
|
232
|
-
#
|
219
|
+
#
|
220
|
+
# a #~> [2,4,1,3]
|
233
221
|
#
|
234
222
|
# CREDIT Niel Spring
|
235
|
-
|
236
223
|
def shuffle!
|
237
224
|
s = size
|
238
225
|
each_index do |j|
|
@@ -248,12 +235,10 @@ module Random
|
|
248
235
|
end
|
249
236
|
|
250
237
|
#
|
251
|
-
|
252
|
-
module Hash
|
253
|
-
|
238
|
+
module HashExtensions
|
254
239
|
# Returns a random key.
|
255
240
|
#
|
256
|
-
# {:one => 1, :two => 2, :three => 3}.pick_key
|
241
|
+
# {:one => 1, :two => 2, :three => 3}.pick_key #~> :three
|
257
242
|
#
|
258
243
|
def rand_key
|
259
244
|
keys.at(Random.number(keys.size))
|
@@ -262,8 +247,8 @@ module Random
|
|
262
247
|
# Delete a random key-value pair, returning the key.
|
263
248
|
#
|
264
249
|
# a = {:one => 1, :two => 2, :three => 3}
|
265
|
-
# a.
|
266
|
-
# a
|
250
|
+
# a.rand_key! #~> :two
|
251
|
+
# a #~> {:one => 1, :three => 3}
|
267
252
|
#
|
268
253
|
def rand_key!
|
269
254
|
k,v = rand_pair
|
@@ -275,7 +260,7 @@ module Random
|
|
275
260
|
|
276
261
|
# Returns a random key-value pair.
|
277
262
|
#
|
278
|
-
# {:one => 1, :two => 2, :three => 3}.pick
|
263
|
+
# {:one => 1, :two => 2, :three => 3}.pick #~> [:one, 1]
|
279
264
|
#
|
280
265
|
def rand_pair
|
281
266
|
k = rand_key
|
@@ -285,8 +270,8 @@ module Random
|
|
285
270
|
# Deletes a random key-value pair and returns that pair.
|
286
271
|
#
|
287
272
|
# a = {:one => 1, :two => 2, :three => 3}
|
288
|
-
# a.rand_pair!
|
289
|
-
# a
|
273
|
+
# a.rand_pair! #~> [:two, 2]
|
274
|
+
# a #~> {:one => 1, :three => 3}
|
290
275
|
#
|
291
276
|
def rand_pair!
|
292
277
|
k,v = rand_pair
|
@@ -298,8 +283,8 @@ module Random
|
|
298
283
|
|
299
284
|
# Returns a random hash value.
|
300
285
|
#
|
301
|
-
# {:one => 1, :two => 2, :three => 3}.rand_value
|
302
|
-
# {:one => 1, :two => 2, :three => 3}.rand_value
|
286
|
+
# {:one => 1, :two => 2, :three => 3}.rand_value #~> 2
|
287
|
+
# {:one => 1, :two => 2, :three => 3}.rand_value #~> 1
|
303
288
|
#
|
304
289
|
def rand_value
|
305
290
|
fetch(rand_key)
|
@@ -308,8 +293,8 @@ module Random
|
|
308
293
|
# Deletes a random key-value pair and returns the value.
|
309
294
|
#
|
310
295
|
# a = {:one => 1, :two => 2, :three => 3}
|
311
|
-
# a.at_rand!
|
312
|
-
# a
|
296
|
+
# a.at_rand! #~> 2
|
297
|
+
# a #~> {:one => 1, :three => 3}
|
313
298
|
#
|
314
299
|
def rand_value!
|
315
300
|
k,v = rand_pair
|
@@ -326,7 +311,7 @@ module Random
|
|
326
311
|
# in new random order.
|
327
312
|
#
|
328
313
|
# h = {:a=>1, :b=>2, :c=>3}
|
329
|
-
# h.
|
314
|
+
# h.shuffle #~> {:b=>2, :c=>1, :a>3}
|
330
315
|
#
|
331
316
|
def shuffle
|
332
317
|
::Hash.zipnew( keys.sort_by{Random.number}, values.sort_by{Random.number} )
|
@@ -336,8 +321,8 @@ module Random
|
|
336
321
|
# a new random order.
|
337
322
|
#
|
338
323
|
# h = {:a => 1, :b => 2, :c => 3}
|
339
|
-
# h.
|
340
|
-
# h
|
324
|
+
# h.shuffle!
|
325
|
+
# h #~> {:b=>2, :c=>1, :a=>3}
|
341
326
|
#
|
342
327
|
def shuffle!
|
343
328
|
self.replace(shuffle)
|
@@ -346,31 +331,26 @@ module Random
|
|
346
331
|
end
|
347
332
|
|
348
333
|
#
|
334
|
+
module StringExtensions
|
349
335
|
|
350
|
-
|
351
|
-
|
336
|
+
#
|
352
337
|
def self.included(base)
|
353
338
|
base.extend(Self)
|
354
339
|
end
|
355
340
|
|
356
341
|
# Class-level methods.
|
357
|
-
|
358
342
|
module Self
|
359
|
-
|
360
343
|
# Returns a randomly generated string. One possible use is
|
361
344
|
# password initialization. Takes a max legnth of characters
|
362
345
|
# (default 8) and an optional valid char Regexp (default /\w\d/).
|
363
346
|
#
|
364
|
-
|
365
|
-
# CREDIT George Moschovitis
|
347
|
+
# String.random #~> 'dd4qed4r'
|
366
348
|
#
|
367
|
-
#
|
349
|
+
# CREDIT George Moschovitis
|
350
|
+
#--
|
351
|
+
# TODO: This is not very efficient. Better way?
|
368
352
|
#++
|
369
|
-
|
370
353
|
def random(max_length = 8, char_re = /[\w\d]/)
|
371
|
-
# gmosx: this is a nice example of input parameter checking.
|
372
|
-
# this is NOT a real time called method so we can add this
|
373
|
-
# check. Congrats to the author.
|
374
354
|
raise ArgumentError.new('char_re must be a regular expression!') unless char_re.is_a?(Regexp)
|
375
355
|
string = ""
|
376
356
|
while string.length < max_length
|
@@ -379,23 +359,12 @@ module Random
|
|
379
359
|
end
|
380
360
|
return string
|
381
361
|
end
|
382
|
-
|
383
|
-
# Module method to generate a random letter.
|
384
|
-
#
|
385
|
-
# String::Random.rand_letter #=> "q"
|
386
|
-
# String::Random.rand_letter #=> "r"
|
387
|
-
# String::Random.rand_letter #=> "a"
|
388
|
-
#
|
389
|
-
def rand_letter
|
390
|
-
(Random.number(26) + (Random.number(2) == 0 ? 65 : 97) ).chr
|
391
|
-
end
|
392
|
-
|
393
362
|
end
|
394
363
|
|
395
364
|
# Return a random separation of the string.
|
396
365
|
# Default separation is by charaacter.
|
397
366
|
#
|
398
|
-
# "Ruby rules".at_rand(' ')
|
367
|
+
# "Ruby rules".at_rand(' ') #~> ["Ruby"]
|
399
368
|
#
|
400
369
|
def at_rand( separator=// )
|
401
370
|
#separator = self.class.patterns( separator )
|
@@ -406,8 +375,8 @@ module Random
|
|
406
375
|
# from the string. Default separation is by character.
|
407
376
|
#
|
408
377
|
# s = "Ruby rules"
|
409
|
-
# s
|
410
|
-
# s
|
378
|
+
# s.at_rand!(' ') #~> "Ruby"
|
379
|
+
# s #~> "rules"
|
411
380
|
#
|
412
381
|
def at_rand!( separator=// )
|
413
382
|
#separator = self.class.patterns( separator )
|
@@ -421,7 +390,7 @@ module Random
|
|
421
390
|
|
422
391
|
# Return a random byte of _self_.
|
423
392
|
#
|
424
|
-
# "Ruby rules".rand_byte
|
393
|
+
# "Ruby rules".rand_byte #~> 121
|
425
394
|
#
|
426
395
|
def rand_byte
|
427
396
|
self[Random.number(size)]
|
@@ -430,8 +399,8 @@ module Random
|
|
430
399
|
# Destructive rand_byte. Delete a random byte of _self_ and return it.
|
431
400
|
#
|
432
401
|
# s = "Ruby rules"
|
433
|
-
# s.rand_byte!
|
434
|
-
# s
|
402
|
+
# s.rand_byte! #~> 121
|
403
|
+
# s #~> "Rub rules"
|
435
404
|
#
|
436
405
|
def rand_byte!
|
437
406
|
i = Random.number(size)
|
@@ -442,7 +411,7 @@ module Random
|
|
442
411
|
|
443
412
|
# Return a random string index.
|
444
413
|
#
|
445
|
-
# "Ruby rules".rand_index
|
414
|
+
# "Ruby rules".rand_index #~> 3
|
446
415
|
#
|
447
416
|
def rand_index
|
448
417
|
Random.number(size)
|
@@ -451,7 +420,7 @@ module Random
|
|
451
420
|
# Return the string with seperated sections arranged
|
452
421
|
# in a random order. The default seperation is by character.
|
453
422
|
#
|
454
|
-
# "Ruby rules".shuffle
|
423
|
+
# "Ruby rules".shuffle #~> "e lybRsuur"
|
455
424
|
#
|
456
425
|
def shuffle(separator=//)
|
457
426
|
split(separator).shuffle.join('')
|
@@ -467,23 +436,11 @@ module Random
|
|
467
436
|
|
468
437
|
end
|
469
438
|
|
470
|
-
class
|
471
|
-
|
472
|
-
end
|
473
|
-
|
474
|
-
class
|
475
|
-
|
476
|
-
end
|
477
|
-
|
478
|
-
class Array
|
479
|
-
include Random
|
480
|
-
end
|
481
|
-
|
482
|
-
class Hash
|
483
|
-
include Random
|
484
|
-
end
|
485
|
-
|
486
|
-
class String
|
487
|
-
include Random
|
488
|
-
end
|
439
|
+
class Range ; include Random::RangeExtensions ; end
|
440
|
+
class Array ; include Random::ArrayExtensions ; end
|
441
|
+
class Hash ; include Random::HashExtensions ; end
|
442
|
+
class String ; include Random::StringExtensions ; end
|
443
|
+
class Integer ; include Random::IntegerExtensions ; end
|
444
|
+
class Numeric ; include Random::NumericExtensions ; end
|
489
445
|
|
446
|
+
# Copyright (c) 2005 Ilmari Heikkinen, Christian Neukirchen, Thomas Sawyer
|