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,159 @@
|
|
1
|
+
# = Coroutine
|
2
|
+
#
|
3
|
+
# Coroutines are program components like subroutines. Coroutines are more
|
4
|
+
# generic and flexible than subroutines, but are less widely used in
|
5
|
+
# practice. Coroutines were first introduced natively in Simula.
|
6
|
+
# Coroutines are well suited for implementing more familiar program
|
7
|
+
# components such as cooperative tasks, iterators, infinite lists, and pipes.
|
8
|
+
#
|
9
|
+
# This mixin solely depends on method read(n), which must be
|
10
|
+
# defined in the class/module where you mix in this module.
|
11
|
+
#
|
12
|
+
# == Usage
|
13
|
+
#
|
14
|
+
# count = (ARGV.shift || 1000).to_i
|
15
|
+
# input = (1..count).map { (rand * 10000).round.to_f / 100}
|
16
|
+
#
|
17
|
+
# Producer = Coroutine.new do |me|
|
18
|
+
# loop do
|
19
|
+
# 1.upto(6) do
|
20
|
+
# me[:last_input] = input.shift
|
21
|
+
# me.resume(Printer)
|
22
|
+
# end
|
23
|
+
# input.shift # discard every seventh input number
|
24
|
+
# end
|
25
|
+
# end
|
26
|
+
# Printer = Coroutine.new do |me|
|
27
|
+
# loop do
|
28
|
+
# 1.upto(8) do
|
29
|
+
# me.resume(Producer)
|
30
|
+
# if Producer[:last_input]
|
31
|
+
# print Producer[:last_input], "\t"
|
32
|
+
# Producer[:last_input] = nil
|
33
|
+
# end
|
34
|
+
# me.resume(Controller)
|
35
|
+
# end
|
36
|
+
# puts
|
37
|
+
# end
|
38
|
+
# end
|
39
|
+
#
|
40
|
+
# Controller = Coroutine.new do |me|
|
41
|
+
# until input.empty? do
|
42
|
+
# me.resume(Printer)
|
43
|
+
# end
|
44
|
+
# end
|
45
|
+
#
|
46
|
+
# Controller.run
|
47
|
+
#
|
48
|
+
# == Authors
|
49
|
+
#
|
50
|
+
# * Florian Frank
|
51
|
+
#
|
52
|
+
# == Copying
|
53
|
+
#
|
54
|
+
# Copyright (c) 2005 Florian Frank
|
55
|
+
#
|
56
|
+
# Ruby License
|
57
|
+
#
|
58
|
+
# This module is free software. You may use, modify, and/or redistribute this
|
59
|
+
# software under the same terms as Ruby.
|
60
|
+
#
|
61
|
+
# This program is distributed in the hope that it will be useful, but WITHOUT
|
62
|
+
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
63
|
+
# FOR A PARTICULAR PURPOSE.
|
64
|
+
|
65
|
+
|
66
|
+
# = Coroutine
|
67
|
+
#
|
68
|
+
# Coroutines are program components like subroutines. Coroutines are more
|
69
|
+
# generic and flexible than subroutines, but are less widely used in
|
70
|
+
# practice. Coroutines were first introduced natively in Simula.
|
71
|
+
# Coroutines are well suited for implementing more familiar program
|
72
|
+
# components such as cooperative tasks, iterators, infinite lists, and pipes.
|
73
|
+
#
|
74
|
+
# This mixin solely depends on method read(n), which must be
|
75
|
+
# defined in the class/module where you mix in this module.
|
76
|
+
#
|
77
|
+
# == Usage
|
78
|
+
#
|
79
|
+
# count = (ARGV.shift || 1000).to_i
|
80
|
+
# input = (1..count).map { (rand * 10000).round.to_f / 100}
|
81
|
+
#
|
82
|
+
# Producer = Coroutine.new do |me|
|
83
|
+
# loop do
|
84
|
+
# 1.upto(6) do
|
85
|
+
# me[:last_input] = input.shift
|
86
|
+
# me.resume(Printer)
|
87
|
+
# end
|
88
|
+
# input.shift # discard every seventh input number
|
89
|
+
# end
|
90
|
+
# end
|
91
|
+
# Printer = Coroutine.new do |me|
|
92
|
+
# loop do
|
93
|
+
# 1.upto(8) do
|
94
|
+
# me.resume(Producer)
|
95
|
+
# if Producer[:last_input]
|
96
|
+
# print Producer[:last_input], "\t"
|
97
|
+
# Producer[:last_input] = nil
|
98
|
+
# end
|
99
|
+
# me.resume(Controller)
|
100
|
+
# end
|
101
|
+
# puts
|
102
|
+
# end
|
103
|
+
# end
|
104
|
+
#
|
105
|
+
# Controller = Coroutine.new do |me|
|
106
|
+
# until input.empty? do
|
107
|
+
# me.resume(Printer)
|
108
|
+
# end
|
109
|
+
# end
|
110
|
+
#
|
111
|
+
# Controller.run
|
112
|
+
#
|
113
|
+
class Coroutine
|
114
|
+
|
115
|
+
def initialize(data = {})
|
116
|
+
@stopped = nil
|
117
|
+
@data = data
|
118
|
+
callcc do |@continue|
|
119
|
+
return
|
120
|
+
end
|
121
|
+
yield self
|
122
|
+
stop
|
123
|
+
end
|
124
|
+
|
125
|
+
attr_reader :stopped
|
126
|
+
|
127
|
+
def run
|
128
|
+
callcc do |@stopped|
|
129
|
+
continue
|
130
|
+
end
|
131
|
+
end
|
132
|
+
|
133
|
+
def stop
|
134
|
+
@stopped.call
|
135
|
+
end
|
136
|
+
|
137
|
+
def resume(other)
|
138
|
+
callcc do |@continue|
|
139
|
+
other.continue(self)
|
140
|
+
end
|
141
|
+
end
|
142
|
+
|
143
|
+
def continue(from = nil)
|
144
|
+
@stopped = from.stopped if not @stopped and from
|
145
|
+
@continue.call
|
146
|
+
end
|
147
|
+
|
148
|
+
def [](name)
|
149
|
+
@data[name]
|
150
|
+
end
|
151
|
+
|
152
|
+
def []=(name, value)
|
153
|
+
@data[name] = value
|
154
|
+
end
|
155
|
+
|
156
|
+
protected :stopped, :continue
|
157
|
+
|
158
|
+
end
|
159
|
+
|
@@ -0,0 +1,166 @@
|
|
1
|
+
# = Crypt
|
2
|
+
#
|
3
|
+
# A pure ruby version of crypt(3), a salted one-way hashing of a password.
|
4
|
+
#
|
5
|
+
# == History
|
6
|
+
#
|
7
|
+
# Adapted by guillaume__dot__pierronnet_at__laposte__dot_net based on
|
8
|
+
# * http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/325204/index_txt
|
9
|
+
# which is based on FreeBSD src/lib/libcrypt/crypt.c 1.2
|
10
|
+
# * http://www.freebsd.org/cgi/cvsweb.cgi/~checkout~/src/lib/libcrypt/crypt.c?rev=1.2&content-type=text/plain
|
11
|
+
#
|
12
|
+
# [Original License]
|
13
|
+
#
|
14
|
+
# "THE BEER-WARE LICENSE" (Revision 42):
|
15
|
+
# <phk@login.dknet.dk> wrote this file. As long as you retain this notice you
|
16
|
+
# can do whatever you want with this stuff. If we meet some day, and you think
|
17
|
+
# this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
|
18
|
+
#
|
19
|
+
# == Authors
|
20
|
+
#
|
21
|
+
# * Poul-Henning Kamp
|
22
|
+
#
|
23
|
+
# == Copying
|
24
|
+
#
|
25
|
+
# Copyright (c) 2002 Poul-Henning Kamp
|
26
|
+
#
|
27
|
+
# Ruby License
|
28
|
+
#
|
29
|
+
# This module is free software. You may use, modify, and/or redistribute this
|
30
|
+
# software under the same terms as Ruby.
|
31
|
+
#
|
32
|
+
# This program is distributed in the hope that it will be useful, but WITHOUT
|
33
|
+
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
34
|
+
# FOR A PARTICULAR PURPOSE.
|
35
|
+
|
36
|
+
require 'facets/string/xor.rb'
|
37
|
+
|
38
|
+
# = Crypt
|
39
|
+
#
|
40
|
+
# A pure ruby version of crypt(3), a salted one-way hashing of a password.
|
41
|
+
#
|
42
|
+
module Crypt
|
43
|
+
|
44
|
+
ITOA64 = "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
|
45
|
+
|
46
|
+
# A pure ruby version of crypt(3), a salted one-way hashing of a password.
|
47
|
+
#
|
48
|
+
# Supported hashing algorithms are: md5, sha1, sha256, sha384, sha512, rmd160.
|
49
|
+
#
|
50
|
+
# Only the md5 hashing algorithm is standard and compatible with crypt(3), the others
|
51
|
+
# are not standard.
|
52
|
+
#
|
53
|
+
# Automatically generate a 8-bytes salt if nil.
|
54
|
+
#
|
55
|
+
# Output a length hashed and salted string with size of
|
56
|
+
# magic.size + salt.size + 23.
|
57
|
+
|
58
|
+
def self.crypt(password, algo = :md5, salt = nil, magic='$1$')
|
59
|
+
|
60
|
+
salt ||= generate_salt(8)
|
61
|
+
|
62
|
+
case algo
|
63
|
+
when :md5
|
64
|
+
require "digest/md5"
|
65
|
+
when :sha1
|
66
|
+
require "digest/sha1"
|
67
|
+
when :rmd160
|
68
|
+
require "digest/rmd160"
|
69
|
+
when :sha256, :sha384, :sha512
|
70
|
+
require "digest/sha2"
|
71
|
+
else
|
72
|
+
raise(ArgumentError, "unknown algorithm")
|
73
|
+
end
|
74
|
+
digest_class = Digest.const_get(algo.to_s.upcase)
|
75
|
+
|
76
|
+
# The password first, since that is what is most unknown. Then our magic string. Then the raw salt.
|
77
|
+
m = digest_class.new
|
78
|
+
m.update(password + magic + salt)
|
79
|
+
|
80
|
+
# Then just as many characters of the MD5(pw,salt,pw)
|
81
|
+
mixin = digest_class.new.update(password + salt + password).digest
|
82
|
+
password.length.times do |i|
|
83
|
+
m.update(mixin[i % 16].chr)
|
84
|
+
end
|
85
|
+
|
86
|
+
# Then something really weird...
|
87
|
+
# Also really broken, as far as I can tell. -m
|
88
|
+
i = password.length
|
89
|
+
while i != 0
|
90
|
+
if (i & 1) != 0
|
91
|
+
m.update("\x00")
|
92
|
+
else
|
93
|
+
m.update(password[0].chr)
|
94
|
+
end
|
95
|
+
i >>= 1
|
96
|
+
end
|
97
|
+
|
98
|
+
final = m.digest
|
99
|
+
|
100
|
+
# and now, just to make sure things don't run too fast
|
101
|
+
1000.times do |i|
|
102
|
+
m2 = digest_class.new
|
103
|
+
|
104
|
+
if (i & 1) != 0
|
105
|
+
m2.update(password)
|
106
|
+
else
|
107
|
+
m2.update(final)
|
108
|
+
end
|
109
|
+
|
110
|
+
if (i % 3) != 0
|
111
|
+
m2.update(salt)
|
112
|
+
end
|
113
|
+
if (i % 7) != 0
|
114
|
+
m2.update(password)
|
115
|
+
end
|
116
|
+
|
117
|
+
if (i & 1) != 0
|
118
|
+
m2.update(final)
|
119
|
+
else
|
120
|
+
m2.update(password)
|
121
|
+
end
|
122
|
+
|
123
|
+
final = m2.digest
|
124
|
+
end
|
125
|
+
|
126
|
+
# This is the bit that uses to64() in the original code.
|
127
|
+
|
128
|
+
rearranged = ""
|
129
|
+
|
130
|
+
[ [0, 6, 12], [1, 7, 13], [2, 8, 14], [3, 9, 15], [4, 10, 5] ].each do |a, b, c|
|
131
|
+
|
132
|
+
v = final[a] << 16 | final[b] << 8 | final[c]
|
133
|
+
|
134
|
+
4.times do
|
135
|
+
rearranged += ITOA64[v & 0x3f].chr
|
136
|
+
v >>= 6
|
137
|
+
end
|
138
|
+
end
|
139
|
+
|
140
|
+
v = final[11]
|
141
|
+
|
142
|
+
2.times do
|
143
|
+
rearranged += ITOA64[v & 0x3f].chr
|
144
|
+
v >>= 6
|
145
|
+
end
|
146
|
+
|
147
|
+
magic + salt + '$' + rearranged
|
148
|
+
end
|
149
|
+
|
150
|
+
|
151
|
+
# check the validity of a password against an hashed string
|
152
|
+
|
153
|
+
def self.check(password, hash, algo = :md5)
|
154
|
+
magic, salt = hash.split('$')[1,2]
|
155
|
+
magic = '$' + magic + '$'
|
156
|
+
self.crypt(password, algo, salt, magic) == hash
|
157
|
+
end
|
158
|
+
|
159
|
+
|
160
|
+
# generate a +size+ length random salt
|
161
|
+
|
162
|
+
def self.generate_salt(size)
|
163
|
+
(1..size).collect { ITOA64[rand(ITOA64.size)].chr }.join("")
|
164
|
+
end
|
165
|
+
end
|
166
|
+
|
@@ -0,0 +1,254 @@
|
|
1
|
+
# = CSS Filter
|
2
|
+
#
|
3
|
+
# The CssFilter class will clean up a cascading style sheet.
|
4
|
+
# It can be used to remove whitespace and most importantly
|
5
|
+
# remove urls.
|
6
|
+
#
|
7
|
+
# == Authors
|
8
|
+
#
|
9
|
+
# * Trans
|
10
|
+
#
|
11
|
+
# == Todo
|
12
|
+
#
|
13
|
+
# * Allow urls to be specified per attribute type.
|
14
|
+
#
|
15
|
+
# == Copying
|
16
|
+
#
|
17
|
+
# Copyright (c) 2007 7rans
|
18
|
+
|
19
|
+
require 'facets/uri'
|
20
|
+
|
21
|
+
# = CSS Filter
|
22
|
+
#
|
23
|
+
# The CssFilter class will clean up a cascading style sheet.
|
24
|
+
# It can be used to remove whitespace and most importantly
|
25
|
+
# remove urls.
|
26
|
+
#
|
27
|
+
class CssFilter
|
28
|
+
|
29
|
+
# should we remove comments? (true, false)
|
30
|
+
attr_accessor :strip_comments
|
31
|
+
|
32
|
+
# should we remove urls? (true, false)
|
33
|
+
attr_accessor :strip_urls
|
34
|
+
|
35
|
+
# url schemes which will be allowed (http, ftp, mailto)
|
36
|
+
attr_accessor :allowed_scheme
|
37
|
+
|
38
|
+
# alias for allowed_scheme
|
39
|
+
alias_method :allowed_protocols, :allowed_scheme
|
40
|
+
alias_method :allowed_protocols=, :allowed_scheme=
|
41
|
+
|
42
|
+
# url hosts which will be allowed.
|
43
|
+
attr_accessor :allowed_hosts
|
44
|
+
|
45
|
+
# urls which will be allowed. (NOT YET USED)
|
46
|
+
attr_accessor :allowed_urls
|
47
|
+
|
48
|
+
# substitue urls (NOT YET USED)
|
49
|
+
attr_accessor :substitute_urls
|
50
|
+
|
51
|
+
# remove blank lines.
|
52
|
+
attr_accessor :strip_whitespace
|
53
|
+
|
54
|
+
# remove blank lines.
|
55
|
+
attr_accessor :strip_blanklines
|
56
|
+
|
57
|
+
# Complete parse and rewrite of CSS document.
|
58
|
+
# This does a complete "cleaning" but note that
|
59
|
+
# is not yet a perfect parser.
|
60
|
+
attr_accessor :rewrite
|
61
|
+
|
62
|
+
# CssFilter option defaults.
|
63
|
+
|
64
|
+
DEFAULT = {
|
65
|
+
'strip_comments' => true,
|
66
|
+
'strip_urls' => true,
|
67
|
+
'allowed_urls' => [],
|
68
|
+
'allowed_hosts' => [],
|
69
|
+
'allowed_scheme' => [],
|
70
|
+
'strip_whitespace' => false,
|
71
|
+
'strip_blanklines' => true,
|
72
|
+
'rewrite' => false,
|
73
|
+
'substitute_urls' => {}
|
74
|
+
}
|
75
|
+
|
76
|
+
#
|
77
|
+
|
78
|
+
def initialize(options=nil)
|
79
|
+
if options
|
80
|
+
h = DEFAULT.dup
|
81
|
+
options.each do |k,v|
|
82
|
+
h[k.to_s] = v
|
83
|
+
end
|
84
|
+
options = h
|
85
|
+
else
|
86
|
+
options = DEFAULT.dup
|
87
|
+
end
|
88
|
+
|
89
|
+
options.each{ |k,v| send("#{k}=",v) }
|
90
|
+
end
|
91
|
+
|
92
|
+
#
|
93
|
+
|
94
|
+
def accept_host(host)
|
95
|
+
@hosts << host
|
96
|
+
end
|
97
|
+
|
98
|
+
#
|
99
|
+
|
100
|
+
def filter(css)
|
101
|
+
css = remove_comments(css) if strip_comments
|
102
|
+
css = remove_urls(css) if strip_urls
|
103
|
+
|
104
|
+
css = remove_nullvalues(css)
|
105
|
+
|
106
|
+
css = remove_whitespace(css) if strip_whitespace
|
107
|
+
css = remove_blanklines(css) if strip_blanklines
|
108
|
+
|
109
|
+
css = parse(css).to_css if rewrite
|
110
|
+
css
|
111
|
+
end
|
112
|
+
|
113
|
+
#
|
114
|
+
|
115
|
+
def remove_comments(data)
|
116
|
+
data.gsub(/\/\*(.8?)\*\//,'')
|
117
|
+
end
|
118
|
+
|
119
|
+
# TODO: allowed_urls
|
120
|
+
|
121
|
+
def remove_urls(data)
|
122
|
+
urls = data.scan(/url\((.*?)\)/).flatten
|
123
|
+
uris = urls.collect{ |u| URI.extract(u) }.flatten
|
124
|
+
uris.each do |u|
|
125
|
+
uri = URI.parse(u)
|
126
|
+
unless allowed_hosts.include?(uri.host) or
|
127
|
+
allowed_scheme.include?(uri.scheme)
|
128
|
+
data.sub!(u.to_s, '')
|
129
|
+
end
|
130
|
+
end
|
131
|
+
data.gsub(/url\(\s*\)/, '')
|
132
|
+
end
|
133
|
+
|
134
|
+
#
|
135
|
+
|
136
|
+
def remove_whitespace(data)
|
137
|
+
data = data.gsub(/^\s*/,'')
|
138
|
+
data = data.gsub(/\s*$/,'')
|
139
|
+
end
|
140
|
+
|
141
|
+
#
|
142
|
+
|
143
|
+
def remove_blanklines(data)
|
144
|
+
data = data.gsub(/^\s*\n/,'')
|
145
|
+
end
|
146
|
+
|
147
|
+
#
|
148
|
+
|
149
|
+
def remove_nullvalues(data);
|
150
|
+
data = data.gsub(/\w+[:](\s+)[;]/,'')
|
151
|
+
end
|
152
|
+
|
153
|
+
# Breaks a css document up into a hash. This can be used
|
154
|
+
# completely rewritting the css.
|
155
|
+
#
|
156
|
+
# TODO: Not complete, does not work with "@xxx foo;" for example.
|
157
|
+
|
158
|
+
def parse(css)
|
159
|
+
tree = CssTree.new
|
160
|
+
entries = css.scan(/^(.*?)\{(.*?)\}/m)
|
161
|
+
entries.each do |ref, props|
|
162
|
+
tree[ref.strip] ||= {}
|
163
|
+
props = clean_properties(props)
|
164
|
+
props = props.scan(/(.*?)[:](.*?)([;]|\s*\Z)/)
|
165
|
+
props.each do |(key,val)|
|
166
|
+
tree[ref.strip][key.strip] = clean_value(val)
|
167
|
+
end
|
168
|
+
end
|
169
|
+
return tree
|
170
|
+
end
|
171
|
+
|
172
|
+
# Takes a css entry and ensures it is valid (as best it can).
|
173
|
+
# It will fix trival mistakes, and raise an error when it is
|
174
|
+
# beyond repair.
|
175
|
+
#
|
176
|
+
# TODO: So far this does absolutely nothing!
|
177
|
+
|
178
|
+
def clean_properties(atts)
|
179
|
+
atts
|
180
|
+
end
|
181
|
+
|
182
|
+
#
|
183
|
+
|
184
|
+
def clean_value(val)
|
185
|
+
val = val.strip
|
186
|
+
|
187
|
+
if urls
|
188
|
+
uris = URI.extract(val)
|
189
|
+
uris.each do |u|
|
190
|
+
val.sub!(u.to_s, urls)
|
191
|
+
end
|
192
|
+
end
|
193
|
+
|
194
|
+
return val
|
195
|
+
end
|
196
|
+
|
197
|
+
end
|
198
|
+
|
199
|
+
|
200
|
+
# CSS parse tree. This is for a "deep filtering".
|
201
|
+
|
202
|
+
class CssTree < Hash
|
203
|
+
|
204
|
+
def initialize(options=nil)
|
205
|
+
@options = options || {}
|
206
|
+
super()
|
207
|
+
end
|
208
|
+
|
209
|
+
# Re-output the CSS, all tidy ;)
|
210
|
+
|
211
|
+
def to_css
|
212
|
+
css = ""
|
213
|
+
each do |selector, entries|
|
214
|
+
css << "#{selector}{"
|
215
|
+
entries.each do |key, value|
|
216
|
+
css << "#{key}:#{value};"
|
217
|
+
end
|
218
|
+
css << "}\n"
|
219
|
+
end
|
220
|
+
return css
|
221
|
+
end
|
222
|
+
|
223
|
+
end
|
224
|
+
|
225
|
+
|
226
|
+
|
227
|
+
if $0 == __FILE__
|
228
|
+
|
229
|
+
require 'yaml'
|
230
|
+
|
231
|
+
css = <<-END
|
232
|
+
* {
|
233
|
+
margin: 0;
|
234
|
+
height: 0;
|
235
|
+
}
|
236
|
+
|
237
|
+
body {
|
238
|
+
margin: 0;
|
239
|
+
height: 0;
|
240
|
+
background: url(http://xzy.org);
|
241
|
+
}
|
242
|
+
|
243
|
+
h1 {
|
244
|
+
trythis: url(http://here.org/fun.js);
|
245
|
+
font-size: 12pt;
|
246
|
+
}
|
247
|
+
END
|
248
|
+
|
249
|
+
cssfilter = Blow::CssFilter.new(:allowed_hosts=>["here.org"])
|
250
|
+
csstree = cssfilter.filter(css)
|
251
|
+
#y csstree
|
252
|
+
puts csstree
|
253
|
+
|
254
|
+
end
|