mack-facets 0.8.1 → 0.8.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/gems.rb +25 -0
- data/lib/gems/english-0.3.1/VERSION +1 -0
- data/lib/gems/english-0.3.1/lib/english/array.rb +48 -0
- data/lib/gems/english-0.3.1/lib/english/censor.rb +76 -0
- data/lib/gems/english-0.3.1/lib/english/double_metaphone.rb +353 -0
- data/lib/gems/english-0.3.1/lib/english/dresner.rb +47 -0
- data/lib/gems/english-0.3.1/lib/english/inflect.rb +299 -0
- data/lib/gems/english-0.3.1/lib/english/jumble.rb +37 -0
- data/lib/gems/english-0.3.1/lib/english/levenshtein.rb +78 -0
- data/lib/gems/english-0.3.1/lib/english/metaphone.rb +110 -0
- data/lib/gems/english-0.3.1/lib/english/numerals.rb +71 -0
- data/lib/gems/english-0.3.1/lib/english/patterns.rb +49 -0
- data/lib/gems/english-0.3.1/lib/english/porter_stemming.rb +188 -0
- data/lib/gems/english-0.3.1/lib/english/roman.rb +174 -0
- data/lib/gems/english-0.3.1/lib/english/similarity.rb +103 -0
- data/lib/gems/english-0.3.1/lib/english/soundex.rb +70 -0
- data/lib/gems/english-0.3.1/lib/english/string.rb +210 -0
- data/lib/gems/english-0.3.1/lib/english/style.rb +294 -0
- data/lib/gems/english-0.3.1/lib/english/style_orm.rb +143 -0
- data/lib/gems/english-0.3.1/lib/english/textfilter.rb +91 -0
- data/lib/gems/extlib-0.9.8/lib/extlib.rb +56 -0
- data/lib/gems/extlib-0.9.8/lib/extlib/assertions.rb +8 -0
- data/lib/gems/extlib-0.9.8/lib/extlib/blank.rb +59 -0
- data/lib/gems/extlib-0.9.8/lib/extlib/boolean.rb +11 -0
- data/lib/gems/extlib-0.9.8/lib/extlib/class.rb +175 -0
- data/lib/gems/extlib-0.9.8/lib/extlib/datetime.rb +9 -0
- data/lib/gems/extlib-0.9.8/lib/extlib/dictionary.rb +433 -0
- data/lib/gems/extlib-0.9.8/lib/extlib/hash.rb +419 -0
- data/lib/gems/extlib-0.9.8/lib/extlib/hook.rb +366 -0
- data/lib/gems/extlib-0.9.8/lib/extlib/inflection.rb +435 -0
- data/lib/gems/extlib-0.9.8/lib/extlib/lazy_array.rb +106 -0
- data/lib/gems/extlib-0.9.8/lib/extlib/logger.rb +202 -0
- data/lib/gems/extlib-0.9.8/lib/extlib/mash.rb +148 -0
- data/lib/gems/extlib-0.9.8/lib/extlib/module.rb +41 -0
- data/lib/gems/extlib-0.9.8/lib/extlib/nil.rb +5 -0
- data/lib/gems/extlib-0.9.8/lib/extlib/numeric.rb +5 -0
- data/lib/gems/extlib-0.9.8/lib/extlib/object.rb +175 -0
- data/lib/gems/extlib-0.9.8/lib/extlib/object_space.rb +13 -0
- data/lib/gems/extlib-0.9.8/lib/extlib/pathname.rb +5 -0
- data/lib/gems/extlib-0.9.8/lib/extlib/pooling.rb +239 -0
- data/lib/gems/extlib-0.9.8/lib/extlib/rubygems.rb +38 -0
- data/lib/gems/extlib-0.9.8/lib/extlib/simple_set.rb +39 -0
- data/lib/gems/extlib-0.9.8/lib/extlib/string.rb +132 -0
- data/lib/gems/extlib-0.9.8/lib/extlib/struct.rb +8 -0
- data/lib/gems/extlib-0.9.8/lib/extlib/symbol.rb +17 -0
- data/lib/gems/extlib-0.9.8/lib/extlib/tasks/release.rb +15 -0
- data/lib/gems/extlib-0.9.8/lib/extlib/time.rb +19 -0
- data/lib/gems/extlib-0.9.8/lib/extlib/version.rb +3 -0
- data/lib/gems/extlib-0.9.8/lib/extlib/virtual_file.rb +10 -0
- data/lib/gems/facets-2.4.5/VERSION +1 -0
- data/lib/gems/facets-2.4.5/lib/core/facets-live.rb +17 -0
- data/lib/gems/facets-2.4.5/lib/core/facets-load.rb +12 -0
- data/lib/gems/facets-2.4.5/lib/core/facets.rb +11 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/array.rb +6 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/array/combination.rb +59 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/array/conjoin.rb +58 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/array/delete.rb +61 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/array/index.rb +48 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/array/indexable.rb +73 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/array/merge.rb +21 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/array/not_empty.rb +13 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/array/only.rb +21 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/array/pad.rb +41 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/array/permutation.rb +30 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/array/product.rb +57 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/array/recursively.rb +30 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/array/rotate.rb +42 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/array/select.rb +16 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/array/splice.rb +30 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/array/stackable.rb +33 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/array/traverse.rb +22 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/binding.rb +6 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/binding/caller.rb +54 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/binding/defined.rb +13 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/binding/eval.rb +18 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/binding/local_variables.rb +15 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/binding/self.rb +12 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/bitmask.rb +104 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/blank.rb +60 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/boolean.rb +156 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/callstack.rb +52 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/cattr.rb +2 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/class.rb +6 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/class/cattr.rb +115 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/class/cattr_accessor.rb +1 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/class/cattr_reader.rb +1 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/class/cattr_writer.rb +1 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/class/descendents.rb +36 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/class/methodize.rb +14 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/class/pathize.rb +14 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/class/prepend.rb +50 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/class/subclasses.rb +2 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/class/to_proc.rb +42 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/comparable.rb +6 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/comparable/bound.rb +65 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/comparable/cmp.rb +38 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/comparable/comparable.rb +42 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/dir.rb +6 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/dir/ascend.rb +59 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/dir/descend.rb +1 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/dir/multiglob.rb +92 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/dir/parent.rb +13 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/dir/recurse.rb +29 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/enumerable.rb +6 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/enumerable/accumulate.rb +21 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/enumerable/cluster_by.rb +21 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/enumerable/collect.rb +54 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/enumerable/commonality.rb +33 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/enumerable/count.rb +26 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/enumerable/divide.rb +33 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/enumerable/duplicates.rb +38 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/enumerable/each_by.rb +33 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/enumerable/entropy.rb +37 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/enumerable/frequency.rb +18 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/enumerable/group_by.rb +27 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/enumerable/inject.rb +31 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/enumerable/map_send.rb +12 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/enumerable/mash.rb +32 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/enumerable/mode.rb +16 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/enumerable/modulate.rb +22 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/enumerable/none.rb +31 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/enumerable/occur.rb +38 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/enumerable/one.rb +38 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/enumerable/probability.rb +36 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/enumerable/split.rb +27 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/enumerable/sum.rb +16 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/enumerable/uniq_by.rb +18 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/exception.rb +6 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/exception/detail.rb +19 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/exception/suppress.rb +21 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/file.rb +6 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/file/append.rb +14 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/file/create.rb +21 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/file/null.rb +21 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/file/read.rb +41 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/file/rewrite.rb +88 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/file/rootname.rb +33 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/file/split_root.rb +10 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/file/write.rb +22 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/file/writelines.rb +24 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/filetest.rb +6 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/filetest/root.rb +17 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/float.rb +6 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/float/round.rb +2 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/functor.rb +77 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/hash.rb +6 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/hash/alias.rb +31 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/hash/argumentize.rb +22 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/hash/at.rb +8 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/hash/autonew.rb +42 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/hash/collate.rb +45 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/hash/delete.rb +47 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/hash/diff.rb +11 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/hash/except.rb +27 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/hash/insert.rb +19 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/hash/inverse.rb +27 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/hash/join.rb +14 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/hash/keys.rb +45 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/hash/mash.rb +18 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/hash/merge.rb +30 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/hash/op.rb +7 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/hash/op_add.rb +12 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/hash/op_and.rb +33 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/hash/op_mul.rb +18 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/hash/op_or.rb +12 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/hash/op_push.rb +17 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/hash/op_sub.rb +26 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/hash/recursive_merge.rb +33 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/hash/recursively.rb +29 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/hash/rekey.rb +59 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/hash/select.rb +14 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/hash/slice.rb +33 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/hash/swap.rb +17 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/hash/to_h.rb +1 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/hash/to_proc.rb +41 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/hash/to_struct.rb +17 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/hash/traverse.rb +41 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/hash/update.rb +81 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/hash/weave.rb +81 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/hash/zipnew.rb +2 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/indexable.rb +251 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/integer.rb +6 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/integer/even.rb +1 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/integer/factorial.rb +30 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/integer/multiple.rb +15 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/integer/odd.rb +35 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/integer/of.rb +18 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/integer/ordinal.rb +24 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/kernel.rb +6 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/kernel/__callee__.rb +1 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/kernel/__class__.rb +9 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/kernel/__dir__.rb +12 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/kernel/__get__.rb +10 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/kernel/__method__.rb +36 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/kernel/__set__.rb +1 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/kernel/as.rb +100 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/kernel/ask.rb +27 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/kernel/attr_singleton.rb +62 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/kernel/complete.rb +18 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/kernel/constant.rb +24 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/kernel/d.rb +26 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/kernel/deep_copy.rb +13 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/kernel/demo.rb +23 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/kernel/ergo.rb +42 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/kernel/here.rb +12 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/kernel/in.rb +13 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/kernel/instance.rb +19 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/kernel/instance_assign.rb +41 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/kernel/instance_class.rb +24 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/kernel/instance_exec.rb +40 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/kernel/instance_send.rb +7 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/kernel/instance_variables.rb +99 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/kernel/maybe.rb +18 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/kernel/not_nil.rb +17 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/kernel/object_class.rb +10 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/kernel/object_hexid.rb +12 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/kernel/object_send.rb +32 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/kernel/p.rb +24 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/kernel/populate.rb +73 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/kernel/qua_class.rb +19 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/kernel/require_all.rb +21 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/kernel/require_local.rb +24 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/kernel/resc.rb +16 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/kernel/respond.rb +23 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/kernel/returning.rb +23 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/kernel/silence.rb +75 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/kernel/singleton_class.rb +19 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/kernel/tap.rb +32 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/kernel/try.rb +23 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/kernel/val.rb +19 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/kernel/with.rb +20 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/lazy.rb +238 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/matchdata.rb +6 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/matchdata/match.rb +15 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/matchdata/matchset.rb +44 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/metaid.rb +94 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/module.rb +6 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/module/abstract.rb +21 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/module/alias_accessor.rb +45 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/module/alias_method_chain.rb +50 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/module/alias_module_function.rb +30 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/module/ancestor.rb +16 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/module/basename.rb +31 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/module/can.rb +14 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/module/class.rb +12 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/module/conflict.rb +63 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/module/include_function_module.rb +25 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/module/instance_methods.rb +40 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/module/integrate.rb +2 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/module/is.rb +57 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/module/methodize.rb +14 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/module/modspace.rb +22 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/module/module_load.rb +56 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/module/nesting.rb +18 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/module/op.rb +95 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/module/pathize.rb +22 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/module/prepend.rb +26 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/module/redefine_method.rb +35 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/module/redirect_method.rb +45 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/module/rename_method.rb +20 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/module/revise.rb +62 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/module/spacename.rb +25 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/module/wrap_method.rb +28 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/nilclass.rb +6 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/nilclass/ergo.rb +1 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/nilclass/to_f.rb +17 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/numeric.rb +6 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/numeric/approx.rb +15 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/numeric/distance.rb +14 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/numeric/round.rb +72 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/proc.rb +6 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/proc/bind.rb +22 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/proc/compose.rb +42 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/proc/curry.rb +31 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/proc/to_method.rb +33 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/proc/update.rb +9 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/range.rb +6 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/range/combine.rb +47 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/range/overlap.rb +13 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/range/to_r.rb +26 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/range/umbrella.rb +1 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/range/within.rb +66 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/regexp.rb +6 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/regexp/arity.rb +17 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/regexp/to_re.rb +28 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/stackable.rb +86 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/string.rb +6 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/string/align.rb +106 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/string/bracket.rb +105 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/string/bytes.rb +15 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/string/camelcase.rb +26 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/string/capitalized.rb +46 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/string/chars.rb +16 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/string/chomp.rb +33 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/string/cleave.rb +36 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/string/divide.rb +21 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/string/each_char.rb +29 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/string/each_word.rb +13 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/string/end_with.rb +1 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/string/fold.rb +39 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/string/interpolate.rb +20 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/string/line_wrap.rb +21 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/string/lines.rb +16 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/string/methodize.rb +17 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/string/modulize.rb +21 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/string/mscan.rb +19 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/string/natcmp.rb +88 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/string/nchar.rb +28 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/string/op_sub.rb +14 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/string/pathize.rb +16 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/string/range.rb +77 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/string/rewrite.rb +28 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/string/shatter.rb +22 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/string/snakecase.rb +21 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/string/splice.rb +37 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/string/start_with.rb +32 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/string/subtract.rb +4 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/string/tab.rb +103 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/string/titlecase.rb +15 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/string/to_re.rb +26 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/string/variablize.rb +13 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/string/word_wrap.rb +34 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/string/words.rb +12 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/string/xor.rb +22 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/symbol.rb +6 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/symbol/chomp.rb +24 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/symbol/generate.rb +24 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/symbol/not.rb +29 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/symbol/plain.rb +17 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/symbol/query.rb +1 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/symbol/re_s.rb +18 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/symbol/setter.rb +1 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/symbol/succ.rb +19 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/symbol/to_proc.rb +38 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/symbol/variablize.rb +12 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/time.rb +6 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/time/advance.rb +17 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/time/ago.rb +1 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/time/change.rb +41 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/time/elapse.rb +16 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/time/hence.rb +94 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/time/round.rb +17 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/time/set.rb +21 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/time/stamp.rb +44 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/time/to_time.rb +21 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/time/trunc.rb +15 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/to_hash.rb +87 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/unboundmethod.rb +6 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/unboundmethod/arguments.rb +44 -0
- data/lib/gems/facets-2.4.5/lib/core/facets/unboundmethod/name.rb +25 -0
- data/lib/gems/facets-2.4.5/lib/lore/facets/basicobject.rb +14 -0
- data/lib/gems/facets-2.4.5/lib/lore/facets/cgi.rb +50 -0
- data/lib/gems/facets-2.4.5/lib/lore/facets/continuation.rb +57 -0
- data/lib/gems/facets-2.4.5/lib/lore/facets/date.rb +396 -0
- data/lib/gems/facets-2.4.5/lib/lore/facets/fileutils.rb +27 -0
- data/lib/gems/facets-2.4.5/lib/lore/facets/fileutils/head.rb +1 -0
- data/lib/gems/facets-2.4.5/lib/lore/facets/fileutils/safe_ln.rb +28 -0
- data/lib/gems/facets-2.4.5/lib/lore/facets/fileutils/slice.rb +141 -0
- data/lib/gems/facets-2.4.5/lib/lore/facets/fileutils/tail.rb +1 -0
- data/lib/gems/facets-2.4.5/lib/lore/facets/fileutils/wc.rb +114 -0
- data/lib/gems/facets-2.4.5/lib/lore/facets/fileutils/whereis.rb +64 -0
- data/lib/gems/facets-2.4.5/lib/lore/facets/fileutils/which.rb +101 -0
- data/lib/gems/facets-2.4.5/lib/lore/facets/getoptlong.rb +71 -0
- data/lib/gems/facets-2.4.5/lib/lore/facets/logger.rb +291 -0
- data/lib/gems/facets-2.4.5/lib/lore/facets/ostruct.rb +238 -0
- data/lib/gems/facets-2.4.5/lib/lore/facets/pathname.rb +172 -0
- data/lib/gems/facets-2.4.5/lib/lore/facets/rbconfig.rb +45 -0
- data/lib/gems/facets-2.4.5/lib/lore/facets/set.rb +27 -0
- data/lib/gems/facets-2.4.5/lib/lore/facets/shellwords.rb +89 -0
- data/lib/gems/facets-2.4.5/lib/lore/facets/uri.rb +249 -0
- data/lib/gems/facets-2.4.5/lib/lore/facets/yaml.rb +75 -0
- data/lib/gems/facets-2.4.5/lib/lore/facets/zlib.rb +38 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/1stclassmethod.rb +140 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/advisable.rb +162 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/annotations.rb +302 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/ansicode.rb +315 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/arguments.rb +365 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/argvector.rb +353 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/association.rb +194 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/attr.rb +208 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/autoarray.rb +62 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/autoreload.rb +150 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/basex.rb +37 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/bbcode.rb +397 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/bicrypt.rb +265 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/binding/opvars.rb +24 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/binreadable.rb +221 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/blankslate.rb +66 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/buildable.rb +344 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/bytes.rb +175 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/cachedecorator.rb +117 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/capsule.rb +258 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/chain.rb +58 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/class_extension.rb +114 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/classmethods.rb +199 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/cloneable.rb +76 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/command.rb +439 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/consoleutils.rb +113 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/coroutine.rb +159 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/crypt.rb +166 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/cssfilter.rb +254 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/daemonize.rb +44 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/dependency.rb +151 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/dictionary.rb +478 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/dictionarymatcher.rb +136 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/downloader.rb +281 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/duplicable.rb +43 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/duration.rb +540 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/elementor.rb +133 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/elementwise.rb +61 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/enumerablepass.rb +217 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/equatable.rb +120 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/eventhook.rb +132 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/expirable.rb +82 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/fileable.rb +162 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/filelist.rb +497 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/fileshell.rb +202 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/hash/stringify_keys.rb +1 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/hash/symbolize_keys.rb +94 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/heap.rb +22 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/htmlfilter.rb +595 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/infinity.rb +193 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/inheritor.rb +130 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/ini.rb +264 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/instantiable.rb +47 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/instantise.rb +1 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/instantize.rb +95 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/interval.rb +282 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/ioredirect.rb +130 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/iteration.rb +65 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/kernel/meta.rb +32 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/linkedlist.rb +222 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/lrucache.rb +157 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/main.rb +70 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/memoize.rb +116 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/methodspace.rb +141 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/minitar.rb +1063 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/multipliers.rb +109 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/multiton.rb +386 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/nackclass.rb +41 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/net/smtp_tls.rb +131 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/nilstatus.rb +47 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/nullclass.rb +74 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/opencascade.rb +94 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/opencollection.rb +43 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/openhash.rb +39 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/openobject.rb +267 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/opesc.rb +60 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/orderedhash.rb +37 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/overload.rb +94 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/paramix.rb +202 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/partial.rb +37 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/pathlist.rb +112 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/platform.rb +192 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/pool.rb +91 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/pqueue.rb +449 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/progressbar.rb +253 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/prototype.rb +88 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/random.rb +451 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/rbsystem.rb +222 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/recorder.rb +109 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/reference.rb +99 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/reflection.rb +145 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/registerable.rb +35 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/rwdelegator.rb +74 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/semaphore.rb +92 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/settings.rb +248 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/snapshot.rb +209 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/string/mask.rb +278 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/string/words.rb +173 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/succ.rb +44 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/syncarray.rb +114 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/synchash.rb +157 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/tagiter.rb +366 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/thread.rb +51 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/timer.rb +274 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/times.rb +431 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/tracepoint.rb +209 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/tuple.rb +325 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/typecast.rb +261 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/uninheritable.rb +50 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/uploadutils.rb +464 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/version.rb +136 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/xmlhash.rb +112 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/xoxo.rb +259 -0
- data/lib/gems/facets-2.4.5/lib/more/facets/ziputils.rb +349 -0
- data/lib/mack-facets.rb +4 -2
- data/lib/mack-facets/english_extensions/inflect.rb +50 -50
- data/lib/mack-facets/extensions/string.rb +10 -1
- data/lib/mack-facets/utils/inflections.rb +50 -47
- data/lib/mack-facets/utils/inflector.rb +19 -19
- metadata +547 -36
@@ -0,0 +1,133 @@
|
|
1
|
+
# = Elementor
|
2
|
+
#
|
3
|
+
# Provides elementwise functionality.
|
4
|
+
#
|
5
|
+
# == Authors
|
6
|
+
#
|
7
|
+
# * Thomas Sawyer
|
8
|
+
# * George Moschovitis
|
9
|
+
# * Martin DeMello
|
10
|
+
#
|
11
|
+
# == Notes
|
12
|
+
#
|
13
|
+
# * This could have been impemented with a generic Functor, rather than
|
14
|
+
# the specialized Elementor, but for the fact Procs can not yet
|
15
|
+
# handle blocks.
|
16
|
+
# * There used to be a "Cascading Elementor", but that proved idiotic
|
17
|
+
# in the face of adding an instance_eval block to #every.
|
18
|
+
# * Any ideas for a better name for #accumulate? --gmosx
|
19
|
+
# * The use of every! and it's relation to Enumerator still seems a bit
|
20
|
+
# off beat. Should #every always use #map? And another method #each?
|
21
|
+
#
|
22
|
+
# == Copying
|
23
|
+
#
|
24
|
+
# Copyright (c) 2006 Thomas Sawyer
|
25
|
+
#
|
26
|
+
# Ruby License
|
27
|
+
#
|
28
|
+
# This module is free software. You may use, modify, and/or redistribute this
|
29
|
+
# software under the same terms as Ruby.
|
30
|
+
#
|
31
|
+
# This program is distributed in the hope that it will be useful, but WITHOUT
|
32
|
+
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
33
|
+
# FOR A PARTICULAR PURPOSE.
|
34
|
+
|
35
|
+
require 'enumerator'
|
36
|
+
require 'facets/functor'
|
37
|
+
|
38
|
+
module Enumerable
|
39
|
+
|
40
|
+
# Create Elementor.
|
41
|
+
|
42
|
+
def to_elem(meth=nil)
|
43
|
+
Elementor.new(self, meth || :map)
|
44
|
+
end
|
45
|
+
|
46
|
+
def per
|
47
|
+
@__per__ ||= Functor.new do |op|
|
48
|
+
Elementor.new(self, op)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
# Returns an elemental object. This allows
|
53
|
+
# you to map a method on to every element.
|
54
|
+
#
|
55
|
+
# r = [1,2,3].every + 3 #=> [4,5,6]
|
56
|
+
|
57
|
+
def every
|
58
|
+
@_every ||= to_elem
|
59
|
+
end
|
60
|
+
|
61
|
+
# In place version of #every.
|
62
|
+
|
63
|
+
def every!
|
64
|
+
raise NoMethodError unless respond_to?(:map!)
|
65
|
+
@_every_inplace ||= to_elem(:map!)
|
66
|
+
end
|
67
|
+
|
68
|
+
#def every
|
69
|
+
# @_every ||= Functor.new do |op,*args|
|
70
|
+
# map{ |a| a.send(op,*args) }
|
71
|
+
# end
|
72
|
+
#end
|
73
|
+
|
74
|
+
#def every!
|
75
|
+
# raise NoMethodError unless respond_to?(:map!)
|
76
|
+
# @_every_inplace ||= Functor.new do |op,*args|
|
77
|
+
# map!{ |a| a.send(op,*args) }
|
78
|
+
# end
|
79
|
+
#end
|
80
|
+
|
81
|
+
# Possible name change for every.
|
82
|
+
#
|
83
|
+
# r = [1,2,3].elements + 3 #=> [4,5,6]
|
84
|
+
#
|
85
|
+
# Certainly reads better.
|
86
|
+
|
87
|
+
alias_method :elements, :every
|
88
|
+
alias_method :elements!, :every!
|
89
|
+
|
90
|
+
end
|
91
|
+
|
92
|
+
|
93
|
+
# = Elementor
|
94
|
+
#
|
95
|
+
# Elementor is a type of Functor. Operations
|
96
|
+
# applied to it are routed to each element.
|
97
|
+
|
98
|
+
class Enumerable::Elementor
|
99
|
+
private(*instance_methods.select{|x| x !~ /^__/ })
|
100
|
+
|
101
|
+
def initialize(elem_object, elem_method=nil)
|
102
|
+
@elem_object = elem_object
|
103
|
+
@elem_method = elem_method || :map
|
104
|
+
end
|
105
|
+
|
106
|
+
def instance_delegate
|
107
|
+
@elem_object
|
108
|
+
end
|
109
|
+
|
110
|
+
def instance_operator
|
111
|
+
@elem_method
|
112
|
+
end
|
113
|
+
|
114
|
+
def method_missing(sym,*args,&blk)
|
115
|
+
@elem_object.__send__(@elem_method){ |x| x.__send__(sym,*args,&blk) }
|
116
|
+
end
|
117
|
+
end
|
118
|
+
|
119
|
+
|
120
|
+
class Enumerable::Enumerator
|
121
|
+
|
122
|
+
# Create Elementor.
|
123
|
+
|
124
|
+
def to_elem(meth=nil)
|
125
|
+
Elementor.new(self, meth || :each)
|
126
|
+
end
|
127
|
+
|
128
|
+
# Enumerator doesn't support inplace element operations, per se.
|
129
|
+
|
130
|
+
undef_method :every!
|
131
|
+
undef_method :elements!
|
132
|
+
end
|
133
|
+
|
@@ -0,0 +1,61 @@
|
|
1
|
+
require 'facets/functor'
|
2
|
+
|
3
|
+
module Enumerable
|
4
|
+
|
5
|
+
# Returns an elementwise Functor designed to make R-like
|
6
|
+
# elementwise operations possible.
|
7
|
+
#
|
8
|
+
# [1,2].elementwise + 3 #=> [4,5]
|
9
|
+
# [1,2].elementwise + [4,5] #=> [5,7]
|
10
|
+
# [1,2].elementwise + [[4,5],3] #=> [[5,7],[4,5]
|
11
|
+
#
|
12
|
+
#--
|
13
|
+
# Special thanks to Martin DeMello for helping to develop this.
|
14
|
+
#++
|
15
|
+
|
16
|
+
def elementwise(count=1)
|
17
|
+
@_elementwise_functor ||= []
|
18
|
+
@_elementwise_functor[count] ||= Functor.new do |op,*args|
|
19
|
+
if args.empty?
|
20
|
+
r = self
|
21
|
+
count.times do
|
22
|
+
r = r.collect{ |a| a.send(op) }
|
23
|
+
end
|
24
|
+
r
|
25
|
+
else
|
26
|
+
r = args.collect do |arg|
|
27
|
+
if Array === arg #arg.kind_of?(Enumerable)
|
28
|
+
x = self
|
29
|
+
count.times do
|
30
|
+
ln = (arg.length > length ? length : arg.length )
|
31
|
+
x = x.slice(0...ln).zip(arg[0...ln]).collect{ |a,b| a.send(op,b) }
|
32
|
+
#slice(0...ln).zip(arg[0...1n]).collect{ |a,b| b ? a.send(op,b) : nil }
|
33
|
+
end
|
34
|
+
x
|
35
|
+
else
|
36
|
+
x = self
|
37
|
+
count.times do
|
38
|
+
x = x.collect{ |a| a.send(op,arg) }
|
39
|
+
end
|
40
|
+
x
|
41
|
+
end
|
42
|
+
end
|
43
|
+
r.flatten! if args.length == 1
|
44
|
+
r
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
# Concise alias for #elementwise.
|
50
|
+
#
|
51
|
+
# a = [1,2]
|
52
|
+
# a.ewise + 3 #=> [4,5]
|
53
|
+
# a.ewise + [4,5] #=> [5,7]
|
54
|
+
# a.ewise + [[4,5],3] #=> [[5,7],[4,5]
|
55
|
+
#
|
56
|
+
# Note this used to be #ew as weel as the '%' operator.
|
57
|
+
# Both of whihc are deprecated.
|
58
|
+
|
59
|
+
alias_method :ewise, :elementwise
|
60
|
+
|
61
|
+
end
|
@@ -0,0 +1,217 @@
|
|
1
|
+
# = EnumerablePass
|
2
|
+
#
|
3
|
+
# This is a simple reimplementation of the core Enumerable module
|
4
|
+
# to allow the methods to take and pass-on arbitrary arguments to the
|
5
|
+
# underlying #each call. This library uses Enumerator and scans
|
6
|
+
# Enumerable so it can alwasy stay in sync.
|
7
|
+
#
|
8
|
+
# NOTE Any Enumerable method with a negative arity cannot do pass arguments
|
9
|
+
# due to ambiguity in the argument count. So the methods #inject and #zip
|
10
|
+
# do NOT work this way, but simply work as they do in Enumerable.
|
11
|
+
# The method #find (and #detect) though has been made to work by removing
|
12
|
+
# its rarely used optional parameter and providing instead an optional
|
13
|
+
# keyword parameter (:ifnone => ...). Please keep these difference in mind.
|
14
|
+
#
|
15
|
+
# class T
|
16
|
+
# include EnumerablePass
|
17
|
+
# def initialize(arr)
|
18
|
+
# @arr = arr
|
19
|
+
# end
|
20
|
+
# def each(n)
|
21
|
+
# arr.each{ |e| yield(e+n) }
|
22
|
+
# end
|
23
|
+
# end
|
24
|
+
#
|
25
|
+
# t = T.new([1,2,3])
|
26
|
+
# t.collect(4)
|
27
|
+
# #=> [5,6,7]
|
28
|
+
#
|
29
|
+
# == Authors
|
30
|
+
#
|
31
|
+
# * Thomas Sawyer
|
32
|
+
#
|
33
|
+
# == Copying
|
34
|
+
#
|
35
|
+
# Copyright (c) 2004 Thomas Sawyer
|
36
|
+
#
|
37
|
+
# Ruby License
|
38
|
+
#
|
39
|
+
# This module is free software. You may use, modify, and/or redistribute this
|
40
|
+
# software under the same terms as Ruby.
|
41
|
+
#
|
42
|
+
# This program is distributed in the hope that it will be useful, but WITHOUT
|
43
|
+
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
44
|
+
# FOR A PARTICULAR PURPOSE.
|
45
|
+
|
46
|
+
require 'enumerator'
|
47
|
+
|
48
|
+
# = EnumerablePass
|
49
|
+
#
|
50
|
+
# This is a simple reimplementation of the core Enumerable module
|
51
|
+
# to allow the methods to take and pass-on arbitrary arguments to the
|
52
|
+
# underlying #each call. This library uses Enumerator and scans
|
53
|
+
# Enumerable so it can alwasy stay in sync.
|
54
|
+
#
|
55
|
+
# NOTE Any Enumerable method with a negative arity cannot do pass arguments
|
56
|
+
# due to ambiguity in the argument count. So the methods #inject and #zip
|
57
|
+
# do NOT work this way, but simply work as they do in Enumerable.
|
58
|
+
# The method #find (and #detect) though has been made to work by removing
|
59
|
+
# its rarely used optional parameter and providing instead an optional
|
60
|
+
# keyword parameter (:ifnone => ...). Please keep these difference in mind.
|
61
|
+
#
|
62
|
+
# class T
|
63
|
+
# include EnumerablePass
|
64
|
+
# def initialize(arr)
|
65
|
+
# @arr = arr
|
66
|
+
# end
|
67
|
+
# def each(n)
|
68
|
+
# arr.each{ |e| yield(e+n) }
|
69
|
+
# end
|
70
|
+
# end
|
71
|
+
#
|
72
|
+
# t = T.new([1,2,3])
|
73
|
+
# t.collect(4)
|
74
|
+
# #=> [5,6,7]
|
75
|
+
#
|
76
|
+
module EnumerablePass
|
77
|
+
|
78
|
+
def self.wrap_enumerable_method( methodname )
|
79
|
+
|
80
|
+
m = methodname
|
81
|
+
meth = Enumerable.instance_method(m)
|
82
|
+
arity = meth.arity
|
83
|
+
|
84
|
+
case arity <=> 0
|
85
|
+
when 0
|
86
|
+
class_eval %{
|
87
|
+
def #{m}( *args, &yld )
|
88
|
+
enum_for(:each, *args).#{m}( &yld )
|
89
|
+
end
|
90
|
+
}
|
91
|
+
when 1
|
92
|
+
class_eval %{
|
93
|
+
def #{m}( *args, &yld )
|
94
|
+
args, each_args = args[0...#{arity}], args[#{arity}..-1]
|
95
|
+
enum_for(:each, *each_args).#{m}( *args, &yld )
|
96
|
+
end
|
97
|
+
}
|
98
|
+
else
|
99
|
+
class_eval %{
|
100
|
+
def #{m}( *args, &yld )
|
101
|
+
enum_for(:each).#{m}( *args, &yld )
|
102
|
+
end
|
103
|
+
}
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
Enumerable.instance_methods(false).each do |m|
|
108
|
+
wrap_enumerable_method( m )
|
109
|
+
end
|
110
|
+
|
111
|
+
# Make exception for #find (a negative arity method) to accept
|
112
|
+
# keyword argument.
|
113
|
+
#
|
114
|
+
# ObjectSpace.find(Class, :ifnone=>lambda{1}) { |e| ... }
|
115
|
+
# ObjectSpace.find(Class, :ifnone=>lambda{1}) { |e| ... }
|
116
|
+
#
|
117
|
+
def find(*args, &yld) # future use **keys ?
|
118
|
+
if Hash === args.last and args.last.key?(:ifnone)
|
119
|
+
ifnone = args.last.delete(:ifnone)
|
120
|
+
args.pop if args.last.empty?
|
121
|
+
enum_for(:each, *args).find( ifnone, &yld )
|
122
|
+
else
|
123
|
+
enum_for(:each, *args).find( &yld )
|
124
|
+
end
|
125
|
+
end
|
126
|
+
alias_method :detect, :find
|
127
|
+
|
128
|
+
end
|
129
|
+
|
130
|
+
|
131
|
+
=begin OLD CODE
|
132
|
+
module EnumerableArgs
|
133
|
+
|
134
|
+
def collect(*args) # :yield:
|
135
|
+
a = []
|
136
|
+
each(*args){ |n| a << yield(n) }
|
137
|
+
a
|
138
|
+
end
|
139
|
+
alias_method( :map, :collect )
|
140
|
+
|
141
|
+
def detect(*args) # :yield:
|
142
|
+
each(*args){ |n| return n if yield(n) }
|
143
|
+
nil
|
144
|
+
end
|
145
|
+
alias_method( :find, :detect )
|
146
|
+
|
147
|
+
def each_with_index(*args)
|
148
|
+
i=0
|
149
|
+
each(*args){ |*n| n << i; yield(*n); i+=1 }
|
150
|
+
self
|
151
|
+
end
|
152
|
+
|
153
|
+
def to_a(*args)
|
154
|
+
a = []
|
155
|
+
each(*args){ |n| a << n }
|
156
|
+
a
|
157
|
+
end
|
158
|
+
alias_method( :entries, :to_a )
|
159
|
+
|
160
|
+
# An additional method not part of standard Enumerable.
|
161
|
+
# The regular version of this method can be found in Facets,
|
162
|
+
# but it is a bit more advanced then this one.
|
163
|
+
# At some point they need to be put into sync.
|
164
|
+
def each_slice(*args, &yld)
|
165
|
+
a = []; s = []
|
166
|
+
ar = yld.arity.abs
|
167
|
+
each(*args){ |n|
|
168
|
+
s << n
|
169
|
+
if s.length >= ar
|
170
|
+
yld.call(*s)
|
171
|
+
s = []
|
172
|
+
end
|
173
|
+
}
|
174
|
+
a
|
175
|
+
end
|
176
|
+
alias_method( :each_by, :each_slice )
|
177
|
+
|
178
|
+
def select(*args) # :yield:
|
179
|
+
a = []
|
180
|
+
each(*args){ |n| a << n if yield(n) }
|
181
|
+
a
|
182
|
+
end
|
183
|
+
alias_method( :find_all, :select )
|
184
|
+
|
185
|
+
def grep(pattern, *args)
|
186
|
+
a = []
|
187
|
+
each(*args){ |n| a << (block_given? ? yield(n) : n) if pattern === n }
|
188
|
+
a
|
189
|
+
end
|
190
|
+
|
191
|
+
def include?(anObj, *args)
|
192
|
+
each(*args){ |n| return true if anObj == n }
|
193
|
+
false
|
194
|
+
end
|
195
|
+
alias_method( :member?, :include? )
|
196
|
+
|
197
|
+
def max(*args)
|
198
|
+
to_a(*args).max
|
199
|
+
end
|
200
|
+
|
201
|
+
def min(*args)
|
202
|
+
to_a(*args).min
|
203
|
+
end
|
204
|
+
|
205
|
+
def reject(*args)
|
206
|
+
a = []
|
207
|
+
each(*args){ |n| a << n if ! yield(n) }
|
208
|
+
a
|
209
|
+
end
|
210
|
+
|
211
|
+
def sort(*args)
|
212
|
+
# TODO
|
213
|
+
end
|
214
|
+
|
215
|
+
end
|
216
|
+
=end
|
217
|
+
|
@@ -0,0 +1,120 @@
|
|
1
|
+
# = Equatable
|
2
|
+
#
|
3
|
+
# This mixin provides methods of equality based
|
4
|
+
# on a single #identity method which must return
|
5
|
+
# a list of accessors used as the identity keys.
|
6
|
+
#
|
7
|
+
# It also provides a "shortcut" for creating the
|
8
|
+
# #identity method based on given accessors and returns
|
9
|
+
# the Equatable module for inclusion.
|
10
|
+
#
|
11
|
+
# include Equatable(:a, :b)
|
12
|
+
#
|
13
|
+
# is equivalent to including a module containing:
|
14
|
+
#
|
15
|
+
# def ==(other)
|
16
|
+
# self.a == other.a && self.b == other.b
|
17
|
+
# end
|
18
|
+
#
|
19
|
+
# def eql?(other)
|
20
|
+
# self.a.eql?(other.a) && self.b.eql?(other.b)
|
21
|
+
# end
|
22
|
+
#
|
23
|
+
# def hash()
|
24
|
+
# self.a.hash ^ self.b.hash
|
25
|
+
# end
|
26
|
+
#
|
27
|
+
# == Authors
|
28
|
+
#
|
29
|
+
# * Thomas Sawyer
|
30
|
+
#
|
31
|
+
# == Copying
|
32
|
+
#
|
33
|
+
# Copyright (c) 2004 Thomas Sawyer
|
34
|
+
#
|
35
|
+
# Ruby License
|
36
|
+
#
|
37
|
+
# This module is free software. You may use, modify, and/or redistribute this
|
38
|
+
# software under the same terms as Ruby.
|
39
|
+
#
|
40
|
+
# This program is distributed in the hope that it will be useful, but WITHOUT
|
41
|
+
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
42
|
+
# FOR A PARTICULAR PURPOSE.
|
43
|
+
|
44
|
+
|
45
|
+
# = Equatable
|
46
|
+
#
|
47
|
+
# This mixin provides methods of equality based
|
48
|
+
# on a single #identity method which must return
|
49
|
+
# a list of accessors used as the identity keys.
|
50
|
+
#
|
51
|
+
# It also provides a "shortcut" for creating the
|
52
|
+
# #identity method based on given accessors and returns
|
53
|
+
# the Equatable module for inclusion.
|
54
|
+
#
|
55
|
+
# include Equatable(:a, :b)
|
56
|
+
#
|
57
|
+
# is equivalent to including a module containing:
|
58
|
+
#
|
59
|
+
# def ==(other)
|
60
|
+
# self.a == other.a && self.b == other.b
|
61
|
+
# end
|
62
|
+
#
|
63
|
+
# def eql?(other)
|
64
|
+
# self.a.eql?(other.a) && self.b.eql?(other.b)
|
65
|
+
# end
|
66
|
+
#
|
67
|
+
# def hash()
|
68
|
+
# self.a.hash ^ self.b.hash
|
69
|
+
# end
|
70
|
+
#
|
71
|
+
module Equatable
|
72
|
+
|
73
|
+
def self.identify(base, *accessors)
|
74
|
+
base.send(:define_method, :identity){ accessors }
|
75
|
+
self
|
76
|
+
end
|
77
|
+
|
78
|
+
def ==(o)
|
79
|
+
identity.all?{ |a| send(a) == o.send(a) }
|
80
|
+
end
|
81
|
+
|
82
|
+
def eql?(o)
|
83
|
+
identity.all?{ |a| send(a).eql?(o.send(a)) }
|
84
|
+
end
|
85
|
+
|
86
|
+
def hash
|
87
|
+
identity.inject(0){ |memo, a| memo ^ send(a).hash }
|
88
|
+
end
|
89
|
+
|
90
|
+
end
|
91
|
+
|
92
|
+
class Module
|
93
|
+
|
94
|
+
# This function provided a "shortcut" for creating the
|
95
|
+
# #identity method based on given accessors and returns
|
96
|
+
# the Equatable module for inclusion.
|
97
|
+
#
|
98
|
+
# include Equatable(:a, :b)
|
99
|
+
#
|
100
|
+
# is equivalent to including a module containing:
|
101
|
+
#
|
102
|
+
# def ==(other)
|
103
|
+
# self.a == other.a && self.b == other.b
|
104
|
+
# end
|
105
|
+
#
|
106
|
+
# def eql?(other)
|
107
|
+
# self.a.eql?(other.a) && self.b.eql?(other.b)
|
108
|
+
# end
|
109
|
+
#
|
110
|
+
# def hash()
|
111
|
+
# self.a.hash ^ self.b.hash
|
112
|
+
# end
|
113
|
+
#
|
114
|
+
|
115
|
+
def Equatable(*accessors)
|
116
|
+
Equatable.identify(self, *accessors)
|
117
|
+
end
|
118
|
+
|
119
|
+
end
|
120
|
+
|