facets 2.9.1 → 2.9.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +11 -0
- data/.locat +24 -0
- data/.reap/ignore +1 -0
- data/.reap/yard.reap +42 -0
- data/.ruby +57 -0
- data/.test +31 -0
- data/.yard/core.yardopts +7 -0
- data/.yard/standard.yardopts +7 -0
- data/.yard/supplemental.yardopts +7 -0
- data/.yard/uncommon.yardopts +7 -0
- data/{AUTHORS → AUTHORS.rdoc} +2 -0
- data/Assembly +38 -0
- data/GPL3.txt +282 -0
- data/HISTORY.rdoc +28 -3
- data/MANIFEST +1107 -0
- data/NOTICE.rdoc +167 -0
- data/{PROFILE → Profile} +10 -7
- data/README.rdoc +3 -3
- data/{COPYING → RUBY.txt} +0 -0
- data/Rakefile +58 -15
- data/VERSION +1 -1
- data/facets.gemspec +152 -0
- data/lib/core-uncommon/facets/class/singleton.rb +8 -0
- data/lib/core-uncommon/facets/module/let.rb +27 -0
- data/lib/{core → core-uncommon}/facets/module/method_clash.rb +2 -1
- data/lib/core-uncommon/facets/string/acronym.rb +8 -0
- data/lib/core/facets.rb +81 -7
- data/lib/core/facets.yml +51 -1138
- data/lib/core/facets/array.rb +93 -5
- data/lib/core/facets/binding.rb +36 -4
- data/lib/core/facets/class.rb +14 -4
- data/lib/core/facets/comparable.rb +18 -4
- data/lib/core/facets/comparable/cap.rb +1 -1
- data/lib/core/facets/comparable/clip.rb +1 -1
- data/lib/core/facets/dir.rb +16 -4
- data/lib/core/facets/enumerable.rb +74 -4
- data/lib/core/facets/enumerable/map_with.rb +18 -0
- data/lib/core/facets/enumerable/zip_map.rb +1 -0
- data/lib/core/facets/exception.rb +11 -4
- data/lib/core/facets/exception/detail.rb +5 -1
- data/lib/core/facets/file.rb +30 -4
- data/lib/core/facets/filetest.rb +16 -4
- data/lib/core/facets/float.rb +6 -4
- data/lib/core/facets/hash.rb +108 -4
- data/lib/core/facets/hash/delete_values.rb +10 -1
- data/lib/core/facets/hash/slice.rb +5 -0
- data/lib/core/facets/integer.rb +20 -4
- data/lib/core/facets/kernel.rb +140 -4
- data/lib/core/facets/kernel/object_hexid.rb +4 -4
- data/lib/core/facets/matchdata.rb +8 -4
- data/lib/core/facets/method.rb +6 -4
- data/lib/core/facets/module.rb +86 -4
- data/lib/core/facets/module/redefine_method.rb +4 -2
- data/lib/core/facets/module/redirect_method.rb +1 -0
- data/lib/core/facets/nilclass.rb +8 -4
- data/lib/core/facets/numeric.rb +18 -4
- data/lib/core/facets/object.rb +14 -4
- data/lib/core/facets/objectspace.rb +10 -4
- data/lib/core/facets/proc.rb +18 -4
- data/lib/core/facets/process.rb +6 -4
- data/lib/core/facets/range.rb +14 -4
- data/lib/core/facets/regexp.rb +14 -4
- data/lib/core/facets/string.rb +134 -4
- data/lib/core/facets/struct.rb +6 -4
- data/lib/core/facets/symbol.rb +30 -4
- data/lib/core/facets/time.rb +34 -4
- data/lib/core/facets/unboundmethod.rb +8 -4
- data/lib/standard/facets/fileutils/ln_r.rb +83 -76
- data/lib/standard/facets/shellwords.rb +30 -0
- data/lib/supplemental/facets/enumargs.rb +195 -0
- data/lib/supplemental/facets/platform.rb +1 -1
- data/rdoc.assembly +50 -0
- data/site/.brite +2 -0
- data/site/assets/hover.js +14 -0
- data/site/assets/rdocs.js +28 -0
- data/site/assets/site.css +324 -0
- data/site/assets/syntax.css +60 -0
- data/site/atom.page +25 -0
- data/site/atom.xml +20 -0
- data/site/brite.yml +3 -0
- data/site/default.layout +114 -0
- data/site/index.html +110 -0
- data/site/index.page +94 -0
- data/site/learn.html +110 -0
- data/site/learn.page +78 -0
- data/site/media/APIdocs.png +0 -0
- data/site/media/RubyFacets.png +0 -0
- data/site/media/RubyFacetsShadow.png +0 -0
- data/site/media/RubyFacetsShadow2.png +0 -0
- data/site/media/RubyFacetsShadowFade.png +0 -0
- data/site/media/SPYlights.png +0 -0
- data/site/media/WeHeartFacets.png +0 -0
- data/site/media/abc.png +0 -0
- data/site/media/abc1.png +0 -0
- data/site/media/adverts/21-5G3Eta1L._AA_SL160_.jpg +0 -0
- data/site/media/adverts/21B53PF6W5L._AA_SL160_.jpg +0 -0
- data/site/media/adverts/21OsAAT9MaL._AA_SL160_.jpg +0 -0
- data/site/media/adverts/21PYg8IoswL._AA_SL160_.jpg +0 -0
- data/site/media/adverts/21WvvRAsbhL._AA_SL160_.jpg +0 -0
- data/site/media/adverts/amazon.html +30 -0
- data/site/media/adverts/rdoc.html +15 -0
- data/site/media/appleslice.jpg +0 -0
- data/site/media/clear.gif +0 -0
- data/site/media/core.jpg +0 -0
- data/site/media/fade_black_down.png +0 -0
- data/site/media/fade_blue_down.gif +0 -0
- data/site/media/fade_blue_up.gif +0 -0
- data/site/media/fade_red_down.png +0 -0
- data/site/media/fade_red_up (copy).png +0 -0
- data/site/media/fade_red_up.png +0 -0
- data/site/media/fade_yellow_down.jpg +0 -0
- data/site/media/fade_yellow_right.jpg +0 -0
- data/site/media/fade_yellow_up.jpg +0 -0
- data/site/media/favicon.ico +0 -0
- data/site/media/forkme.png +0 -0
- data/site/media/gray.jpg +0 -0
- data/site/media/heart.gif +0 -0
- data/site/media/itcamefrom.png +0 -0
- data/site/media/license.jpg +0 -0
- data/site/media/lightbulb.jpg +0 -0
- data/site/media/menu_bkg.png +0 -0
- data/site/media/mini.png +0 -0
- data/site/media/nitro.png +0 -0
- data/site/media/patch125.jpg +0 -0
- data/site/media/people.jpg +0 -0
- data/site/media/reap.png +0 -0
- data/site/media/ruby-lg.png +0 -0
- data/site/media/ruby.gif +0 -0
- data/site/media/temp.png +0 -0
- data/site/media/treetop.jpg +0 -0
- data/site/news.html +110 -0
- data/site/news.page +22 -0
- data/site/post.layout +23 -0
- data/site/posts/2008-01-01-how-facets-was-born.html +110 -0
- data/site/posts/2008-01-01-how-facets-was-born.post +26 -0
- data/site/posts/2008-03-24-release-2-4.html +110 -0
- data/site/posts/2008-03-24-release-2-4.post +61 -0
- data/site/posts/2009-07-21-new-website.html +110 -0
- data/site/posts/2009-07-21-new-website.post +17 -0
- data/site/posts/2009-08-22-release-2-7.html +110 -0
- data/site/posts/2009-08-22-release-2-7.post +130 -0
- data/site/posts/2009-11-09-release-2-8.html +110 -0
- data/site/posts/2009-11-09-release-2-8.post +61 -0
- data/site/posts/2010-09-01-release-2-9.html +110 -0
- data/site/posts/2010-09-01-release-2-9.post +39 -0
- data/site/source.html +110 -0
- data/site/source.page +46 -0
- data/src/core-uncommon/facets/array/median.rb +17 -0
- data/src/core-uncommon/facets/array/op_pow.rb +9 -0
- data/src/core-uncommon/facets/array/percentile.rb +32 -0
- data/src/core-uncommon/facets/class/preallocate.rb +52 -0
- data/src/core-uncommon/facets/class/singleton.rb +8 -0
- data/src/core-uncommon/facets/enumerable/has.rb +22 -0
- data/src/core-uncommon/facets/enumerable/have.rb +1 -0
- data/src/core-uncommon/facets/integer/roman.rb +77 -0
- data/src/core-uncommon/facets/kernel/demo.rb +27 -0
- data/src/core-uncommon/facets/kernel/eigenclass.rb +21 -0
- data/src/core-uncommon/facets/kernel/instance_exec.rb +44 -0
- data/src/core-uncommon/facets/kernel/memo.rb +41 -0
- data/src/core-uncommon/facets/kernel/trap_chain.rb +23 -0
- data/src/core-uncommon/facets/kernel/y.rb +20 -0
- data/src/core-uncommon/facets/method/memoize.rb +13 -0
- data/src/core-uncommon/facets/module/attr_class_accessor.rb +39 -0
- data/src/core-uncommon/facets/module/attr_inheritor.rb +15 -0
- data/src/core-uncommon/facets/module/attr_tester.rb +49 -0
- data/src/core-uncommon/facets/module/attr_validator.rb +40 -0
- data/src/core-uncommon/facets/module/cattr.rb +264 -0
- data/src/core-uncommon/facets/module/class_accessor.rb +33 -0
- data/src/core-uncommon/facets/module/class_extend.rb +85 -0
- data/src/core-uncommon/facets/module/class_inheritor.rb +77 -0
- data/src/core-uncommon/facets/module/copy_inheritor.rb +42 -0
- data/src/core-uncommon/facets/module/enclosure.rb +82 -0
- data/src/core-uncommon/facets/module/enclosures.rb +1 -0
- data/src/core-uncommon/facets/module/include_as.rb +1 -0
- data/src/core-uncommon/facets/module/instance_function.rb +90 -0
- data/src/core-uncommon/facets/module/let.rb +27 -0
- data/src/core-uncommon/facets/module/memoize.rb +12 -0
- data/src/core-uncommon/facets/module/method_clash.rb +59 -0
- data/src/core-uncommon/facets/module/method_space.rb +99 -0
- data/src/core-uncommon/facets/module/module_load.rb +78 -0
- data/src/core-uncommon/facets/module/preextend.rb +29 -0
- data/src/core-uncommon/facets/module/prepend.rb +61 -0
- data/src/core-uncommon/facets/regexp/op_or.rb +13 -0
- data/src/core-uncommon/facets/string/acronym.rb +8 -0
- data/src/core-uncommon/facets/string/crypt.rb +19 -0
- data/src/core-uncommon/facets/string/roman.rb +1 -0
- data/src/core/facets.rb +70 -0
- data/src/core/facets.yml +57 -0
- data/src/core/facets/applique/file_helpers.rb +33 -0
- data/src/core/facets/array.rb +28 -0
- data/src/core/facets/array/after.rb +1 -0
- data/src/core/facets/array/before.rb +39 -0
- data/src/core/facets/array/collapse.rb +12 -0
- data/src/core/facets/array/collisions.rb +1 -0
- data/src/core/facets/array/combination.rb +43 -0
- data/src/core/facets/array/commonality.rb +37 -0
- data/src/core/facets/array/conjoin.rb +89 -0
- data/src/core/facets/array/contains.rb +7 -0
- data/src/core/facets/array/delete.rb +4 -0
- data/src/core/facets/array/delete_unless.rb +15 -0
- data/src/core/facets/array/delete_values.rb +50 -0
- data/src/core/facets/array/divide.rb +20 -0
- data/src/core/facets/array/duplicates.rb +1 -0
- data/src/core/facets/array/entropy.rb +39 -0
- data/src/core/facets/array/extract_options.rb +31 -0
- data/src/core/facets/array/from.rb +33 -0
- data/src/core/facets/array/index.rb +23 -0
- data/src/core/facets/array/indexable.rb +31 -0
- data/src/core/facets/array/merge.rb +22 -0
- data/src/core/facets/array/mode.rb +22 -0
- data/src/core/facets/array/nonuniq.rb +37 -0
- data/src/core/facets/array/not_empty.rb +13 -0
- data/src/core/facets/array/only.rb +26 -0
- data/src/core/facets/array/pad.rb +41 -0
- data/src/core/facets/array/peek.rb +1 -0
- data/src/core/facets/array/permutation.rb +32 -0
- data/src/core/facets/array/poke.rb +1 -0
- data/src/core/facets/array/probability.rb +39 -0
- data/src/core/facets/array/product.rb +30 -0
- data/src/core/facets/array/pull.rb +30 -0
- data/src/core/facets/array/recurse.rb +29 -0
- data/src/core/facets/array/recursively.rb +47 -0
- data/src/core/facets/array/rotate.rb +48 -0
- data/src/core/facets/array/select.rb +20 -0
- data/src/core/facets/array/splice.rb +27 -0
- data/src/core/facets/array/split.rb +27 -0
- data/src/core/facets/array/store.rb +12 -0
- data/src/core/facets/array/thru.rb +1 -0
- data/src/core/facets/array/traverse.rb +44 -0
- data/src/core/facets/array/uniq_by.rb +16 -0
- data/src/core/facets/binding.rb +32 -0
- data/src/core/facets/binding/__callee__.rb +1 -0
- data/src/core/facets/binding/__method__.rb +1 -0
- data/src/core/facets/binding/call_stack.rb +1 -0
- data/src/core/facets/binding/caller.rb +44 -0
- data/src/core/facets/binding/callstack.rb +1 -0
- data/src/core/facets/binding/defined.rb +12 -0
- data/src/core/facets/binding/eval.rb +14 -0
- data/src/core/facets/binding/local_variables.rb +17 -0
- data/src/core/facets/binding/op.rb +24 -0
- data/src/core/facets/binding/self.rb +12 -0
- data/src/core/facets/boolean.rb +121 -0
- data/src/core/facets/class.rb +20 -0
- data/src/core/facets/class/descendants.rb +35 -0
- data/src/core/facets/class/methodize.rb +19 -0
- data/src/core/facets/class/pathize.rb +19 -0
- data/src/core/facets/class/subclasses.rb +28 -0
- data/src/core/facets/class/to_proc.rb +25 -0
- data/src/core/facets/comparable.rb +20 -0
- data/src/core/facets/comparable/at_least.rb +1 -0
- data/src/core/facets/comparable/at_most.rb +1 -0
- data/src/core/facets/comparable/bound.rb +1 -0
- data/src/core/facets/comparable/cap.rb +34 -0
- data/src/core/facets/comparable/clip.rb +38 -0
- data/src/core/facets/comparable/cmp.rb +41 -0
- data/src/core/facets/comparable/op_get.rb +45 -0
- data/src/core/facets/denumerable.rb +76 -0
- data/src/core/facets/dir.rb +20 -0
- data/src/core/facets/dir/ascend.rb +56 -0
- data/src/core/facets/dir/descend.rb +1 -0
- data/src/core/facets/dir/each_child.rb +16 -0
- data/src/core/facets/dir/multiglob.rb +78 -0
- data/src/core/facets/dir/parent.rb +16 -0
- data/src/core/facets/dir/recurse.rb +35 -0
- data/src/core/facets/enumerable.rb +20 -0
- data/src/core/facets/enumerable/accumulate.rb +61 -0
- data/src/core/facets/enumerable/cluster_by.rb +18 -0
- data/src/core/facets/enumerable/collect_with_index.rb +2 -0
- data/src/core/facets/enumerable/compact_map.rb +36 -0
- data/src/core/facets/enumerable/count.rb +53 -0
- data/src/core/facets/enumerable/defer.rb +73 -0
- data/src/core/facets/enumerable/each_by.rb +33 -0
- data/src/core/facets/enumerable/each_with_object.rb +38 -0
- data/src/core/facets/enumerable/every.rb +40 -0
- data/src/core/facets/enumerable/ewise.rb +59 -0
- data/src/core/facets/enumerable/exclude.rb +16 -0
- data/src/core/facets/enumerable/expand.rb +15 -0
- data/src/core/facets/enumerable/filter.rb +33 -0
- data/src/core/facets/enumerable/find_yield.rb +42 -0
- data/src/core/facets/enumerable/frequency.rb +24 -0
- data/src/core/facets/enumerable/graph.rb +37 -0
- data/src/core/facets/enumerable/group_by.rb +33 -0
- data/src/core/facets/enumerable/map_by.rb +35 -0
- data/src/core/facets/enumerable/map_detect.rb +1 -0
- data/src/core/facets/enumerable/map_send.rb +26 -0
- data/src/core/facets/enumerable/map_with.rb +18 -0
- data/src/core/facets/enumerable/map_with_index.rb +23 -0
- data/src/core/facets/enumerable/mash.rb +1 -0
- data/src/core/facets/enumerable/modulate.rb +22 -0
- data/src/core/facets/enumerable/none.rb +32 -0
- data/src/core/facets/enumerable/occur.rb +38 -0
- data/src/core/facets/enumerable/one.rb +39 -0
- data/src/core/facets/enumerable/per.rb +85 -0
- data/src/core/facets/enumerable/purge.rb +43 -0
- data/src/core/facets/enumerable/recursively.rb +66 -0
- data/src/core/facets/enumerable/sum.rb +16 -0
- data/src/core/facets/enumerable/take.rb +16 -0
- data/src/core/facets/enumerable/uniq_by.rb +13 -0
- data/src/core/facets/enumerable/visit.rb +30 -0
- data/src/core/facets/enumerable/zip_map.rb +1 -0
- data/src/core/facets/enumerator.rb +75 -0
- data/src/core/facets/enumerator/fx.rb +36 -0
- data/src/core/facets/exception.rb +21 -0
- data/src/core/facets/exception/detail.rb +23 -0
- data/src/core/facets/exception/raised.rb +14 -0
- data/src/core/facets/exception/suppress.rb +22 -0
- data/src/core/facets/file.rb +20 -0
- data/src/core/facets/file/append.rb +14 -0
- data/src/core/facets/file/create.rb +21 -0
- data/src/core/facets/file/ext.rb +36 -0
- data/src/core/facets/file/null.rb +21 -0
- data/src/core/facets/file/read_binary.rb +18 -0
- data/src/core/facets/file/read_list.rb +34 -0
- data/src/core/facets/file/rewrite.rb +90 -0
- data/src/core/facets/file/rootname.rb +23 -0
- data/src/core/facets/file/sanitize.rb +18 -0
- data/src/core/facets/file/split_all.rb +19 -0
- data/src/core/facets/file/split_root.rb +13 -0
- data/src/core/facets/file/write.rb +24 -0
- data/src/core/facets/file/writelines.rb +27 -0
- data/src/core/facets/filetest.rb +20 -0
- data/src/core/facets/filetest/absolute.rb +1 -0
- data/src/core/facets/filetest/contains.rb +12 -0
- data/src/core/facets/filetest/relative.rb +38 -0
- data/src/core/facets/filetest/root.rb +17 -0
- data/src/core/facets/filetest/safe.rb +20 -0
- data/src/core/facets/filetest/separator_pattern.rb +19 -0
- data/src/core/facets/float.rb +20 -0
- data/src/core/facets/float/round.rb +2 -0
- data/src/core/facets/functor.rb +78 -0
- data/src/core/facets/hash.rb +20 -0
- data/src/core/facets/hash/alias.rb +31 -0
- data/src/core/facets/hash/argumentize.rb +28 -0
- data/src/core/facets/hash/at.rb +8 -0
- data/src/core/facets/hash/autonew.rb +24 -0
- data/src/core/facets/hash/collate.rb +62 -0
- data/src/core/facets/hash/count.rb +12 -0
- data/src/core/facets/hash/data.rb +41 -0
- data/src/core/facets/hash/dearray_values.rb +46 -0
- data/src/core/facets/hash/deep_merge.rb +33 -0
- data/src/core/facets/hash/delete.rb +4 -0
- data/src/core/facets/hash/delete_at.rb +7 -0
- data/src/core/facets/hash/delete_unless.rb +17 -0
- data/src/core/facets/hash/delete_values.rb +41 -0
- data/src/core/facets/hash/diff.rb +17 -0
- data/src/core/facets/hash/except.rb +25 -0
- data/src/core/facets/hash/graph.rb +18 -0
- data/src/core/facets/hash/insert.rb +19 -0
- data/src/core/facets/hash/inverse.rb +30 -0
- data/src/core/facets/hash/join.rb +17 -0
- data/src/core/facets/hash/keys.rb +45 -0
- data/src/core/facets/hash/mash.rb +1 -0
- data/src/core/facets/hash/new_with.rb +15 -0
- data/src/core/facets/hash/op.rb +7 -0
- data/src/core/facets/hash/op_add.rb +12 -0
- data/src/core/facets/hash/op_and.rb +33 -0
- data/src/core/facets/hash/op_mul.rb +18 -0
- data/src/core/facets/hash/op_or.rb +12 -0
- data/src/core/facets/hash/op_push.rb +17 -0
- data/src/core/facets/hash/op_sub.rb +26 -0
- data/src/core/facets/hash/recurse.rb +29 -0
- data/src/core/facets/hash/recursively.rb +61 -0
- data/src/core/facets/hash/rekey.rb +79 -0
- data/src/core/facets/hash/replace_each.rb +16 -0
- data/src/core/facets/hash/reverse_merge.rb +30 -0
- data/src/core/facets/hash/select.rb +17 -0
- data/src/core/facets/hash/slice.rb +37 -0
- data/src/core/facets/hash/stringify_keys.rb +1 -0
- data/src/core/facets/hash/subset.rb +24 -0
- data/src/core/facets/hash/swap.rb +17 -0
- data/src/core/facets/hash/symbolize_keys.rb +92 -0
- data/src/core/facets/hash/to_h.rb +1 -0
- data/src/core/facets/hash/to_mod.rb +33 -0
- data/src/core/facets/hash/to_options.rb +1 -0
- data/src/core/facets/hash/to_proc.rb +39 -0
- data/src/core/facets/hash/to_struct.rb +17 -0
- data/src/core/facets/hash/traverse.rb +47 -0
- data/src/core/facets/hash/update.rb +6 -0
- data/src/core/facets/hash/update_each.rb +18 -0
- data/src/core/facets/hash/update_keys.rb +20 -0
- data/src/core/facets/hash/update_values.rb +20 -0
- data/src/core/facets/hash/weave.rb +76 -0
- data/src/core/facets/hash/zip.rb +18 -0
- data/src/core/facets/indexable.rb +270 -0
- data/src/core/facets/instance.rb +157 -0
- data/src/core/facets/integer.rb +20 -0
- data/src/core/facets/integer/bit.rb +1 -0
- data/src/core/facets/integer/bitmask.rb +99 -0
- data/src/core/facets/integer/even.rb +1 -0
- data/src/core/facets/integer/factorial.rb +21 -0
- data/src/core/facets/integer/multiple.rb +19 -0
- data/src/core/facets/integer/odd.rb +37 -0
- data/src/core/facets/integer/of.rb +18 -0
- data/src/core/facets/integer/ordinal.rb +24 -0
- data/src/core/facets/kernel.rb +20 -0
- data/src/core/facets/kernel/__callee__.rb +1 -0
- data/src/core/facets/kernel/__class__.rb +9 -0
- data/src/core/facets/kernel/__dir__.rb +26 -0
- data/src/core/facets/kernel/__get__.rb +15 -0
- data/src/core/facets/kernel/__method__.rb +48 -0
- data/src/core/facets/kernel/__set__.rb +1 -0
- data/src/core/facets/kernel/as.rb +115 -0
- data/src/core/facets/kernel/ask.rb +28 -0
- data/src/core/facets/kernel/assign.rb +76 -0
- data/src/core/facets/kernel/assign_from.rb +1 -0
- data/src/core/facets/kernel/attr_singleton.rb +59 -0
- data/src/core/facets/kernel/blank.rb +84 -0
- data/src/core/facets/kernel/call_stack.rb +56 -0
- data/src/core/facets/kernel/callstack.rb +1 -0
- data/src/core/facets/kernel/case.rb +8 -0
- data/src/core/facets/kernel/complete.rb +26 -0
- data/src/core/facets/kernel/constant.rb +20 -0
- data/src/core/facets/kernel/d.rb +27 -0
- data/src/core/facets/kernel/deep_clone.rb +1 -0
- data/src/core/facets/kernel/deep_copy.rb +38 -0
- data/src/core/facets/kernel/disable_warnings.rb +26 -0
- data/src/core/facets/kernel/enable_warnings.rb +1 -0
- data/src/core/facets/kernel/equate.rb +16 -0
- data/src/core/facets/kernel/ergo.rb +43 -0
- data/src/core/facets/kernel/extend.rb +27 -0
- data/src/core/facets/kernel/extension.rb +12 -0
- data/src/core/facets/kernel/false.rb +2 -0
- data/src/core/facets/kernel/here.rb +11 -0
- data/src/core/facets/kernel/identical.rb +4 -0
- data/src/core/facets/kernel/in.rb +13 -0
- data/src/core/facets/kernel/instance_assign.rb +20 -0
- data/src/core/facets/kernel/instance_class.rb +26 -0
- data/src/core/facets/kernel/instance_send.rb +7 -0
- data/src/core/facets/kernel/load_all.rb +1 -0
- data/src/core/facets/kernel/load_relative.rb +1 -0
- data/src/core/facets/kernel/maybe.rb +19 -0
- data/src/core/facets/kernel/meta_alias.rb +23 -0
- data/src/core/facets/kernel/meta_class.rb +17 -0
- data/src/core/facets/kernel/meta_def.rb +20 -0
- data/src/core/facets/kernel/meta_eval.rb +20 -0
- data/src/core/facets/kernel/method.rb +50 -0
- data/src/core/facets/kernel/no.rb +1 -0
- data/src/core/facets/kernel/not.rb +37 -0
- data/src/core/facets/kernel/not_nil.rb +18 -0
- data/src/core/facets/kernel/object_class.rb +10 -0
- data/src/core/facets/kernel/object_hexid.rb +31 -0
- data/src/core/facets/kernel/object_send.rb +33 -0
- data/src/core/facets/kernel/p.rb +24 -0
- data/src/core/facets/kernel/presence.rb +1 -0
- data/src/core/facets/kernel/present.rb +1 -0
- data/src/core/facets/kernel/qua_class.rb +31 -0
- data/src/core/facets/kernel/require_all.rb +42 -0
- data/src/core/facets/kernel/require_relative.rb +52 -0
- data/src/core/facets/kernel/respond.rb +42 -0
- data/src/core/facets/kernel/returning.rb +27 -0
- data/src/core/facets/kernel/silence.rb +73 -0
- data/src/core/facets/kernel/silence_warnings.rb +1 -0
- data/src/core/facets/kernel/singleton_class.rb +9 -0
- data/src/core/facets/kernel/source_location.rb +13 -0
- data/src/core/facets/kernel/super_method.rb +11 -0
- data/src/core/facets/kernel/tap.rb +48 -0
- data/src/core/facets/kernel/temporarily.rb +23 -0
- data/src/core/facets/kernel/true.rb +26 -0
- data/src/core/facets/kernel/try.rb +58 -0
- data/src/core/facets/kernel/val.rb +19 -0
- data/src/core/facets/kernel/with.rb +20 -0
- data/src/core/facets/kernel/writers.rb +91 -0
- data/src/core/facets/kernel/yes.rb +25 -0
- data/src/core/facets/lazy.rb +238 -0
- data/src/core/facets/matchdata.rb +20 -0
- data/src/core/facets/matchdata/match.rb +15 -0
- data/src/core/facets/matchdata/matchset.rb +44 -0
- data/src/core/facets/method.rb +20 -0
- data/src/core/facets/module.rb +20 -0
- data/src/core/facets/module/abstract.rb +24 -0
- data/src/core/facets/module/alias_accessor.rb +45 -0
- data/src/core/facets/module/alias_method_chain.rb +67 -0
- data/src/core/facets/module/alias_module_function.rb +30 -0
- data/src/core/facets/module/all_instance_methods.rb +19 -0
- data/src/core/facets/module/ancestor.rb +16 -0
- data/src/core/facets/module/anonymous.rb +25 -0
- data/src/core/facets/module/attr_setter.rb +52 -0
- data/src/core/facets/module/basename.rb +31 -0
- data/src/core/facets/module/can.rb +20 -0
- data/src/core/facets/module/class.rb +12 -0
- data/src/core/facets/module/class_def.rb +2 -0
- data/src/core/facets/module/class_method_defined.rb +1 -0
- data/src/core/facets/module/extend.rb +1 -0
- data/src/core/facets/module/home.rb +90 -0
- data/src/core/facets/module/homename.rb +1 -0
- data/src/core/facets/module/housing.rb +1 -0
- data/src/core/facets/module/include_function_module.rb +25 -0
- data/src/core/facets/module/instance_method.rb +25 -0
- data/src/core/facets/module/instance_method_defined.rb +23 -0
- data/src/core/facets/module/integrate.rb +49 -0
- data/src/core/facets/module/is.rb +57 -0
- data/src/core/facets/module/methodize.rb +20 -0
- data/src/core/facets/module/modname.rb +1 -0
- data/src/core/facets/module/module_def.rb +31 -0
- data/src/core/facets/module/nodef.rb +13 -0
- data/src/core/facets/module/op.rb +107 -0
- data/src/core/facets/module/op_add.rb +1 -0
- data/src/core/facets/module/op_mul.rb +1 -0
- data/src/core/facets/module/op_sub.rb +1 -0
- data/src/core/facets/module/pathize.rb +20 -0
- data/src/core/facets/module/redefine_method.rb +37 -0
- data/src/core/facets/module/redirect_method.rb +46 -0
- data/src/core/facets/module/remove.rb +1 -0
- data/src/core/facets/module/rename_method.rb +30 -0
- data/src/core/facets/module/revise.rb +41 -0
- data/src/core/facets/module/set.rb +36 -0
- data/src/core/facets/module/singleton_method_defined.rb +1 -0
- data/src/core/facets/module/spacename.rb +25 -0
- data/src/core/facets/module/to_obj.rb +20 -0
- data/src/core/facets/module/wrap_method.rb +35 -0
- data/src/core/facets/na.rb +21 -0
- data/src/core/facets/nilclass.rb +20 -0
- data/src/core/facets/nilclass/ergo.rb +1 -0
- data/src/core/facets/nilclass/to_f.rb +17 -0
- data/src/core/facets/numeric.rb +20 -0
- data/src/core/facets/numeric/approx.rb +15 -0
- data/src/core/facets/numeric/distance.rb +14 -0
- data/src/core/facets/numeric/length.rb +10 -0
- data/src/core/facets/numeric/round.rb +69 -0
- data/src/core/facets/numeric/round_at.rb +1 -0
- data/src/core/facets/numeric/round_to.rb +1 -0
- data/src/core/facets/numeric/spacing.rb +20 -0
- data/src/core/facets/object.rb +20 -0
- data/src/core/facets/object/clone.rb +1 -0
- data/src/core/facets/object/dup.rb +79 -0
- data/src/core/facets/object/object_state.rb +77 -0
- data/src/core/facets/object/replace.rb +43 -0
- data/src/core/facets/object/try_dup.rb +1 -0
- data/src/core/facets/objectspace.rb +20 -0
- data/src/core/facets/objectspace/classes.rb +11 -0
- data/src/core/facets/objectspace/op_fetch.rb +3 -0
- data/src/core/facets/objectspace/reflect.rb +62 -0
- data/src/core/facets/proc.rb +20 -0
- data/src/core/facets/proc/bind.rb +24 -0
- data/src/core/facets/proc/bind_to.rb +17 -0
- data/src/core/facets/proc/compose.rb +42 -0
- data/src/core/facets/proc/curry.rb +32 -0
- data/src/core/facets/proc/partial.rb +33 -0
- data/src/core/facets/proc/to_method.rb +38 -0
- data/src/core/facets/proc/update.rb +9 -0
- data/src/core/facets/process.rb +20 -0
- data/src/core/facets/process/daemon.rb +32 -0
- data/src/core/facets/range.rb +20 -0
- data/src/core/facets/range/combine.rb +47 -0
- data/src/core/facets/range/overlap.rb +12 -0
- data/src/core/facets/range/to_r.rb +26 -0
- data/src/core/facets/range/umbrella.rb +1 -0
- data/src/core/facets/range/within.rb +64 -0
- data/src/core/facets/regexp.rb +20 -0
- data/src/core/facets/regexp/arity.rb +17 -0
- data/src/core/facets/regexp/multiline.rb +13 -0
- data/src/core/facets/regexp/op_add.rb +18 -0
- data/src/core/facets/regexp/op_or.rb +18 -0
- data/src/core/facets/regexp/to_re.rb +28 -0
- data/src/core/facets/string.rb +20 -0
- data/src/core/facets/string/align.rb +125 -0
- data/src/core/facets/string/bracket.rb +64 -0
- data/src/core/facets/string/bytes.rb +21 -0
- data/src/core/facets/string/camelcase.rb +62 -0
- data/src/core/facets/string/capitalized.rb +49 -0
- data/src/core/facets/string/characters.rb +13 -0
- data/src/core/facets/string/cleanlines.rb +27 -0
- data/src/core/facets/string/cleave.rb +36 -0
- data/src/core/facets/string/cmp.rb +1 -0
- data/src/core/facets/string/compress_lines.rb +17 -0
- data/src/core/facets/string/divide.rb +18 -0
- data/src/core/facets/string/each_char.rb +31 -0
- data/src/core/facets/string/each_word.rb +17 -0
- data/src/core/facets/string/edit_distance.rb +124 -0
- data/src/core/facets/string/end_with.rb +1 -0
- data/src/core/facets/string/exclude.rb +10 -0
- data/src/core/facets/string/expand_tab.rb +35 -0
- data/src/core/facets/string/file.rb +35 -0
- data/src/core/facets/string/fold.rb +39 -0
- data/src/core/facets/string/indent.rb +67 -0
- data/src/core/facets/string/index_all.rb +24 -0
- data/src/core/facets/string/interpolate.rb +19 -0
- data/src/core/facets/string/lchomp.rb +33 -0
- data/src/core/facets/string/line_wrap.rb +18 -0
- data/src/core/facets/string/lines.rb +19 -0
- data/src/core/facets/string/lowercase.rb +1 -0
- data/src/core/facets/string/margin.rb +31 -0
- data/src/core/facets/string/methodize.rb +27 -0
- data/src/core/facets/string/modulize.rb +31 -0
- data/src/core/facets/string/mscan.rb +19 -0
- data/src/core/facets/string/natcmp.rb +86 -0
- data/src/core/facets/string/nchar.rb +32 -0
- data/src/core/facets/string/newlines.rb +32 -0
- data/src/core/facets/string/op_div.rb +14 -0
- data/src/core/facets/string/op_sub.rb +14 -0
- data/src/core/facets/string/outdent.rb +1 -0
- data/src/core/facets/string/pathize.rb +28 -0
- data/src/core/facets/string/quote.rb +93 -0
- data/src/core/facets/string/random_binary.rb +10 -0
- data/src/core/facets/string/range.rb +60 -0
- data/src/core/facets/string/range_all.rb +1 -0
- data/src/core/facets/string/range_of_line.rb +1 -0
- data/src/core/facets/string/rewrite.rb +24 -0
- data/src/core/facets/string/shatter.rb +22 -0
- data/src/core/facets/string/similarity.rb +89 -0
- data/src/core/facets/string/snakecase.rb +21 -0
- data/src/core/facets/string/splice.rb +33 -0
- data/src/core/facets/string/squish.rb +22 -0
- data/src/core/facets/string/start_with.rb +60 -0
- data/src/core/facets/string/store.rb +7 -0
- data/src/core/facets/string/subtract.rb +4 -0
- data/src/core/facets/string/tab.rb +17 -0
- data/src/core/facets/string/tabto.rb +19 -0
- data/src/core/facets/string/titlecase.rb +15 -0
- data/src/core/facets/string/to_re.rb +26 -0
- data/src/core/facets/string/unbracket.rb +1 -0
- data/src/core/facets/string/underscore.rb +22 -0
- data/src/core/facets/string/unfold.rb +27 -0
- data/src/core/facets/string/unindent.rb +1 -0
- data/src/core/facets/string/unquote.rb +1 -0
- data/src/core/facets/string/uppercase.rb +23 -0
- data/src/core/facets/string/variablize.rb +13 -0
- data/src/core/facets/string/word_wrap.rb +32 -0
- data/src/core/facets/string/words.rb +12 -0
- data/src/core/facets/string/xor.rb +26 -0
- data/src/core/facets/struct.rb +20 -0
- data/src/core/facets/struct/attributes.rb +15 -0
- data/src/core/facets/symbol.rb +20 -0
- data/src/core/facets/symbol/as_s.rb +17 -0
- data/src/core/facets/symbol/bang.rb +1 -0
- data/src/core/facets/symbol/chomp.rb +24 -0
- data/src/core/facets/symbol/generate.rb +24 -0
- data/src/core/facets/symbol/not.rb +29 -0
- data/src/core/facets/symbol/op_div.rb +21 -0
- data/src/core/facets/symbol/plain.rb +43 -0
- data/src/core/facets/symbol/query.rb +1 -0
- data/src/core/facets/symbol/setter.rb +1 -0
- data/src/core/facets/symbol/succ.rb +23 -0
- data/src/core/facets/symbol/thrown.rb +18 -0
- data/src/core/facets/symbol/to_proc.rb +33 -0
- data/src/core/facets/symbol/variablize.rb +14 -0
- data/src/core/facets/time.rb +20 -0
- data/src/core/facets/time/ago.rb +1 -0
- data/src/core/facets/time/change.rb +46 -0
- data/src/core/facets/time/dst_adjustment.rb +24 -0
- data/src/core/facets/time/elapse.rb +18 -0
- data/src/core/facets/time/future.rb +14 -0
- data/src/core/facets/time/hence.rb +1 -0
- data/src/core/facets/time/in.rb +1 -0
- data/src/core/facets/time/less.rb +1 -0
- data/src/core/facets/time/past.rb +1 -0
- data/src/core/facets/time/round_to.rb +21 -0
- data/src/core/facets/time/set.rb +27 -0
- data/src/core/facets/time/shift.rb +95 -0
- data/src/core/facets/time/stamp.rb +45 -0
- data/src/core/facets/time/to_time.rb +21 -0
- data/src/core/facets/time/trunc.rb +15 -0
- data/src/core/facets/to_hash.rb +336 -0
- data/src/core/facets/unboundmethod.rb +20 -0
- data/src/core/facets/unboundmethod/arguments.rb +44 -0
- data/src/core/facets/unboundmethod/name.rb +28 -0
- data/src/standard/facets/basicobject.rb +75 -0
- data/src/standard/facets/cgi.rb +44 -0
- data/src/standard/facets/continuation.rb +56 -0
- data/src/standard/facets/date.rb +433 -0
- data/src/standard/facets/digest.rb +2 -0
- data/src/standard/facets/digest/base64digest.rb +45 -0
- data/src/standard/facets/digest/salted_digest.rb +44 -0
- data/src/standard/facets/erb.rb +66 -0
- data/src/standard/facets/fileutils.rb +13 -0
- data/src/standard/facets/fileutils/amass.rb +33 -0
- data/src/standard/facets/fileutils/cp_rx.rb +44 -0
- data/src/standard/facets/fileutils/head.rb +1 -0
- data/src/standard/facets/fileutils/ln_r.rb +99 -0
- data/src/standard/facets/fileutils/outofdate.rb +38 -0
- data/src/standard/facets/fileutils/safe_ln.rb +27 -0
- data/src/standard/facets/fileutils/slice.rb +55 -0
- data/src/standard/facets/fileutils/stage.rb +66 -0
- data/src/standard/facets/fileutils/tail.rb +1 -0
- data/src/standard/facets/fileutils/wc.rb +63 -0
- data/src/standard/facets/fileutils/whereis.rb +66 -0
- data/src/standard/facets/fileutils/which.rb +60 -0
- data/src/standard/facets/find.rb +16 -0
- data/src/standard/facets/getoptlong.rb +59 -0
- data/src/standard/facets/math.rb +6 -0
- data/src/standard/facets/math/abs.rb +8 -0
- data/src/standard/facets/math/acot.rb +8 -0
- data/src/standard/facets/math/acoth.rb +8 -0
- data/src/standard/facets/math/acsc.rb +8 -0
- data/src/standard/facets/math/acsch.rb +8 -0
- data/src/standard/facets/math/amd.rb +17 -0
- data/src/standard/facets/math/approx_equal.rb +15 -0
- data/src/standard/facets/math/asec.rb +8 -0
- data/src/standard/facets/math/asech.rb +8 -0
- data/src/standard/facets/math/atkinson_index.rb +16 -0
- data/src/standard/facets/math/beta.rb +9 -0
- data/src/standard/facets/math/cdf.rb +10 -0
- data/src/standard/facets/math/ceil.rb +8 -0
- data/src/standard/facets/math/cot.rb +8 -0
- data/src/standard/facets/math/coth.rb +8 -0
- data/src/standard/facets/math/csc.rb +8 -0
- data/src/standard/facets/math/csch.rb +8 -0
- data/src/standard/facets/math/delta.rb +9 -0
- data/src/standard/facets/math/epsilon.rb +21 -0
- data/src/standard/facets/math/exp10.rb +8 -0
- data/src/standard/facets/math/exp2.rb +8 -0
- data/src/standard/facets/math/factorial.rb +37 -0
- data/src/standard/facets/math/floor.rb +8 -0
- data/src/standard/facets/math/gamma.rb +12 -0
- data/src/standard/facets/math/gcd.rb +23 -0
- data/src/standard/facets/math/gini_coefficient.rb +33 -0
- data/src/standard/facets/math/kldivergence.rb +19 -0
- data/src/standard/facets/math/lcm.rb +15 -0
- data/src/standard/facets/math/lgamma.rb +21 -0
- data/src/standard/facets/math/linsolve.rb +10 -0
- data/src/standard/facets/math/log2.rb +14 -0
- data/src/standard/facets/math/max.rb +1 -0
- data/src/standard/facets/math/mean.rb +16 -0
- data/src/standard/facets/math/median.rb +15 -0
- data/src/standard/facets/math/min.rb +35 -0
- data/src/standard/facets/math/pow.rb +8 -0
- data/src/standard/facets/math/pstd.rb +1 -0
- data/src/standard/facets/math/pvariance.rb +1 -0
- data/src/standard/facets/math/rmd.rb +16 -0
- data/src/standard/facets/math/root.rb +8 -0
- data/src/standard/facets/math/sec.rb +8 -0
- data/src/standard/facets/math/sech.rb +8 -0
- data/src/standard/facets/math/sign.rb +9 -0
- data/src/standard/facets/math/sinc.rb +8 -0
- data/src/standard/facets/math/sqr.rb +8 -0
- data/src/standard/facets/math/sqsolve.rb +53 -0
- data/src/standard/facets/math/std.rb +27 -0
- data/src/standard/facets/math/stderr.rb +1 -0
- data/src/standard/facets/math/sum.rb +16 -0
- data/src/standard/facets/math/summed_sqdevs.rb +14 -0
- data/src/standard/facets/math/theil_index.rb +24 -0
- data/src/standard/facets/math/variance.rb +31 -0
- data/src/standard/facets/net/http.rb +32 -0
- data/src/standard/facets/ostruct.rb +210 -0
- data/src/standard/facets/pathname.rb +240 -0
- data/src/standard/facets/random.rb +446 -0
- data/src/standard/facets/rbconfig.rb +78 -0
- data/src/standard/facets/set.rb +32 -0
- data/src/standard/facets/shellwords.rb +112 -0
- data/src/standard/facets/strscan.rb +16 -0
- data/src/standard/facets/thread.rb +98 -0
- data/src/standard/facets/uri.rb +211 -0
- data/src/standard/facets/yaml.rb +59 -0
- data/src/standard/facets/zlib.rb +38 -0
- data/src/supplemental/facets/argvector.rb +343 -0
- data/src/supplemental/facets/atomicfile.rb +51 -0
- data/src/supplemental/facets/enumargs.rb +195 -0
- data/src/supplemental/facets/interval.rb +284 -0
- data/src/supplemental/facets/main.rb +62 -0
- data/src/supplemental/facets/memoizable.rb +141 -0
- data/src/supplemental/facets/metaid.rb +7 -0
- data/src/supplemental/facets/multipliers.rb +65 -0
- data/src/supplemental/facets/multiton.rb +387 -0
- data/src/supplemental/facets/nullclass.rb +38 -0
- data/src/supplemental/facets/opesc.rb +79 -0
- data/src/supplemental/facets/platform.rb +377 -0
- data/src/supplemental/facets/reference.rb +83 -0
- data/src/supplemental/facets/timer.rb +207 -0
- data/src/supplemental/facets/tuple.rb +282 -0
- data/test/core-uncommon/array/test_median.rb +6 -4
- data/test/core-uncommon/array/test_percentile.rb +6 -4
- data/test/core-uncommon/class/test_preallocate.rb +22 -17
- data/test/core-uncommon/module/test_cattr.rb +35 -27
- data/test/core-uncommon/module/test_class_extend.rb +54 -47
- data/test/core-uncommon/module/test_class_inheritor.rb +108 -121
- data/test/core-uncommon/module/test_copy_inheritor.rb +25 -22
- data/test/core-uncommon/module/test_enclosure.rb +13 -9
- data/test/core-uncommon/module/test_instance_function.rb +20 -16
- data/test/core-uncommon/module/test_memoize.rb +23 -20
- data/test/core-uncommon/module/test_method_clash.rb +59 -0
- data/test/core-uncommon/module/test_method_space.rb +52 -44
- data/test/core-uncommon/module/test_module_load.rb +13 -9
- data/test/core-uncommon/module/test_preextend.rb +16 -12
- data/test/core-uncommon/module/test_prepend.rb +16 -12
- data/test/core/array/test_after.rb +18 -8
- data/test/core/array/test_before.rb +19 -9
- data/test/core/array/test_collapse.rb +7 -3
- data/test/core/array/test_combination.rb +17 -13
- data/test/core/array/test_commonality.rb +25 -17
- data/test/core/array/test_conjoin.rb +35 -31
- data/test/core/array/test_contains.rb +8 -4
- data/test/core/array/test_delete.rb +31 -16
- data/test/core/array/test_divide.rb +8 -4
- data/test/core/array/test_duplicates.rb +8 -4
- data/test/core/array/test_entropy.rb +14 -6
- data/test/core/array/test_extract_options.rb +17 -9
- data/test/core/array/test_first.rb +10 -6
- data/test/core/array/test_index.rb +12 -8
- data/test/core/array/test_last.rb +10 -6
- data/test/core/array/test_merge.rb +18 -10
- data/test/core/array/test_mode.rb +10 -6
- data/test/core/array/test_nonuniq.rb +16 -8
- data/test/core/array/test_not_empty.rb +10 -6
- data/test/core/array/test_only.rb +10 -6
- data/test/core/array/test_pad.rb +29 -21
- data/test/core/array/test_peek.rb +19 -15
- data/test/core/array/test_permutation.rb +11 -7
- data/test/core/array/test_poke.rb +14 -10
- data/test/core/array/test_probability.rb +11 -4
- data/test/core/array/test_product.rb +24 -20
- data/test/core/array/test_pull.rb +9 -5
- data/test/core/array/test_recurse.rb +29 -21
- data/test/core/array/test_recursively.rb +24 -20
- data/test/core/array/test_rotate.rb +27 -19
- data/test/core/array/test_select.rb +9 -5
- data/test/core/array/test_splice.rb +14 -10
- data/test/core/array/test_split.rb +13 -9
- data/test/core/array/test_store.rb +13 -11
- data/test/core/array/test_traverse.rb +17 -9
- data/test/core/array/test_uniq_by.rb +10 -6
- data/test/core/binding/test_caller.rb +35 -18
- data/test/core/binding/test_defined.rb +5 -3
- data/test/core/binding/test_eval.rb +5 -3
- data/test/core/binding/test_local_variables.rb +15 -11
- data/test/core/binding/test_op.rb +10 -6
- data/test/core/binding/test_self.rb +7 -4
- data/test/core/class/test_descendents.rb +11 -7
- data/test/core/class/test_subclasses.rb +11 -8
- data/test/core/class/test_to_proc.rb +9 -5
- data/test/core/comparable/test_bound.rb +23 -19
- data/test/core/comparable/test_cap.rb +25 -13
- data/test/core/comparable/test_clip.rb +23 -19
- data/test/core/comparable/test_cmp.rb +9 -5
- data/test/core/comparable/test_op_get.rb +42 -37
- data/test/core/denumerable_tc.rb +132 -91
- data/test/core/dir/test_ascend.rb +27 -19
- data/test/core/dir/test_descend.rb +14 -10
- data/test/core/dir/test_each_child.rb +15 -11
- data/test/core/dir/test_multiglob.rb +16 -8
- data/test/core/dir/test_parent.rb +7 -3
- data/test/core/dir/test_recurse.rb +21 -13
- data/test/core/enumerable/test_accumulate.rb +31 -23
- data/test/core/enumerable/test_cluster_by.rb +20 -16
- data/test/core/enumerable/test_compact_map.rb +14 -18
- data/test/core/enumerable/test_count.rb +22 -18
- data/test/core/enumerable/test_defer.rb +18 -15
- data/test/core/enumerable/test_each_by.rb +40 -36
- data/test/core/enumerable/test_each_with_object.rb +10 -6
- data/test/core/enumerable/test_every.rb +23 -15
- data/test/core/enumerable/test_ewise.rb +22 -14
- data/test/core/enumerable/test_exclude.rb +9 -5
- data/test/core/enumerable/test_expand.rb +9 -5
- data/test/core/enumerable/test_filter.rb +11 -7
- data/test/core/enumerable/test_find_yield.rb +71 -64
- data/test/core/enumerable/test_frequency.rb +8 -4
- data/test/core/enumerable/test_graph.rb +32 -28
- data/test/core/enumerable/test_group_by.rb +26 -22
- data/test/core/enumerable/test_map_by.rb +19 -15
- data/test/core/enumerable/test_map_send.rb +19 -3
- data/test/core/enumerable/test_map_with_index.rb +15 -7
- data/test/core/enumerable/test_mash.rb +10 -6
- data/test/core/enumerable/test_modulate.rb +10 -6
- data/test/core/enumerable/test_none.rb +20 -10
- data/test/core/enumerable/test_occur.rb +20 -7
- data/test/core/enumerable/test_one.rb +24 -12
- data/test/core/enumerable/test_per.rb +10 -6
- data/test/core/enumerable/test_purge.rb +14 -10
- data/test/core/enumerable/test_recursively.rb +22 -18
- data/test/core/enumerable/test_sum.rb +7 -3
- data/test/core/enumerable/test_take.rb +8 -4
- data/test/core/enumerable/test_uniq_by.rb +16 -10
- data/test/core/enumerable/test_visit.rb +9 -5
- data/test/core/enumerator/test_fx.rb +9 -5
- data/test/core/enumerator/test_new.rb +14 -10
- data/test/core/enumerator_tc.rb +29 -17
- data/test/core/exception/test_detail.rb +7 -8
- data/test/core/exception/test_raised.rb +6 -4
- data/test/core/exception/test_suppress.rb +6 -4
- data/test/core/file/test_append.rb +15 -12
- data/test/core/file/test_create.rb +10 -6
- data/test/core/file/test_ext.rb +23 -19
- data/test/core/file/test_null.rb +7 -3
- data/test/core/file/test_read_binary.rb +11 -7
- data/test/core/file/test_read_list.rb +9 -5
- data/test/core/file/test_rewrite.rb +24 -12
- data/test/core/file/test_rootname.rb +7 -3
- data/test/core/file/test_sanitize.rb +20 -16
- data/test/core/file/test_split_all.rb +8 -4
- data/test/core/file/test_write.rb +12 -8
- data/test/core/file/test_writelines.rb +11 -7
- data/test/core/filetest/test_root.rb +7 -3
- data/test/core/functor_tc.rb +27 -15
- data/test/core/hash/test_alias.rb +16 -8
- data/test/core/hash/test_argumentize.rb +14 -10
- data/test/core/hash/test_at.rb +9 -5
- data/test/core/hash/test_autonew.rb +15 -11
- data/test/core/hash/test_collate.rb +43 -33
- data/test/core/hash/test_count.rb +7 -3
- data/test/core/hash/test_data.rb +23 -19
- data/test/core/hash/test_dearray_values.rb +17 -9
- data/test/core/hash/test_deep_merge.rb +19 -11
- data/test/core/hash/test_delete_at.rb +12 -8
- data/test/core/hash/test_delete_unless.rb +12 -8
- data/test/core/hash/test_delete_values.rb +22 -14
- data/test/core/hash/test_diff.rb +10 -6
- data/test/core/hash/test_expect.rb +16 -8
- data/test/core/hash/test_graph.rb +29 -21
- data/test/core/hash/test_insert.rb +11 -7
- data/test/core/hash/test_inverse.rb +11 -7
- data/test/core/hash/test_join.rb +23 -19
- data/test/core/hash/test_keys.rb +38 -19
- data/test/core/hash/test_new_with.rb +10 -6
- data/test/core/hash/test_op_add.rb +11 -7
- data/test/core/hash/test_op_and.rb +22 -18
- data/test/core/hash/test_op_mul.rb +10 -6
- data/test/core/hash/test_op_or.rb +10 -6
- data/test/core/hash/test_op_push.rb +26 -22
- data/test/core/hash/test_op_sub.rb +19 -11
- data/test/core/hash/test_recurse.rb +27 -19
- data/test/core/hash/test_recursively.rb +57 -53
- data/test/core/hash/test_rekey.rb +64 -56
- data/test/core/hash/test_replace_each.rb +10 -6
- data/test/core/hash/test_reverse_merge.rb +28 -16
- data/test/core/hash/test_select.rb +37 -33
- data/test/core/hash/test_slice.rb +16 -8
- data/test/core/hash/test_stringify_keys.rb +17 -9
- data/test/core/hash/test_swap.rb +8 -4
- data/test/core/hash/test_symbolize_keys.rb +17 -9
- data/test/core/hash/test_to_mod.rb +16 -12
- data/test/core/hash/test_to_proc.rb +13 -9
- data/test/core/hash/test_to_struct.rb +13 -9
- data/test/core/hash/test_traverse.rb +21 -13
- data/test/core/hash/test_update_each.rb +10 -6
- data/test/core/hash/test_update_keys.rb +14 -10
- data/test/core/hash/test_update_values.rb +9 -6
- data/test/core/hash/test_weave.rb +10 -6
- data/test/core/hash/test_zip.rb +9 -5
- data/test/core/indexable_tc.rb +156 -107
- data/test/core/integer/test_bitmask.rb +52 -39
- data/test/core/integer/test_even.rb +14 -7
- data/test/core/integer/test_factorial.rb +22 -14
- data/test/core/integer/test_multiple.rb +10 -7
- data/test/core/integer/test_odd.rb +14 -7
- data/test/core/integer/test_of.rb +25 -13
- data/test/core/integer/test_ordinal.rb +19 -12
- data/test/core/kernel/test_as.rb +46 -31
- data/test/core/kernel/test_ask.rb +3 -2
- data/test/core/kernel/test_assign.rb +44 -39
- data/test/core/kernel/test_assign_from.rb +32 -24
- data/test/core/kernel/test_attr_singleton.rb +26 -14
- data/test/core/kernel/test_blank.rb +51 -31
- data/test/core/kernel/test_callstack.rb +13 -5
- data/test/core/kernel/test_class.rb +8 -4
- data/test/core/kernel/test_complete.rb +13 -9
- data/test/core/kernel/test_constant.rb +10 -6
- data/test/core/kernel/test_d.rb +3 -3
- data/test/core/kernel/test_deep_copy.rb +29 -21
- data/test/core/kernel/test_dir.rb +14 -6
- data/test/core/kernel/test_disable_warnings.rb +22 -10
- data/test/core/kernel/test_ergo.rb +21 -12
- data/test/core/kernel/test_extension.rb +10 -6
- data/test/core/kernel/test_get.rb +40 -20
- data/test/core/kernel/test_here.rb +7 -3
- data/test/core/kernel/test_in.rb +8 -4
- data/test/core/kernel/test_instance_assign.rb +13 -9
- data/test/core/kernel/test_instance_class.rb +8 -4
- data/test/core/kernel/test_instance_send.rb +16 -12
- data/test/core/kernel/test_maybe.rb +7 -3
- data/test/core/kernel/test_meta_alias.rb +10 -6
- data/test/core/kernel/test_meta_class.rb +23 -15
- data/test/core/kernel/test_meta_def.rb +9 -5
- data/test/core/kernel/test_meta_eval.rb +11 -7
- data/test/core/kernel/test_method.rb +11 -7
- data/test/core/kernel/test_not.rb +38 -31
- data/test/core/kernel/test_not_nil.rb +16 -12
- data/test/core/kernel/test_object_class.rb +13 -5
- data/test/core/kernel/test_object_hexid.rb +9 -5
- data/test/core/kernel/test_object_send.rb +15 -11
- data/test/core/kernel/test_presence.rb +27 -19
- data/test/core/kernel/test_qua_class.rb +16 -10
- data/test/core/kernel/test_require_all.rb +3 -3
- data/test/core/kernel/test_require_relative.rb +3 -3
- data/test/core/kernel/test_respond.rb +25 -19
- data/test/core/kernel/test_returning.rb +10 -6
- data/test/core/kernel/test_silence.rb +7 -7
- data/test/core/kernel/test_singleton_class.rb +9 -5
- data/test/core/kernel/test_source_location.rb +17 -10
- data/test/core/kernel/test_super_method.rb +16 -13
- data/test/core/kernel/test_tap.rb +27 -23
- data/test/core/kernel/test_temporarily.rb +16 -12
- data/test/core/kernel/test_true.rb +21 -13
- data/test/core/kernel/test_try.rb +22 -14
- data/test/core/kernel/test_val.rb +22 -18
- data/test/core/kernel/test_with.rb +10 -6
- data/test/core/kernel/test_writers.rb +40 -36
- data/test/core/matchdata/test_match.rb +8 -4
- data/test/core/matchdata/test_matchset.rb +19 -9
- data/test/core/module/test_abstract.rb +16 -12
- data/test/core/module/test_alias_accessor.rb +17 -13
- data/test/core/module/test_alias_method_chain.rb +23 -20
- data/test/core/module/test_alias_module_function.rb +14 -11
- data/test/core/module/test_all_instance_methods.rb +19 -15
- data/test/core/module/test_ancestor.rb +9 -5
- data/test/core/module/test_anonymous.rb +11 -7
- data/test/core/module/test_attr_setter.rb +19 -15
- data/test/core/module/test_basename.rb +7 -3
- data/test/core/module/test_can.rb +12 -8
- data/test/core/module/test_class.rb +13 -9
- data/test/core/module/test_class_def.rb +15 -11
- data/test/core/module/test_instance_method.rb +12 -8
- data/test/core/module/test_instance_method_defined.rb +25 -13
- data/test/core/module/test_integrate.rb +16 -12
- data/test/core/module/test_is.rb +33 -26
- data/test/core/module/test_methodize.rb +14 -6
- data/test/core/module/test_modname.rb +7 -3
- data/test/core/module/test_module_def.rb +15 -11
- data/test/core/module/test_nodef.rb +10 -6
- data/test/core/module/test_op.rb +40 -26
- data/test/core/module/test_pathize.rb +14 -6
- data/test/core/module/test_redefine_method.rb +19 -11
- data/test/core/module/test_redirect_method.rb +19 -11
- data/test/core/module/test_remove.rb +10 -7
- data/test/core/module/test_rename_method.rb +21 -13
- data/test/core/module/test_revise.rb +41 -30
- data/test/core/module/test_set.rb +19 -15
- data/test/core/module/test_spacename.rb +8 -4
- data/test/core/module/test_to_obj.rb +12 -8
- data/test/core/module/test_wrap_method.rb +19 -11
- data/test/core/nilclass/test_to_f.rb +7 -4
- data/test/core/numeric/test_approx.rb +10 -6
- data/test/core/numeric/test_distance.rb +9 -5
- data/test/core/numeric/test_length.rb +8 -4
- data/test/core/numeric/test_round.rb +51 -33
- data/test/core/numeric/test_spacing.rb +10 -6
- data/test/core/object/test_dup.rb +55 -56
- data/test/core/object/test_object_state.rb +57 -54
- data/test/core/object/test_replace.rb +47 -42
- data/test/core/object/test_try_dup.rb +38 -25
- data/test/core/proc/test_bind.rb +20 -17
- data/test/core/proc/test_bind_to.rb +10 -6
- data/test/core/proc/test_compose.rb +19 -11
- data/test/core/proc/test_curry.rb +31 -27
- data/test/core/proc/test_partial.rb +19 -15
- data/test/core/proc/test_to_method.rb +28 -24
- data/test/core/proc/test_update.rb +8 -4
- data/test/core/range/test_combine.rb +23 -15
- data/test/core/range/test_overlap.rb +8 -4
- data/test/core/range/test_to_r.rb +11 -7
- data/test/core/range/test_umbrella.rb +23 -19
- data/test/core/range/test_within.rb +19 -6
- data/test/core/regexp/test_arity.rb +20 -10
- data/test/core/regexp/test_multiline.rb +12 -8
- data/test/core/regexp/test_op_add.rb +8 -4
- data/test/core/regexp/test_op_or.rb +9 -5
- data/test/core/regexp/test_to_re.rb +15 -7
- data/test/core/string/test_align.rb +19 -11
- data/test/core/string/test_bracket.rb +28 -24
- data/test/core/string/test_bytes.rb +6 -4
- data/test/core/string/test_camelcase.rb +58 -49
- data/test/core/string/test_capitalized.rb +21 -11
- data/test/core/string/test_characters.rb +6 -4
- data/test/core/string/test_cleanlines.rb +5 -3
- data/test/core/string/test_cleave.rb +19 -15
- data/test/core/string/test_cmp.rb +12 -8
- data/test/core/string/test_compress_lines.rb +11 -7
- data/test/core/string/test_divide.rb +10 -6
- data/test/core/string/test_each_char.rb +10 -6
- data/test/core/string/test_each_word.rb +10 -6
- data/test/core/string/test_edit_distance.rb +12 -8
- data/test/core/string/test_end_with.rb +15 -7
- data/test/core/string/test_exclude.rb +15 -11
- data/test/core/string/test_expand_tabs.rb +39 -36
- data/test/core/string/test_file.rb +8 -4
- data/test/core/string/test_fold.rb +14 -10
- data/test/core/string/test_indent.rb +66 -57
- data/test/core/string/test_index_all.rb +7 -3
- data/test/core/string/test_interpolate.rb +8 -4
- data/test/core/string/test_lchomp.rb +17 -9
- data/test/core/string/test_line_wrap.rb +8 -4
- data/test/core/string/test_lines.rb +8 -4
- data/test/core/string/test_lowercase.rb +10 -6
- data/test/core/string/test_margin.rb +107 -90
- data/test/core/string/test_methodize.rb +19 -15
- data/test/core/string/test_modulize.rb +19 -15
- data/test/core/string/test_mscan.rb +12 -8
- data/test/core/string/test_natcmp.rb +12 -8
- data/test/core/string/test_nchar.rb +10 -6
- data/test/core/string/test_newlines.rb +5 -3
- data/test/core/string/test_op_div.rb +8 -4
- data/test/core/string/test_op_sub.rb +8 -4
- data/test/core/string/test_pathize.rb +19 -16
- data/test/core/string/test_quote.rb +35 -32
- data/test/core/string/test_range.rb +24 -12
- data/test/core/string/test_rewrite.rb +10 -6
- data/test/core/string/test_shatter.rb +10 -6
- data/test/core/string/test_similarity.rb +7 -3
- data/test/core/string/test_snakecase.rb +10 -6
- data/test/core/string/test_splice.rb +27 -21
- data/test/core/string/test_squish.rb +21 -13
- data/test/core/string/test_start_with.rb +15 -7
- data/test/core/string/test_store.rb +9 -5
- data/test/core/string/test_subtract.rb +9 -5
- data/test/core/string/test_tab.rb +8 -4
- data/test/core/string/test_tabto.rb +8 -4
- data/test/core/string/test_titlecase.rb +9 -5
- data/test/core/string/test_to_re.rb +25 -17
- data/test/core/string/test_unbracket.rb +27 -15
- data/test/core/string/test_underscore.rb +13 -9
- data/test/core/string/test_unfold.rb +10 -6
- data/test/core/string/test_unindent.rb +65 -60
- data/test/core/string/test_unquote.rb +7 -3
- data/test/core/string/test_uppercase.rb +13 -9
- data/test/core/string/test_variablize.rb +8 -4
- data/test/core/string/test_word_wrap.rb +64 -42
- data/test/core/string/test_words.rb +16 -10
- data/test/core/string/test_xor.rb +9 -5
- data/test/core/symbol/test_as_s.rb +8 -4
- data/test/core/symbol/test_bang.rb +9 -5
- data/test/core/symbol/test_chomp.rb +12 -4
- data/test/core/symbol/test_generate.rb +11 -7
- data/test/core/symbol/test_not.rb +11 -7
- data/test/core/symbol/test_op_div.rb +8 -4
- data/test/core/symbol/test_plain.rb +11 -5
- data/test/core/symbol/test_query.rb +11 -5
- data/test/core/symbol/test_setter.rb +9 -5
- data/test/core/symbol/test_succ.rb +9 -5
- data/test/core/symbol/test_to_proc.rb +24 -21
- data/test/core/symbol/test_variablize.rb +7 -3
- data/test/core/time/test_ago.rb +8 -5
- data/test/core/time/test_change.rb +10 -6
- data/test/core/time/test_dst_adjustment.rb +4 -3
- data/test/core/time/test_elapse.rb +8 -4
- data/test/core/time/test_future.rb +22 -11
- data/test/core/time/test_hence.rb +8 -5
- data/test/core/time/test_in.rb +8 -5
- data/test/core/time/test_less.rb +30 -28
- data/test/core/time/test_past.rb +22 -11
- data/test/core/time/test_round_to.rb +22 -16
- data/test/core/time/test_set.rb +31 -27
- data/test/core/time/test_shift.rb +128 -119
- data/test/core/time/test_stamp.rb +26 -18
- data/test/core/time/test_to_time.rb +8 -4
- data/test/core/time/test_trunc.rb +23 -17
- data/test/core/to_hash_tc.rb +138 -91
- data/test/core/unboundmethod/test_arguments.rb +16 -12
- data/test/core/unboundmethod/test_name.rb +11 -7
- data/test/standard/test_date.rb +49 -29
- data/test/standard/test_ostruct.rb +144 -127
- data/test/standard/test_random.rb +162 -119
- data/test/standard/test_shellwords.rb +51 -45
- data/test/standard/test_thread.rb +15 -12
- data/test/standard/test_timer.rb +38 -28
- data/test/standard/test_uri.rb +24 -16
- data/test/supplemental/test_argvector.rb +51 -39
- data/test/supplemental/test_enumargs.rb +89 -0
- data/test/supplemental/test_memoizable.rb +29 -25
- data/test/supplemental/test_multipliers.rb +90 -47
- data/test/supplemental/test_tuple.rb +48 -36
- data/work/CHANGES +2529 -0
- data/work/NOTES.rdoc +143 -0
- data/work/bench/bench_load.rb +56 -0
- data/work/bench/enumerable/bench_collect.rb +84 -0
- data/work/bench/enumerable/bench_count.rb +58 -0
- data/work/bench/general/bench_calls.rb +74 -0
- data/work/bench/general/bench_includes.rb +25 -0
- data/work/bench/general/bench_methods.rb +17 -0
- data/work/bench/general/bench_pathname.rb +24 -0
- data/work/bench/general/bench_range.rb +64 -0
- data/work/bench/general/bench_return.rb +56 -0
- data/work/bench/general/bench_yeild.rb +75 -0
- data/work/bench/general/comment_loading/bench.rb +46 -0
- data/work/bench/general/comment_loading/comments_begin.rb +109 -0
- data/work/bench/general/comment_loading/comments_end.rb +127 -0
- data/work/bench/general/comment_loading/comments_none.rb +1 -0
- data/work/bench/general/comment_loading/comments_sharp.rb +125 -0
- data/work/bench/hash/bench_slice.rb +62 -0
- data/work/bench/integer/bench_factorial.rb +31 -0
- data/work/consider/aspects.rb +254 -0
- data/work/consider/attr.rb +82 -0
- data/work/consider/bin.rb +26 -0
- data/work/consider/blackmagic.rb +103 -0
- data/work/consider/bool_attr_accessor.rb +414 -0
- data/work/consider/duration.rb +286 -0
- data/work/consider/forwardable_chain.patch +448 -0
- data/work/consider/knowself.rb +42 -0
- data/work/consider/lib/core/facets.rb +37 -0
- data/work/consider/lib/core/facets/array/fetch.rb +37 -0
- data/work/consider/lib/core/facets/array/op_div.rb +23 -0
- data/work/consider/lib/core/facets/hash/having.rb +75 -0
- data/work/consider/lib/core/facets/string/trim.rb +70 -0
- data/work/consider/lib/more/facets/argv.rb +47 -0
- data/work/consider/lib/more/facets/extension.rb +30 -0
- data/work/consider/lib/more/facets/fixnum.rb +55 -0
- data/work/consider/lib/more/facets/forwardable_chain.patch +448 -0
- data/work/consider/lib/more/facets/gem.rb +23 -0
- data/work/consider/lib/more/facets/interface.rb +230 -0
- data/work/consider/lib/more/facets/plugin.rb +153 -0
- data/work/consider/lib/more/facets/recorder.rb +54 -0
- data/work/consider/lib/more/facets/tasksystem.rb +350 -0
- data/work/consider/mapcar.rb +74 -0
- data/work/consider/require_directory.rb +4 -0
- data/work/consider/set.rb +47 -0
- data/work/consider/succ.rb +44 -0
- data/work/consider/succ_case.rb +39 -0
- data/work/defunct/core/facets/array/combinations.rb +33 -0
- data/work/defunct/core/facets/array/combos.rb +47 -0
- data/work/defunct/core/facets/array/each_uniq_pair.rb +43 -0
- data/work/defunct/core/facets/array/permutation.rb +75 -0
- data/work/defunct/core/facets/array/to_path.rb +14 -0
- data/work/defunct/core/facets/class/initializer.rb +60 -0
- data/work/defunct/core/facets/class/prepend.rb +52 -0
- data/work/defunct/core/facets/class/remove_descendents.rb +42 -0
- data/work/defunct/core/facets/enumerable/cascade.rb +28 -0
- data/work/defunct/core/facets/enumerable/each.rb +89 -0
- data/work/defunct/core/facets/enumerable/to_hash.rb +30 -0
- data/work/defunct/core/facets/hash/access.rb +146 -0
- data/work/defunct/core/facets/hash/group_by_value.rb +66 -0
- data/work/defunct/core/facets/hash/normalize_keys.rb +134 -0
- data/work/defunct/core/facets/hash/op_div.rb +11 -0
- data/work/defunct/core/facets/hash/variablize_keys.rb +48 -0
- data/work/defunct/core/facets/kernel/__assign__.rb +28 -0
- data/work/defunct/core/facets/kernel/__real__.rb +48 -0
- data/work/defunct/core/facets/kernel/deep_clone.rb +48 -0
- data/work/defunct/core/facets/kernel/instance_assume.rb +66 -0
- data/work/defunct/core/facets/kernel/once.rb +54 -0
- data/work/defunct/core/facets/kernel/warn_with_line.rb +29 -0
- data/work/defunct/core/facets/method/curry.rb +10 -0
- data/work/defunct/core/facets/method/partial.rb +10 -0
- data/work/defunct/core/facets/module/attr_toggler.rb +59 -0
- data/work/defunct/core/facets/module/by_name.rb +56 -0
- data/work/defunct/core/facets/module/compare_on.rb +35 -0
- data/work/defunct/core/facets/module/equate_on.rb +36 -0
- data/work/defunct/core/facets/module/methodize.rb +19 -0
- data/work/defunct/core/facets/module/module_method.rb +14 -0
- data/work/defunct/core/facets/module/on_included.rb +80 -0
- data/work/defunct/core/facets/proc/bind.rb +38 -0
- data/work/defunct/core/facets/proc/to_h.rb +22 -0
- data/work/defunct/core/facets/string/camelcase.rb +25 -0
- data/work/defunct/core/facets/string/indexable.rb +144 -0
- data/work/defunct/core/facets/string/stackable.rb +181 -0
- data/work/defunct/core/facets/string/to_const.rb +31 -0
- data/work/defunct/core/facets/string/to_proc.rb +52 -0
- data/work/defunct/core/facets/symbol/pad.rb +1 -0
- data/work/defunct/core/facets/symbol/shadow.rb +37 -0
- data/work/defunct/core/facets/symbol/to_const.rb +31 -0
- data/work/defunct/more/facets/annotations.rb +302 -0
- data/work/defunct/more/facets/duration.rb +540 -0
- data/work/defunct/more/facets/logger.rb +158 -0
- data/work/defunct/more/facets/multiton.rb +390 -0
- data/work/defunct/more/facets/multiton2.rb +237 -0
- data/work/defunct/more/facets/uploadutils.rb +466 -0
- data/work/defunct/script/conflicts +63 -0
- data/work/defunct/script/methods +49 -0
- data/work/defunct/test/string/test_crypt.rb +17 -0
- data/work/defunct/test/string/test_indexable.rb +68 -0
- data/work/defunct/test/string/test_stackable.rb +94 -0
- data/work/defunct/test/string/test_stylize.rb +52 -0
- data/work/defunct/test/test_continuation.rb +15 -0
- data/work/defunct/test/test_instance_exec.rb +44 -0
- data/work/defunct/test/test_ioredirect.rb +23 -0
- data/work/defunct/test/test_prepend.rb +19 -0
- data/work/defunct/test/test_succ.rb +35 -0
- data/work/defunct/yard.assembly +44 -0
- data/work/sandbox/component.rb +120 -0
- data/work/sandbox/enumerator.rb +12 -0
- data/work/sandbox/enumx.rb +116 -0
- data/work/sandbox/express.rb +48 -0
- data/work/sandbox/multidispatch.rb +236 -0
- data/work/sandbox/multidispatch0.rb +224 -0
- data/work/sandbox/multiton2.rb +590 -0
- data/work/sandbox/namespace.rb +169 -0
- data/work/sandbox/safe-study/safe_extension.rb +17 -0
- data/work/sandbox/safe-study/safe_study.rb +16 -0
- data/work/sandbox/to_data.rb +141 -0
- data/work/sandbox/visit.rb +62 -0
- data/work/site/endorse.page +65 -0
- data/work/site/posts/2010-01-25-test_rails_with_facets.post +151 -0
- data/work/site/posts/enumargs.md +30 -0
- data/work/site/posts/tomslib.rb +47 -0
- data/work/site/posts/weblog.xml +78 -0
- data/work/site/sidebar.txt +19 -0
- data/work/todo/more/test_basicobject.rb +34 -0
- data/work/todo/more/test_fileutils_slice.rb +88 -0
- data/work/todo/more/test_fileutils_wc.rb +53 -0
- data/work/todo/more/test_fileutils_which.rb +45 -0
- data/work/todo/more/test_getoptlong.rb +26 -0
- data/work/todo/more/test_multiton.rb +184 -0
- data/work/trash/hook.rdoc +49 -0
- data/work/trash/menu.html +71 -0
- data/work/trash/site-jekyll/.htaccess +1 -0
- data/work/trash/site-jekyll/.rsync-filter +7 -0
- data/work/trash/site-jekyll/.till +1 -0
- data/work/trash/site-jekyll/_config.yml +6 -0
- data/work/trash/site-jekyll/_layouts/default.html +101 -0
- data/work/trash/site-jekyll/_layouts/post.html +23 -0
- data/work/trash/site-jekyll/_posts/2008-01-01-how-facets-was-born.markdown +25 -0
- data/work/trash/site-jekyll/_posts/2008-04-04-times-collect.markdown +33 -0
- data/work/trash/site-jekyll/_posts/2008-10-10-string-margin.markdown +52 -0
- data/work/trash/site-jekyll/_posts/2009-07-21-new-website.markdown +16 -0
- data/work/trash/site-jekyll/_posts/2009-08-22-release-2-7.markdown +127 -0
- data/work/trash/site-jekyll/_posts/2009-11-09-release-2-8.markdown +58 -0
- data/work/trash/site-jekyll/about.html +79 -0
- data/work/trash/site-jekyll/assets/scripts/hover.js +14 -0
- data/work/trash/site-jekyll/assets/scripts/rdocs.js +28 -0
- data/work/trash/site-jekyll/assets/styles/site.css +317 -0
- data/work/trash/site-jekyll/assets/styles/syntax.css +60 -0
- data/work/trash/site-jekyll/atom.xml +23 -0
- data/work/trash/site-jekyll/community.html +72 -0
- data/work/trash/site-jekyll/download.html +84 -0
- data/work/trash/site-jekyll/endorse.html +64 -0
- data/work/trash/site-jekyll/index.html +17 -0
- data/work/trash/site-jekyll/learn.html +221 -0
- data/work/trash/site-jekyll/source.html +74 -0
- data/work/trash/site/.htaccess +1 -0
- data/work/trash/site/.rsync-filter +10 -0
- data/work/trash/site/js/hover.js +14 -0
- data/work/trash/site/js/rdocs.js +28 -0
- data/work/trash/site/quick.html +250 -0
- data/work/trash/site/splash.html +44 -0
- data/work/trash/task/count +48 -0
- data/work/trash/task/load +40 -0
- data/work/trash/task/publish +83 -0
- data/work/trash/task/tag +26 -0
- data/work/trash/test_inject.rb +17 -0
- metadata +1017 -523
- data/NOTICE +0 -27
- data/test/core/module/test_method_clash.rb +0 -50
@@ -0,0 +1,42 @@
|
|
1
|
+
# Of course I'm not sure all of these are "real",
|
2
|
+
# but that's okay for now.
|
3
|
+
|
4
|
+
class Symbol
|
5
|
+
def self.coercer ; :to_sym ; end
|
6
|
+
def self.convertor ; :intern ; end
|
7
|
+
end
|
8
|
+
|
9
|
+
class Array
|
10
|
+
def self.coercer ; :to_ary ; end
|
11
|
+
def self.convertor ; :to_a ; end
|
12
|
+
end
|
13
|
+
|
14
|
+
class Hash
|
15
|
+
def self.coercer ; :to_hash ; end
|
16
|
+
def self.convertor ; :to_h ; end
|
17
|
+
end
|
18
|
+
|
19
|
+
class String
|
20
|
+
def self.coercer ; :to_str ; end
|
21
|
+
def self.convertor ; :to_s ; end
|
22
|
+
end
|
23
|
+
|
24
|
+
class Range
|
25
|
+
def self.coercer ; :to_rng ; end
|
26
|
+
def self.convertor ; :to_r ; end
|
27
|
+
end
|
28
|
+
|
29
|
+
class Regexp
|
30
|
+
def self.coercer ; :to_rexp ; end
|
31
|
+
def self.convertor ; :to_re ; end
|
32
|
+
end
|
33
|
+
|
34
|
+
class Integer
|
35
|
+
def self.coercer ; :to_int ; end
|
36
|
+
def self.convertor ; :to_i ; end
|
37
|
+
end
|
38
|
+
|
39
|
+
class Float
|
40
|
+
def self.coercer ; :to_float ; end
|
41
|
+
def self.convertor ; :to_f ; end
|
42
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# Dynamically load all core libraries.
|
2
|
+
|
3
|
+
# Nah... lets do it statically.
|
4
|
+
module Facets
|
5
|
+
|
6
|
+
# Libraries to exclude from default require.
|
7
|
+
EXTRANEOUS = %w{
|
8
|
+
succ.rb
|
9
|
+
kernel/autoreload.rb
|
10
|
+
kernel/once.rb
|
11
|
+
kernel/this.rb
|
12
|
+
module/attr_validator.rb
|
13
|
+
module/instance_function.rb
|
14
|
+
object/instance_eval.rb
|
15
|
+
proc/partial.rb
|
16
|
+
string/mask.rb
|
17
|
+
string/obfuscate.rb
|
18
|
+
string/stylize.rb
|
19
|
+
string/words.rb
|
20
|
+
}
|
21
|
+
|
22
|
+
def self.require
|
23
|
+
__DIR__ = File.dirname(__FILE__)
|
24
|
+
list = []
|
25
|
+
Dir.chdir("#{__DIR__}/facets") do
|
26
|
+
list = Dir['**/*']
|
27
|
+
list.reject!{ |d| File.directory?(d) }
|
28
|
+
end
|
29
|
+
list -= EXTRANEOUS
|
30
|
+
list = list.map{ |f| File.join('facets', f) }
|
31
|
+
list.each{ |f| p f; Kernel.require(f) }
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
35
|
+
|
36
|
+
Facets.require
|
37
|
+
|
@@ -0,0 +1,37 @@
|
|
1
|
+
class Array
|
2
|
+
|
3
|
+
# TODO Probably not best to overide store and fetch operators. Rename?
|
4
|
+
|
5
|
+
# Modifies #[] to also accept an array of indexes.
|
6
|
+
#
|
7
|
+
# a = ['a','b','c','d','e','f']
|
8
|
+
#
|
9
|
+
# a[[1]] #=> ['b']
|
10
|
+
# a[[1,1]] #=> ['b','b']
|
11
|
+
# a[[1,-1]] #=> ['b','f']
|
12
|
+
# a[[0,2,4]] #=> ['a','c','e']
|
13
|
+
#
|
14
|
+
def [](*args)
|
15
|
+
return values_at(*args.at(0)) if Array === args.at(0)
|
16
|
+
return slice(*args)
|
17
|
+
end
|
18
|
+
|
19
|
+
# Modifies #[]= to accept an array of indexes for assignment.
|
20
|
+
#
|
21
|
+
# a = ['a','b','c','d']
|
22
|
+
#
|
23
|
+
# a[[1,-1]] = ['m','n'] #=> ['m','n']
|
24
|
+
# a #=> ['a','m','c','n']
|
25
|
+
#
|
26
|
+
def []=(*args)
|
27
|
+
if Array === args.at(0)
|
28
|
+
idx,vals = args.at(0),args.at(1)
|
29
|
+
idx.each_with_index{ |a,i| store(a,vals.at(i)) }
|
30
|
+
return values_at( *idx )
|
31
|
+
else
|
32
|
+
return store(*args)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
37
|
+
|
@@ -0,0 +1,23 @@
|
|
1
|
+
class Array
|
2
|
+
|
3
|
+
# Index operator.
|
4
|
+
#
|
5
|
+
# a = [:a, :b, :c]
|
6
|
+
# (a/1) #=> :a
|
7
|
+
alias_method :/, :[]
|
8
|
+
|
9
|
+
# DEPRECATED -- Use 'each_slice(n).to_a' as of 1.9.
|
10
|
+
# Partition an array into parts of given length.
|
11
|
+
#
|
12
|
+
# CREDIT: WhyTheLuckyStiff ...
|
13
|
+
#
|
14
|
+
# def / len
|
15
|
+
# inject([]) do |ary, x|
|
16
|
+
# ary << [] if [*ary.last].nitems % len == 0
|
17
|
+
# ary.last << x
|
18
|
+
# ary
|
19
|
+
# end
|
20
|
+
# end
|
21
|
+
|
22
|
+
end
|
23
|
+
|
@@ -0,0 +1,75 @@
|
|
1
|
+
## THIS IS NOT THUROUGH ENOUGH
|
2
|
+
## PROBABY SHOULD MAKE SPECIAL SUBCLASSES
|
3
|
+
## OF HASH TO HANDLE THIS CONCEPT.
|
4
|
+
#
|
5
|
+
# IMPORTANT TODO!!!!
|
6
|
+
|
7
|
+
#
|
8
|
+
|
9
|
+
class Hash
|
10
|
+
|
11
|
+
attr_accessor :fallback
|
12
|
+
|
13
|
+
# Define a fallback object for #fetch and #[].
|
14
|
+
#
|
15
|
+
# f = Hash[:b=>2]
|
16
|
+
# h = Hash[:a=>1].having_aquisition(f)
|
17
|
+
# h[:b] => 2
|
18
|
+
|
19
|
+
def having_aquisition(fallback)
|
20
|
+
|
21
|
+
@fallback = fallback
|
22
|
+
|
23
|
+
unless @fallsback
|
24
|
+
|
25
|
+
def self.[](key)
|
26
|
+
begin
|
27
|
+
return @fallback[key] if @fallback and not key?(key)
|
28
|
+
rescue
|
29
|
+
end
|
30
|
+
val = super
|
31
|
+
p val
|
32
|
+
val.fallback(self) if Hash == val
|
33
|
+
val
|
34
|
+
end
|
35
|
+
|
36
|
+
def self.fetch(key, *args, &blk)
|
37
|
+
begin
|
38
|
+
return @fallback.fetch(key, *args, &blk) if @fallback and not key?(key)
|
39
|
+
rescue
|
40
|
+
end
|
41
|
+
val = super
|
42
|
+
val.fallback(self) if Hash == val
|
43
|
+
val
|
44
|
+
end
|
45
|
+
|
46
|
+
@fallsback = true
|
47
|
+
end
|
48
|
+
|
49
|
+
self
|
50
|
+
end
|
51
|
+
|
52
|
+
# Define a fallback object for #fetch and #[].
|
53
|
+
#
|
54
|
+
# f = Hash[:b=>2]
|
55
|
+
# h = Hash[:a=>1].having_fallback(f)
|
56
|
+
# h[:b] => 2
|
57
|
+
|
58
|
+
def having_fallback(parent=nil)
|
59
|
+
@fallback = parent
|
60
|
+
unless @fallsback
|
61
|
+
def self.[](key)
|
62
|
+
return @fallback[key] if @fallback and not key?(key) rescue super
|
63
|
+
super
|
64
|
+
end
|
65
|
+
|
66
|
+
def self.fetch(key, *args, &blk)
|
67
|
+
return @fallback.fetch(key, *args, &blk) if @fallback and not key?(key) rescue super
|
68
|
+
super
|
69
|
+
end
|
70
|
+
@fallsback = true
|
71
|
+
end
|
72
|
+
self
|
73
|
+
end
|
74
|
+
|
75
|
+
end
|
@@ -0,0 +1,70 @@
|
|
1
|
+
class String
|
2
|
+
def rtrim(char)
|
3
|
+
dump.rtrim!(char)
|
4
|
+
end
|
5
|
+
|
6
|
+
def rtrim!(char)
|
7
|
+
gsub!(/#{Regexp.escape(char)}+$/, '')
|
8
|
+
end
|
9
|
+
|
10
|
+
def ltrim(char)
|
11
|
+
dump.ltrim!(char)
|
12
|
+
end
|
13
|
+
|
14
|
+
def ltrim!(char)
|
15
|
+
gsub!(/^#{Regexp.escape(char)}+/, '')
|
16
|
+
end
|
17
|
+
|
18
|
+
|
19
|
+
=begin
|
20
|
+
Trims a string:
|
21
|
+
|
22
|
+
* removes one initial blank line
|
23
|
+
* removes trailing spaces on each line
|
24
|
+
* if margin is given, removes initial spaces up to and including the margin on each line, plus one space
|
25
|
+
|
26
|
+
This is designed specifically for working with inline documents. Here-documents are great, except they tend to go against the indentation of your code. This method allows a convenient way of using %{}-style documents. For instance:
|
27
|
+
|
28
|
+
USAGE = %{
|
29
|
+
| usage: prog [-o dir] -h file...
|
30
|
+
| where
|
31
|
+
| -o dir outputs to DIR
|
32
|
+
| -h prints this message
|
33
|
+
}.trim("|")
|
34
|
+
|
35
|
+
# USAGE == "usage: prog [-o dir] -h file...\n where"...
|
36
|
+
# (note single space to right of margin is deleted)
|
37
|
+
|
38
|
+
Note carefully that if no margin string is given, then there is no clipping at the beginning of each line and your string will remain indented. You can use tabto(0) to align it with the left of screen (while preserving relative indentation).
|
39
|
+
|
40
|
+
USAGE = %{
|
41
|
+
usage: prog [-o dir] -h file...
|
42
|
+
where
|
43
|
+
-o dir outputs to DIR
|
44
|
+
-h prints this message
|
45
|
+
}.trim.tabto(0)
|
46
|
+
|
47
|
+
# USAGE == (same as last example)
|
48
|
+
|
49
|
+
[Source]
|
50
|
+
=end
|
51
|
+
|
52
|
+
# File lib/extensions/string.rb, line 194
|
53
|
+
def trim(margin=nil)
|
54
|
+
s = self.dup
|
55
|
+
# Remove initial blank line.
|
56
|
+
s.sub!(/\A[ \t]*\n/, "")
|
57
|
+
# Get rid of the margin, if it's specified.
|
58
|
+
unless margin.nil?
|
59
|
+
margin_re = Regexp.escape(margin || "")
|
60
|
+
margin_re = /^[ \t]*#{margin_re} ?/
|
61
|
+
s.gsub!(margin_re, "")
|
62
|
+
end
|
63
|
+
# Remove trailing whitespace on each line
|
64
|
+
s.gsub!(/[ \t]+$/, "")
|
65
|
+
s
|
66
|
+
end
|
67
|
+
|
68
|
+
|
69
|
+
end
|
70
|
+
|
@@ -0,0 +1,47 @@
|
|
1
|
+
|
2
|
+
ARG = ARGV.dup
|
3
|
+
|
4
|
+
class << ARG
|
5
|
+
|
6
|
+
def arguments
|
7
|
+
@arguments ||= select{ |e| e !~ /^-/ && e !~ /=/ }
|
8
|
+
end
|
9
|
+
|
10
|
+
def options
|
11
|
+
@options ||= (
|
12
|
+
pms = {}
|
13
|
+
select{ |e| /[=]/ =~ e }.each do |e|
|
14
|
+
k,v = e.split('=')
|
15
|
+
k.sub!(/^[-]{1,2}/,'')
|
16
|
+
pms.store(k,v)
|
17
|
+
end
|
18
|
+
select{ |e| e =~ /^-/ || e !~ /=/ }.each do |k|
|
19
|
+
k.sub!(/^[-]{1,2}/,'')
|
20
|
+
pms.store(k,true)
|
21
|
+
end
|
22
|
+
pms
|
23
|
+
)
|
24
|
+
end
|
25
|
+
|
26
|
+
def flags
|
27
|
+
@flags ||= select{ |e| e =~ /^-/ || e !~ /=/ }
|
28
|
+
end
|
29
|
+
|
30
|
+
# Have specific flag?
|
31
|
+
|
32
|
+
def flag?(flag)
|
33
|
+
flags.include?(flag)
|
34
|
+
end
|
35
|
+
|
36
|
+
#
|
37
|
+
|
38
|
+
def [](x)
|
39
|
+
case x
|
40
|
+
when Integer
|
41
|
+
arguments[x]
|
42
|
+
else
|
43
|
+
options[x.to_s]
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# Extension mixin
|
2
|
+
|
3
|
+
module Extension
|
4
|
+
|
5
|
+
def self.included(base)
|
6
|
+
name = base.name.split('::').last
|
7
|
+
core = eval("::#{name}")
|
8
|
+
core.send(:include, base)
|
9
|
+
end
|
10
|
+
|
11
|
+
end
|
12
|
+
|
13
|
+
|
14
|
+
if __FILE__ == $0
|
15
|
+
|
16
|
+
module Facets
|
17
|
+
module String
|
18
|
+
include Extension
|
19
|
+
|
20
|
+
def drippy
|
21
|
+
puts "Drippy #{self}"
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
"Hello".drippy
|
27
|
+
|
28
|
+
end
|
29
|
+
|
30
|
+
|
@@ -0,0 +1,55 @@
|
|
1
|
+
#--
|
2
|
+
# Fixnum Constants
|
3
|
+
# Copyright (c) 2005 Thomas Sawyer
|
4
|
+
#
|
5
|
+
# Ruby License
|
6
|
+
#
|
7
|
+
# This module is free software. You may use, modify, and/or redistribute this
|
8
|
+
# software under the same terms as Ruby.
|
9
|
+
#
|
10
|
+
# This program is distributed in the hope that it will be useful, but WITHOUT
|
11
|
+
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
12
|
+
# FOR A PARTICULAR PURPOSE.
|
13
|
+
#++
|
14
|
+
|
15
|
+
# = Fixnum Constants
|
16
|
+
#
|
17
|
+
# Constants providing the numerical limitations of Fixnum class.
|
18
|
+
#
|
19
|
+
# == Synopsis
|
20
|
+
#
|
21
|
+
# require 'mega/fixnum-constants'
|
22
|
+
#
|
23
|
+
# puts Fixnum::MAX #=>
|
24
|
+
#
|
25
|
+
|
26
|
+
class Fixnum
|
27
|
+
N_BYTES = [42].pack('i').size
|
28
|
+
N_BITS = N_BYTES * 8
|
29
|
+
MAX = 2 ** (N_BITS - 2) - 1
|
30
|
+
MIN = -MAX - 1
|
31
|
+
end
|
32
|
+
|
33
|
+
|
34
|
+
|
35
|
+
# _____ _
|
36
|
+
# |_ _|__ ___| |_
|
37
|
+
# | |/ _ \/ __| __|
|
38
|
+
# | | __/\__ \ |_
|
39
|
+
# |_|\___||___/\__|
|
40
|
+
#
|
41
|
+
|
42
|
+
# TODO
|
43
|
+
|
44
|
+
=begin testing
|
45
|
+
|
46
|
+
require 'test/unit'
|
47
|
+
|
48
|
+
class TC_FixnumConst < Test::Unit::TestCase
|
49
|
+
|
50
|
+
def test_01
|
51
|
+
end
|
52
|
+
|
53
|
+
end
|
54
|
+
|
55
|
+
=end
|
@@ -0,0 +1,448 @@
|
|
1
|
+
Index: lib/more/facets/forwardable_chain.rb
|
2
|
+
===================================================================
|
3
|
+
--- lib/more/facets/forwardable_chain.rb (revision 0)
|
4
|
+
+++ lib/more/facets/forwardable_chain.rb (revision 0)
|
5
|
+
@@ -0,0 +1,162 @@
|
6
|
+
+# The ForwardableChain module is a superset of the capabilities of Forwardable.
|
7
|
+
+# It provides delegation of specified methods to a chain of designated objects,
|
8
|
+
+# using the class method _def_delegator_chain_. This class method becomes
|
9
|
+
+# available to your module when ForwardableChain is included in your module as
|
10
|
+
+# in the example below. (Note: *include* rather than _extend_.) Your module will
|
11
|
+
+# reveal ForwardableChain to be in its type hierarchy (see Module#ancestors),
|
12
|
+
+# which can be useful for debugging.
|
13
|
+
+#
|
14
|
+
+# The pattern implemented by ForwardableChain is useful in creating presenter
|
15
|
+
+# classes and facade classes whose purpose is to abstract away the complexity of
|
16
|
+
+# working with graphs of objects.
|
17
|
+
+#
|
18
|
+
+# For example, say you have a class _AccountFacade_ which has attributes
|
19
|
+
+# _current_ and _legacy_ representing two distinct but analogous system
|
20
|
+
+# interfaces. You can use ForwardableChain to define methods of AccountFacade
|
21
|
+
+# which call methods deep in the object graph of _current_ and _legacy_.
|
22
|
+
+#
|
23
|
+
+# class AccountPresenter
|
24
|
+
+#
|
25
|
+
+# include ForwardableChain
|
26
|
+
+#
|
27
|
+
+# # Define a #name method that looks first in #current and then in
|
28
|
+
+# # #legacy for an account name -- that is, #current overrides #legacy.
|
29
|
+
+# def_delegator_chain :name, {:current => {:account => :name}},
|
30
|
+
+# {:legacy => {:account => {:name_info => :acct_name}}}
|
31
|
+
+#
|
32
|
+
+# # Define a #primary_ssn method that returns
|
33
|
+
+# # current.account.primary_holder.ssn unless any of the intermediate return
|
34
|
+
+# # values are nil.
|
35
|
+
+# def_delegator_chain :primary_ssn, :current => {:account => {:primary_holder => :ssn}}
|
36
|
+
+#
|
37
|
+
+# # Define an #aggregate_balance method that returns current.grand_total
|
38
|
+
+# # unless #current is nil.
|
39
|
+
+# def_delegator_chain :aggregate_balance, :current => :grand_total
|
40
|
+
+#
|
41
|
+
+# end
|
42
|
+
+#
|
43
|
+
+# The following is the sequence of method calls triggered by a call to
|
44
|
+
+# <em>AccountPresenter#name</em> defined above:
|
45
|
+
+#
|
46
|
+
+# - <em>name</em> -- which calls ...
|
47
|
+
+# - <em>current</em> -- if it returns +nil+ then _legacy_ is called, otherwise ...
|
48
|
+
+# - <em>current.account</em> -- on which, unless it returns +nil+, is called ...
|
49
|
+
+# - <em>current.account.name</em> -- if it returns +nil+, then is called ...
|
50
|
+
+# - <em>legacy</em> -- unless it returns +nil+ ...
|
51
|
+
+# - <em>legacy.account</em> -- on which, unless it returns +nil+, is called ...
|
52
|
+
+# - <em>legacy.account.name_info</em> -- on which, unless it returns +nil+, is called ...
|
53
|
+
+# - <em>legacy.account.name_info.acct_name</em>
|
54
|
+
+#
|
55
|
+
+# Methods with arguments are also supported, but be sure that all the methods in
|
56
|
+
+# the chain can receive the same arguments, or else an ArgumentError will occur
|
57
|
+
+# when you call your delegator method.
|
58
|
+
+#
|
59
|
+
+# You can also use instance variables as links in a delegate chain as follows.
|
60
|
+
+#
|
61
|
+
+# class AccountPresenter
|
62
|
+
+#
|
63
|
+
+# include ForwardableChain
|
64
|
+
+#
|
65
|
+
+# # Define an #aggregate_balance method that returns the @grand_total
|
66
|
+
+# # variable of @current unless @current is nil.
|
67
|
+
+# def_delegator_chain :aggregate_balance, :@current => :@grand_total
|
68
|
+
+#
|
69
|
+
+# end
|
70
|
+
+#
|
71
|
+
+# Instance variables and methods both can appear in a chain. As you might
|
72
|
+
+# expect, arguments are ignored when accessing instance variables.
|
73
|
+
+module ForwardableChain
|
74
|
+
+
|
75
|
+
+ module ClassMethods
|
76
|
+
+
|
77
|
+
+ # Alias for #def_instance_delegator_chain.
|
78
|
+
+ def def_delegator_chain(method, *delegates)
|
79
|
+
+ def_instance_delegator_chain method, *delegates
|
80
|
+
+ end
|
81
|
+
+
|
82
|
+
+ # Defines a method _method_ which delegates to a series of method calls
|
83
|
+
+ # described by one or more Hash objects provided as _delegates_.
|
84
|
+
+ #
|
85
|
+
+ # See the examples at ForwardableChain.
|
86
|
+
+ def def_instance_delegator_chain(method, *delegates)
|
87
|
+
+ delegates.each do |delegate|
|
88
|
+
+ DelegateExtension.extend_recursive delegate
|
89
|
+
+ unless delegate.valid_recursive?
|
90
|
+
+ raise ArgumentError,
|
91
|
+
+ 'expected the name of a new method to be defined, followed ' +
|
92
|
+
+ 'by an argument array of zero or more hashes -- possibly ' +
|
93
|
+
+ 'nested, each containing a single key -- representing a ' +
|
94
|
+
+ 'chain of method calls and/or instance variables used to ' +
|
95
|
+
+ 'supply the return value of the method'
|
96
|
+
+ end
|
97
|
+
+ end
|
98
|
+
+ define_method(method) do |*args|
|
99
|
+
+ result = nil
|
100
|
+
+ delegates.each do |delegate|
|
101
|
+
+ unless (value = delegate.call_recursive(self, *args)).nil?
|
102
|
+
+ result = value
|
103
|
+
+ break
|
104
|
+
+ end
|
105
|
+
+ end
|
106
|
+
+ result
|
107
|
+
+ end
|
108
|
+
+ end
|
109
|
+
+
|
110
|
+
+ end
|
111
|
+
+
|
112
|
+
+ module DelegateExtension #:nodoc:
|
113
|
+
+
|
114
|
+
+ class << self
|
115
|
+
+
|
116
|
+
+ def extend_recursive(hash)
|
117
|
+
+ return false unless hash.kind_of?(Hash)
|
118
|
+
+ hash.extend self
|
119
|
+
+ hash.each_pair { |key, value| extend_recursive value }
|
120
|
+
+ true
|
121
|
+
+ end
|
122
|
+
+
|
123
|
+
+ def send_message_or_get_instance_variable(receiver,
|
124
|
+
+ message_or_instance_variable,
|
125
|
+
+ *args)
|
126
|
+
+ if message_or_instance_variable.to_s[0..0] == '@'
|
127
|
+
+ receiver.instance_variable_get message_or_instance_variable
|
128
|
+
+ else
|
129
|
+
+ receiver.send message_or_instance_variable, *args
|
130
|
+
+ end
|
131
|
+
+ end
|
132
|
+
+
|
133
|
+
+ end
|
134
|
+
+
|
135
|
+
+ def call_recursive(receiver, *args)
|
136
|
+
+ next_receiver_name = keys.first
|
137
|
+
+ next_receiver = DelegateExtension.send_message_or_get_instance_variable(receiver,
|
138
|
+
+ next_receiver_name,
|
139
|
+
+ *args)
|
140
|
+
+ return nil if next_receiver.nil?
|
141
|
+
+ next_message_or_delegate = self[next_receiver_name]
|
142
|
+
+ if next_message_or_delegate.respond_to?(:call_recursive)
|
143
|
+
+ return next_message_or_delegate.call_recursive(next_receiver, *args)
|
144
|
+
+ end
|
145
|
+
+ DelegateExtension.send_message_or_get_instance_variable next_receiver,
|
146
|
+
+ next_message_or_delegate,
|
147
|
+
+ *args
|
148
|
+
+ end
|
149
|
+
+
|
150
|
+
+ def valid_recursive?
|
151
|
+
+ return false unless (length == 1)
|
152
|
+
+ next_receiver = self[keys.first]
|
153
|
+
+ return true if next_receiver.kind_of?(Symbol)
|
154
|
+
+ if next_receiver.respond_to?(:valid_recursive?)
|
155
|
+
+ return next_receiver.valid_recursive?
|
156
|
+
+ end
|
157
|
+
+ false
|
158
|
+
+ end
|
159
|
+
+
|
160
|
+
+ end
|
161
|
+
+
|
162
|
+
+ # Extends _other_module_ with the instance methods of ClassMethods.
|
163
|
+
+ def self.included(other_module)
|
164
|
+
+ other_module.extend ClassMethods
|
165
|
+
+ end
|
166
|
+
+
|
167
|
+
+end
|
168
|
+
Index: test/more/test_forwardable_chain.rb
|
169
|
+
===================================================================
|
170
|
+
--- test/more/test_forwardable_chain.rb (revision 0)
|
171
|
+
+++ test/more/test_forwardable_chain.rb (revision 0)
|
172
|
+
@@ -0,0 +1,276 @@
|
173
|
+
+require 'test/unit'
|
174
|
+
+require 'rubygems'
|
175
|
+
+require 'mocha'
|
176
|
+
+require 'facets/forwardable_chain'
|
177
|
+
+
|
178
|
+
+module ForwardableChainTest #:nodoc: all
|
179
|
+
+
|
180
|
+
+ class MethodWithNoDelegates < Test::Unit::TestCase
|
181
|
+
+
|
182
|
+
+ class Foo
|
183
|
+
+
|
184
|
+
+ include ForwardableChain
|
185
|
+
+
|
186
|
+
+ def_instance_delegator_chain :no_delegates
|
187
|
+
+
|
188
|
+
+ end
|
189
|
+
+
|
190
|
+
+ def test_should_return_nil
|
191
|
+
+ assert_nil Foo.new.no_delegates
|
192
|
+
+ end
|
193
|
+
+
|
194
|
+
+ end
|
195
|
+
+
|
196
|
+
+ class MethodWithOneDelegateThatIsInvalidBecauseItContainsMoreThanOneKeyValuePair < Test::Unit::TestCase
|
197
|
+
+
|
198
|
+
+ def test_should_raise_argument_error_from_definition
|
199
|
+
+ assert_raise(ArgumentError) do
|
200
|
+
+ self.class.class_eval <<-end_class_eval
|
201
|
+
+ class Foo
|
202
|
+
+ include ForwardableChain
|
203
|
+
+ def_instance_delegator_chain :one_invalid_delegate, :bar => :baz,
|
204
|
+
+ :bat => :pwop
|
205
|
+
+ end
|
206
|
+
+ end_class_eval
|
207
|
+
+ end
|
208
|
+
+ end
|
209
|
+
+
|
210
|
+
+ end
|
211
|
+
+
|
212
|
+
+ class MethodWithOneSimpleMethodDelegate < Test::Unit::TestCase
|
213
|
+
+
|
214
|
+
+ class Foo
|
215
|
+
+
|
216
|
+
+ include ForwardableChain
|
217
|
+
+
|
218
|
+
+ def_instance_delegator_chain :one_simple_delegate, :bar => :baz
|
219
|
+
+
|
220
|
+
+ end
|
221
|
+
+
|
222
|
+
+ def test_should_call_first_delegate_with_no_args
|
223
|
+
+ foo = Foo.new
|
224
|
+
+
|
225
|
+
+ mock_bar = mock
|
226
|
+
+ mock_bar.expects(:baz).with().returns 'baz'
|
227
|
+
+ foo.expects(:bar).with().returns mock_bar
|
228
|
+
+
|
229
|
+
+ assert_equal 'baz', foo.one_simple_delegate
|
230
|
+
+ end
|
231
|
+
+
|
232
|
+
+ end
|
233
|
+
+
|
234
|
+
+ class MethodWithOneSimpleVariableDelegate < Test::Unit::TestCase
|
235
|
+
+
|
236
|
+
+ class Foo
|
237
|
+
+
|
238
|
+
+ include ForwardableChain
|
239
|
+
+
|
240
|
+
+ def_instance_delegator_chain :one_simple_delegate, :@bar => :@baz
|
241
|
+
+
|
242
|
+
+ end
|
243
|
+
+
|
244
|
+
+ def test_should_access_first_delegate
|
245
|
+
+ foo = Foo.new
|
246
|
+
+
|
247
|
+
+ mock_bar = mock
|
248
|
+
+ mock_bar.expects(:instance_variable_get).with(:@baz).returns 'baz'
|
249
|
+
+ foo.expects(:instance_variable_get).with(:@bar).returns mock_bar
|
250
|
+
+
|
251
|
+
+ assert_equal 'baz', foo.one_simple_delegate
|
252
|
+
+ end
|
253
|
+
+
|
254
|
+
+ end
|
255
|
+
+
|
256
|
+
+ class MethodWithOneComplexMethodDelegate < Test::Unit::TestCase
|
257
|
+
+
|
258
|
+
+ class Foo
|
259
|
+
+
|
260
|
+
+ include ForwardableChain
|
261
|
+
+
|
262
|
+
+ def_instance_delegator_chain :one_complex_delegate, :bar => {:baz => :bat}
|
263
|
+
+
|
264
|
+
+ end
|
265
|
+
+
|
266
|
+
+ def setup
|
267
|
+
+ @foo = Foo.new
|
268
|
+
+ end
|
269
|
+
+
|
270
|
+
+ def test_should_call_delegate_with_no_arguments
|
271
|
+
+ mock_baz = mock
|
272
|
+
+ mock_baz.expects(:bat).with().returns 'bat'
|
273
|
+
+ mock_bar = mock
|
274
|
+
+ mock_bar.expects(:baz).with().returns mock_baz
|
275
|
+
+ @foo.expects(:bar).with().returns mock_bar
|
276
|
+
+
|
277
|
+
+ assert_equal 'bat', @foo.one_complex_delegate
|
278
|
+
+ end
|
279
|
+
+
|
280
|
+
+ def test_should_call_delegate_with_one_argument
|
281
|
+
+ mock_baz = mock
|
282
|
+
+ mock_baz.expects(:bat).with(:an_arg).returns 'bat'
|
283
|
+
+ mock_bar = mock
|
284
|
+
+ mock_bar.expects(:baz).with(:an_arg).returns mock_baz
|
285
|
+
+ @foo.expects(:bar).with(:an_arg).returns mock_bar
|
286
|
+
+
|
287
|
+
+ assert_equal 'bat', @foo.one_complex_delegate(:an_arg)
|
288
|
+
+ end
|
289
|
+
+
|
290
|
+
+ def test_should_call_delegate_with_no_arguments_and_return_nil_if_delegate_has_nil_intermediate_value
|
291
|
+
+ mock_bar = mock
|
292
|
+
+ mock_bar.expects(:baz).with().returns nil
|
293
|
+
+ @foo.expects(:bar).with().returns mock_bar
|
294
|
+
+
|
295
|
+
+ assert_nil @foo.one_complex_delegate
|
296
|
+
+ end
|
297
|
+
+
|
298
|
+
+ def test_should_call_delegate_with_one_argument_and_return_nil_if_delegate_has_nil_intermediate_value
|
299
|
+
+ mock_bar = mock
|
300
|
+
+ mock_bar.expects(:baz).with(:an_arg).returns nil
|
301
|
+
+ @foo.expects(:bar).with(:an_arg).returns mock_bar
|
302
|
+
+
|
303
|
+
+ assert_nil @foo.one_complex_delegate(:an_arg)
|
304
|
+
+ end
|
305
|
+
+
|
306
|
+
+ end
|
307
|
+
+
|
308
|
+
+ class MethodWithOneComplexVariableDelegate < Test::Unit::TestCase
|
309
|
+
+
|
310
|
+
+ class Foo
|
311
|
+
+
|
312
|
+
+ include ForwardableChain
|
313
|
+
+
|
314
|
+
+ def_instance_delegator_chain :one_complex_delegate, :@bar => {:@baz => :@bat}
|
315
|
+
+
|
316
|
+
+ end
|
317
|
+
+
|
318
|
+
+ def setup
|
319
|
+
+ @foo = Foo.new
|
320
|
+
+ end
|
321
|
+
+
|
322
|
+
+ def test_should_access_delegate
|
323
|
+
+ mock_baz = mock
|
324
|
+
+ mock_baz.expects(:instance_variable_get).with(:@bat).returns 'bat'
|
325
|
+
+ mock_bar = mock
|
326
|
+
+ mock_bar.expects(:instance_variable_get).with(:@baz).returns mock_baz
|
327
|
+
+ @foo.expects(:instance_variable_get).with(:@bar).returns mock_bar
|
328
|
+
+
|
329
|
+
+ assert_equal 'bat', @foo.one_complex_delegate
|
330
|
+
+ end
|
331
|
+
+
|
332
|
+
+ def test_should_access_delegate_and_return_nil_if_delegate_has_nil_intermediate_value
|
333
|
+
+ mock_bar = mock
|
334
|
+
+ mock_bar.expects(:instance_variable_get).with(:@baz).returns nil
|
335
|
+
+ @foo.expects(:instance_variable_get).with(:@bar).returns mock_bar
|
336
|
+
+
|
337
|
+
+ assert_nil @foo.one_complex_delegate
|
338
|
+
+ end
|
339
|
+
+
|
340
|
+
+ end
|
341
|
+
+
|
342
|
+
+ class MethodWithTwoJaggedComplexMethodDelegates < Test::Unit::TestCase
|
343
|
+
+
|
344
|
+
+ class Foo
|
345
|
+
+
|
346
|
+
+ include ForwardableChain
|
347
|
+
+
|
348
|
+
+ def_instance_delegator_chain :two_jagged_complex_delegates, {:bar => {:baz => :bat}},
|
349
|
+
+ {:pwop => {:ding => {:dit => :dat}}}
|
350
|
+
+
|
351
|
+
+ end
|
352
|
+
+
|
353
|
+
+ def setup
|
354
|
+
+ @foo = Foo.new
|
355
|
+
+ end
|
356
|
+
+
|
357
|
+
+ def test_should_call_only_first_delegate_with_no_arguments
|
358
|
+
+ mock_baz = mock
|
359
|
+
+ mock_baz.expects(:bat).with().returns 'bat'
|
360
|
+
+ mock_bar = mock
|
361
|
+
+ mock_bar.expects(:baz).with().returns mock_baz
|
362
|
+
+ @foo.expects(:bar).with().returns mock_bar
|
363
|
+
+
|
364
|
+
+ assert_equal 'bat', @foo.two_jagged_complex_delegates
|
365
|
+
+ end
|
366
|
+
+
|
367
|
+
+ def test_should_call_only_first_delegate_with_one_argument
|
368
|
+
+ mock_baz = mock
|
369
|
+
+ mock_baz.expects(:bat).with(:an_arg).returns 'bat'
|
370
|
+
+ mock_bar = mock
|
371
|
+
+ mock_bar.expects(:baz).with(:an_arg).returns mock_baz
|
372
|
+
+ @foo.expects(:bar).with(:an_arg).returns mock_bar
|
373
|
+
+
|
374
|
+
+ assert_equal 'bat', @foo.two_jagged_complex_delegates(:an_arg)
|
375
|
+
+ end
|
376
|
+
+
|
377
|
+
+ def test_should_call_both_delegates_with_no_arguments_and_return_nil_if_both_delegates_have_nil_intermediate_values
|
378
|
+
+ mock_bar = mock
|
379
|
+
+ mock_bar.expects(:baz).with().returns nil
|
380
|
+
+ @foo.expects(:bar).with().returns mock_bar
|
381
|
+
+
|
382
|
+
+ mock_ding = mock
|
383
|
+
+ mock_ding.expects(:dit).with().returns nil
|
384
|
+
+ mock_pwop = mock
|
385
|
+
+ mock_pwop.expects(:ding).with().returns mock_ding
|
386
|
+
+ @foo.expects(:pwop).with().returns mock_pwop
|
387
|
+
+
|
388
|
+
+ assert_nil @foo.two_jagged_complex_delegates
|
389
|
+
+ end
|
390
|
+
+
|
391
|
+
+ def test_should_call_both_delegates_with_one_argument_and_return_nil_if_both_delegates_have_nil_intermediate_values
|
392
|
+
+ mock_bar = mock
|
393
|
+
+ mock_bar.expects(:baz).with(:an_arg).returns nil
|
394
|
+
+ @foo.expects(:bar).with(:an_arg).returns mock_bar
|
395
|
+
+
|
396
|
+
+ mock_ding = mock
|
397
|
+
+ mock_ding.expects(:dit).with(:an_arg).returns nil
|
398
|
+
+ mock_pwop = mock
|
399
|
+
+ mock_pwop.expects(:ding).with(:an_arg).returns mock_ding
|
400
|
+
+ @foo.expects(:pwop).with(:an_arg).returns mock_pwop
|
401
|
+
+
|
402
|
+
+ assert_nil @foo.two_jagged_complex_delegates(:an_arg)
|
403
|
+
+ end
|
404
|
+
+
|
405
|
+
+ end
|
406
|
+
+
|
407
|
+
+ class MethodWithTwoJaggedComplexVariableDelegates < Test::Unit::TestCase
|
408
|
+
+
|
409
|
+
+ class Foo
|
410
|
+
+
|
411
|
+
+ include ForwardableChain
|
412
|
+
+
|
413
|
+
+ def_instance_delegator_chain :two_jagged_complex_delegates, {:@bar => {:@baz => :@bat}},
|
414
|
+
+ {:@pwop => {:@ding => {:@dit => :@dat}}}
|
415
|
+
+
|
416
|
+
+ end
|
417
|
+
+
|
418
|
+
+ def setup
|
419
|
+
+ @foo = Foo.new
|
420
|
+
+ end
|
421
|
+
+
|
422
|
+
+ def test_should_access_only_first_delegate
|
423
|
+
+ mock_baz = mock
|
424
|
+
+ mock_baz.expects(:instance_variable_get).with(:@bat).returns 'bat'
|
425
|
+
+ mock_bar = mock
|
426
|
+
+ mock_bar.expects(:instance_variable_get).with(:@baz).returns mock_baz
|
427
|
+
+ @foo.expects(:instance_variable_get).with(:@bar).returns mock_bar
|
428
|
+
+
|
429
|
+
+ assert_equal 'bat', @foo.two_jagged_complex_delegates
|
430
|
+
+ end
|
431
|
+
+
|
432
|
+
+ def test_should_access_both_delegates_and_return_nil_if_both_delegates_have_nil_intermediate_values
|
433
|
+
+ mock_bar = mock
|
434
|
+
+ mock_bar.expects(:instance_variable_get).with(:@baz).returns nil
|
435
|
+
+ @foo.expects(:instance_variable_get).with(:@bar).returns mock_bar
|
436
|
+
+
|
437
|
+
+ mock_ding = mock
|
438
|
+
+ mock_ding.expects(:instance_variable_get).with(:@dit).returns nil
|
439
|
+
+ mock_pwop = mock
|
440
|
+
+ mock_pwop.expects(:instance_variable_get).with(:@ding).returns mock_ding
|
441
|
+
+ @foo.expects(:instance_variable_get).with(:@pwop).returns mock_pwop
|
442
|
+
+
|
443
|
+
+ assert_nil @foo.two_jagged_complex_delegates
|
444
|
+
+ end
|
445
|
+
+
|
446
|
+
+ end
|
447
|
+
+
|
448
|
+
+end
|