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,366 @@
|
|
1
|
+
# = tagiterator.rb
|
2
|
+
#
|
3
|
+
# == Copyright (c) 2000 Ⴗnyasu <nyasu@osk.3web.ne.jp>
|
4
|
+
#
|
5
|
+
# Ruby License
|
6
|
+
#
|
7
|
+
# This module is free software. You may use, modify, and/or redistribute this
|
8
|
+
# software under the same terms as Ruby.
|
9
|
+
#
|
10
|
+
# This program is distributed in the hope that it will be useful, but WITHOUT
|
11
|
+
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
12
|
+
# FOR A PARTICULAR PURPOSE.
|
13
|
+
#
|
14
|
+
# == Author(s)
|
15
|
+
#
|
16
|
+
# * Ⴗnyasu
|
17
|
+
|
18
|
+
# Author:: Ⴗnyasu <nyasu@osk.3web.ne.jp>
|
19
|
+
# Copyright:: Copyright (c) 2000 Ⴗnyasu
|
20
|
+
# License:: Ruby License
|
21
|
+
|
22
|
+
# = TagIterator (aka Tagiter)
|
23
|
+
#
|
24
|
+
# Simple but very useful HTML/XHTML cascading parser.
|
25
|
+
#
|
26
|
+
# Quickly iterate through tagged markup documents like HTML and XML.
|
27
|
+
# TagIterator is great for quick and dirty web scrapping.
|
28
|
+
#
|
29
|
+
# == Usage
|
30
|
+
#
|
31
|
+
# # sample html
|
32
|
+
# stext = <<-EOF
|
33
|
+
# <body> This is a test...
|
34
|
+
# <sub> S1 </sub> <sub> S2 </sub>
|
35
|
+
# <DL>
|
36
|
+
# <DT> A1
|
37
|
+
# <DT> A2
|
38
|
+
# <DT> A3
|
39
|
+
# </DL>
|
40
|
+
# <DL>
|
41
|
+
# <DT> B1
|
42
|
+
# <DT> B2
|
43
|
+
# <DT> B3
|
44
|
+
# </DL>
|
45
|
+
# <NEST>
|
46
|
+
# <P ALIGN="R">TOP</P>
|
47
|
+
# <NEST>
|
48
|
+
# <P>SECOND</P>
|
49
|
+
# <OL>
|
50
|
+
# <LI>C1
|
51
|
+
# <LI>C2
|
52
|
+
# <LI>C3
|
53
|
+
# <LI>C4
|
54
|
+
# </OL>
|
55
|
+
# </NEST>
|
56
|
+
# <OL>
|
57
|
+
# <LI>D1
|
58
|
+
# <LI>D2
|
59
|
+
# <LI>D3
|
60
|
+
# <LI>D4
|
61
|
+
# </OL>
|
62
|
+
# </NEST>
|
63
|
+
# </body>
|
64
|
+
# EOF
|
65
|
+
#
|
66
|
+
# a = TagIterator.new(stext)
|
67
|
+
# a.first("body") do |y|
|
68
|
+
# y.nth("dl",2) do |dl|
|
69
|
+
# dl.enumtag("dt") do |t|
|
70
|
+
# puts t.text.strip
|
71
|
+
# end
|
72
|
+
# end
|
73
|
+
# y.first("nest") do |n|
|
74
|
+
# n.first("p") do |c|
|
75
|
+
# print c.text, ' '
|
76
|
+
# puts c.attributes.collect{ |k,v| "#{k}=#{v}" }
|
77
|
+
# end.next("nest") do |m|
|
78
|
+
# m.first("p") do |c|
|
79
|
+
# puts c.text
|
80
|
+
# end.next("ol") do |o|
|
81
|
+
# o.enumtag("li") do |i| puts i.text.strip end
|
82
|
+
# end
|
83
|
+
# end.next("ol") do |o|
|
84
|
+
# o.enumtag("li") do |i| puts i.text.strip end
|
85
|
+
# end
|
86
|
+
# end
|
87
|
+
# end
|
88
|
+
# a.each_block("sub") do |y|
|
89
|
+
# puts y.text.strip
|
90
|
+
# end
|
91
|
+
#
|
92
|
+
# _produces_
|
93
|
+
#
|
94
|
+
# B1
|
95
|
+
# B2
|
96
|
+
# B3
|
97
|
+
# TOP align=R
|
98
|
+
# SECOND
|
99
|
+
# C1
|
100
|
+
# C2
|
101
|
+
# C3
|
102
|
+
# C4
|
103
|
+
# D1
|
104
|
+
# D2
|
105
|
+
# D3
|
106
|
+
# D4
|
107
|
+
# S1
|
108
|
+
# S2
|
109
|
+
#
|
110
|
+
|
111
|
+
class TagIterator
|
112
|
+
|
113
|
+
attr :text
|
114
|
+
attr :option, true
|
115
|
+
attr :tag
|
116
|
+
attr :attributes
|
117
|
+
|
118
|
+
private
|
119
|
+
|
120
|
+
def initialize(text,tag=nil,attributes={})
|
121
|
+
raise RuntimeError,"Only String accepted" unless text.is_a?(String)
|
122
|
+
@text=text
|
123
|
+
@option="pi"
|
124
|
+
@tag=tag
|
125
|
+
@attributes=attributes
|
126
|
+
def @attributes.[](aname)
|
127
|
+
super aname.downcase
|
128
|
+
end
|
129
|
+
end
|
130
|
+
|
131
|
+
def find_element(element,st=0)
|
132
|
+
rex=Regexp.new('<(\s|\n)*'+element+'(\s|\n|>)',@option)
|
133
|
+
@text.index(rex,st)
|
134
|
+
end
|
135
|
+
|
136
|
+
def parse_attribute(attstr)
|
137
|
+
k={}; r={};
|
138
|
+
attstr.scan(/(\w+)=(\S+)/) do |pt| k[ pt[0] ] = pt[1] end
|
139
|
+
attstr.scan(/(\w+)="([^"]*)"/) do |pt| k[ pt[0] ] = pt[1] end
|
140
|
+
k.each do |key,val| r[key.downcase]=val end
|
141
|
+
r
|
142
|
+
end
|
143
|
+
|
144
|
+
def find_opentag(tag,st=0)
|
145
|
+
s=find_element(tag,st)
|
146
|
+
return nil unless s
|
147
|
+
|
148
|
+
r=@text.index('>',s)
|
149
|
+
return r+1,@text[s+1..r-1]
|
150
|
+
end
|
151
|
+
|
152
|
+
def find_closetag(tag,st,opentag=nil)
|
153
|
+
if opentag then
|
154
|
+
p=find_element(tag,st)
|
155
|
+
q,d = find_opentag(opentag,st)
|
156
|
+
else
|
157
|
+
p=find_element('/\s*'+tag,st)
|
158
|
+
q,d = find_opentag(tag,st)
|
159
|
+
end
|
160
|
+
p-=1 if p
|
161
|
+
|
162
|
+
if p and q then if p > q then # tag nested
|
163
|
+
p=find_closetag(tag,find_closetag(tag,q,opentag)+2,opentag)
|
164
|
+
end end
|
165
|
+
|
166
|
+
return p
|
167
|
+
end
|
168
|
+
|
169
|
+
def find_closeenumtag(tag,st=0)
|
170
|
+
rex=Regexp.new('<\s*'+tag,@option)
|
171
|
+
s=@text.index(rex,st)
|
172
|
+
s-=1 if s
|
173
|
+
s
|
174
|
+
end
|
175
|
+
alias_method :find_openenumtag, :find_opentag
|
176
|
+
|
177
|
+
public
|
178
|
+
|
179
|
+
def nth(tag,n,closetag=nil)
|
180
|
+
raise RuntimeError,"nth: number not specified" unless n
|
181
|
+
t=0
|
182
|
+
e=s=0 # for their scope
|
183
|
+
d=nil
|
184
|
+
|
185
|
+
1.upto(n) do |i|
|
186
|
+
s,d = find_opentag(tag,t)
|
187
|
+
raise RuntimeError,"tag(#{tag}) not found at(#{i})" unless s
|
188
|
+
|
189
|
+
if closetag then
|
190
|
+
e=find_closetag(closetag,s,tag)
|
191
|
+
else
|
192
|
+
e=find_closetag(tag,s)
|
193
|
+
end
|
194
|
+
e=-1 unless e
|
195
|
+
t=@text.index('>',e+1)
|
196
|
+
t=@text.length unless t
|
197
|
+
end
|
198
|
+
yield self.class.new(text[s..e],tag,parse_attribute(d))
|
199
|
+
self.class.new(text[t+1..-1])
|
200
|
+
end
|
201
|
+
|
202
|
+
def first(tag,*arg) nth(tag,1,*arg) do |f| yield f end end
|
203
|
+
alias_method :next, :first
|
204
|
+
|
205
|
+
def each_block(tag,closetag=nil)
|
206
|
+
t=0
|
207
|
+
s,d =find_opentag(tag)
|
208
|
+
raise RuntimeError,"tag(#{tag}) not found" unless s
|
209
|
+
|
210
|
+
while s do
|
211
|
+
if closetag then
|
212
|
+
e=find_closetag(closetag,s,tag)
|
213
|
+
else
|
214
|
+
e=find_closetag(tag,s)
|
215
|
+
end
|
216
|
+
e=-1 unless e
|
217
|
+
yield self.class.new(@text[s..e],tag,parse_attribute(d))
|
218
|
+
if e>=0 then
|
219
|
+
t=@text.index('>',e+1)
|
220
|
+
t=@text.length unless t
|
221
|
+
s,d = find_opentag(tag,t)
|
222
|
+
else
|
223
|
+
s=false
|
224
|
+
end
|
225
|
+
end
|
226
|
+
self.class.new(text[t+1..-1])
|
227
|
+
end
|
228
|
+
|
229
|
+
def collect(*arg)
|
230
|
+
a=[]
|
231
|
+
each_block(*arg) do |tt| a.push tt end
|
232
|
+
a
|
233
|
+
end
|
234
|
+
|
235
|
+
def enumtag(tag)
|
236
|
+
s,d = find_openenumtag(tag)
|
237
|
+
while s do
|
238
|
+
e=find_closeenumtag(tag,s+1)
|
239
|
+
e=-1 unless e
|
240
|
+
yield self.class.new(@text[s..e],tag,parse_attribute(d))
|
241
|
+
s,d = find_openenumtag(tag,s)
|
242
|
+
end
|
243
|
+
end
|
244
|
+
|
245
|
+
def enumcollect(tag)
|
246
|
+
a=[]
|
247
|
+
enumtag(tag) do |t| a.push t end
|
248
|
+
a
|
249
|
+
end
|
250
|
+
|
251
|
+
def for_this
|
252
|
+
yield self
|
253
|
+
end
|
254
|
+
|
255
|
+
def get_nth(*arg) r=nil; nth(*arg) do |bl| r=bl end; r; end
|
256
|
+
|
257
|
+
def get_first(*arg) r=nil; first(*arg) do |bl| r=bl end; r; end
|
258
|
+
|
259
|
+
def tagexist?(tag,st=0)
|
260
|
+
s=find_element(tag,st)
|
261
|
+
if s then true else false end
|
262
|
+
end
|
263
|
+
|
264
|
+
def tagnext
|
265
|
+
s=@text.index("<")
|
266
|
+
return nil unless s
|
267
|
+
e=@text.index(">",s)
|
268
|
+
return nil unless s
|
269
|
+
@text[s..e].scan(/[^<>\s]+/)[0]
|
270
|
+
end
|
271
|
+
|
272
|
+
def nth_tailer(tag,n)
|
273
|
+
nth(tag,n) do end
|
274
|
+
end
|
275
|
+
|
276
|
+
end
|
277
|
+
|
278
|
+
|
279
|
+
|
280
|
+
# _____ _
|
281
|
+
# |_ _|__ ___| |_
|
282
|
+
# | |/ _ \/ __| __|
|
283
|
+
# | | __/\__ \ |_
|
284
|
+
# |_|\___||___/\__|
|
285
|
+
#
|
286
|
+
|
287
|
+
=begin testing
|
288
|
+
|
289
|
+
require 'test/unit'
|
290
|
+
|
291
|
+
class TC_TagIterator < Test::Unit::TestCase
|
292
|
+
|
293
|
+
STEXT = <<-EOS
|
294
|
+
<body> This is a test...
|
295
|
+
<sub> S1 </sub> <sub> S2 </sub>
|
296
|
+
<DL>
|
297
|
+
<DT> A1
|
298
|
+
<DT> A2
|
299
|
+
<DT> A3
|
300
|
+
</DL>
|
301
|
+
<DL>
|
302
|
+
<DT> B1
|
303
|
+
<DT> B2
|
304
|
+
<DT> B3
|
305
|
+
</DL>
|
306
|
+
<NEST>
|
307
|
+
<P ALIGN="R">TOP</P>
|
308
|
+
<NEST>
|
309
|
+
<P>SECOND</P>
|
310
|
+
<OL>
|
311
|
+
<LI>C1
|
312
|
+
<LI>C2
|
313
|
+
<LI>C3
|
314
|
+
<LI>C4
|
315
|
+
</OL>
|
316
|
+
</NEST>
|
317
|
+
<OL>
|
318
|
+
<LI>D1
|
319
|
+
<LI>D2
|
320
|
+
<LI>D3
|
321
|
+
<LI>D4
|
322
|
+
</OL>
|
323
|
+
</NEST>
|
324
|
+
</body>
|
325
|
+
EOS
|
326
|
+
|
327
|
+
def test_all
|
328
|
+
assert_nothing_raised{ @a = TagIterator.new( STEXT ) }
|
329
|
+
@f = []
|
330
|
+
assert_nothing_raised {
|
331
|
+
@a.first("body") do |y|
|
332
|
+
y.nth("dl",2) do |dl|
|
333
|
+
dl.enumtag("dt") do |t|
|
334
|
+
@f << t.text.strip
|
335
|
+
end
|
336
|
+
end
|
337
|
+
y.first("nest") do |n|
|
338
|
+
n.first("p") do |c|
|
339
|
+
@f << c.text
|
340
|
+
@f.concat c.attributes.collect{ |k,v| "#{k}=#{v}" }
|
341
|
+
end.next("nest") do |m|
|
342
|
+
m.first("p") do |c|
|
343
|
+
@f << c.text
|
344
|
+
end.next("ol") do |o|
|
345
|
+
o.enumtag("li") do |i| @f << i.text.strip end
|
346
|
+
end
|
347
|
+
end.next("ol") do |o|
|
348
|
+
o.enumtag("li") do |i| @f << i.text.strip end
|
349
|
+
end
|
350
|
+
end
|
351
|
+
end
|
352
|
+
@a.each_block("sub") do |y|
|
353
|
+
@f << y.text.strip
|
354
|
+
end
|
355
|
+
}
|
356
|
+
o = [ "B1", "B2", "B3",
|
357
|
+
"TOP", "align=R", "SECOND",
|
358
|
+
"C1", "C2", "C3", "C4",
|
359
|
+
"D1", "D2", "D3", "D4",
|
360
|
+
"S1", "S2" ]
|
361
|
+
assert_equal( o, @f )
|
362
|
+
end
|
363
|
+
|
364
|
+
end
|
365
|
+
|
366
|
+
=end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
# = Thread Related Extensions
|
2
|
+
#
|
3
|
+
# Thread extensions, in particular for Enumerable --send
|
4
|
+
# a message to each member via a thread and collect the results.
|
5
|
+
#
|
6
|
+
# == Authors
|
7
|
+
#
|
8
|
+
# * Sean O'Halpin
|
9
|
+
#
|
10
|
+
# == Todo
|
11
|
+
#
|
12
|
+
# * Better names for these methods ?
|
13
|
+
#
|
14
|
+
# == Copying
|
15
|
+
#
|
16
|
+
# Copyright (c) 2006 Sean O'Halpin
|
17
|
+
#
|
18
|
+
# Ruby License
|
19
|
+
#
|
20
|
+
# This module is free software. You may use, modify, and/or redistribute this
|
21
|
+
# software under the same terms as Ruby.
|
22
|
+
#
|
23
|
+
# This program is distributed in the hope that it will be useful, but WITHOUT
|
24
|
+
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
25
|
+
# FOR A PARTICULAR PURPOSE.
|
26
|
+
|
27
|
+
require 'thread'
|
28
|
+
require 'facets/enumerable/map_send'
|
29
|
+
|
30
|
+
module Enumerable
|
31
|
+
|
32
|
+
# Like Enumerable#map but each iteration is processed via
|
33
|
+
# a separate thread.
|
34
|
+
#
|
35
|
+
# CREDIT Sean O'Halpin
|
36
|
+
|
37
|
+
def threaded_map #:yield:
|
38
|
+
map{ |e| Thread.new(e){ |t| yield(t) } }.map{ |t| t.value }
|
39
|
+
end
|
40
|
+
|
41
|
+
# Like Enumerable#map_send but each iteration is processed via
|
42
|
+
# a separate thread.
|
43
|
+
#
|
44
|
+
# CREDIT Sean O'Halpin
|
45
|
+
|
46
|
+
def threaded_map_send(meth, *args, &block)
|
47
|
+
map{ |e| Thread.new(e){ |t| t.send(meth, *args, &block) } }.map{ |t| t.value }
|
48
|
+
end
|
49
|
+
|
50
|
+
end
|
51
|
+
|
@@ -0,0 +1,274 @@
|
|
1
|
+
# = Timer
|
2
|
+
#
|
3
|
+
# Provides a strightforward means for controlling time critical execution.
|
4
|
+
# Can be used as a "stop watch" timer or as a "time bomb" timer.
|
5
|
+
#
|
6
|
+
# == Usage
|
7
|
+
#
|
8
|
+
# t = Timer.new(10) { raise TimeoutError, "timeout!" }
|
9
|
+
# t.start
|
10
|
+
# : # done within 10sec timeout
|
11
|
+
# t.stop
|
12
|
+
# t.start
|
13
|
+
# :
|
14
|
+
# if condition then
|
15
|
+
# t.reset #--> restart timer
|
16
|
+
# end
|
17
|
+
#
|
18
|
+
# A Kernel method is also provided for easily timing the exectuion of a block.
|
19
|
+
#
|
20
|
+
# timed { |timer|
|
21
|
+
#
|
22
|
+
# timer.total_time.round #=> 0
|
23
|
+
#
|
24
|
+
# sleep 1
|
25
|
+
# timer.total_time.round #=> 1
|
26
|
+
#
|
27
|
+
# timer.stop
|
28
|
+
# timer.total_time.round #=> 1
|
29
|
+
#
|
30
|
+
# sleep 2
|
31
|
+
# timer.total_time.round #=> 1
|
32
|
+
#
|
33
|
+
# timer.start
|
34
|
+
# timer.total_time.round #=> 1
|
35
|
+
#
|
36
|
+
# sleep 1
|
37
|
+
# timer.total_time.round #=> 2
|
38
|
+
#
|
39
|
+
# }
|
40
|
+
#
|
41
|
+
# == HISTORY
|
42
|
+
#
|
43
|
+
# Thanks to Paul Brannan for TimeLimit and Minero Aoki for Timer.
|
44
|
+
# These two libraries served as models for building this class.
|
45
|
+
#
|
46
|
+
# == AUTHORS
|
47
|
+
#
|
48
|
+
# * Thomas Sawyer
|
49
|
+
# * Minero Aoki
|
50
|
+
# * Paul Brannan
|
51
|
+
#
|
52
|
+
# == COPYRIGHT
|
53
|
+
#
|
54
|
+
# Copyright (c) 2004 Thomas Sawyer
|
55
|
+
#
|
56
|
+
# == LICENSE
|
57
|
+
#
|
58
|
+
# Ruby License
|
59
|
+
#
|
60
|
+
# This module is free software. You may use, modify, and/or redistribute this
|
61
|
+
# software under the same terms as Ruby.
|
62
|
+
#
|
63
|
+
# This program is distributed in the hope that it will be useful, but WITHOUT
|
64
|
+
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
65
|
+
# FOR A PARTICULAR PURPOSE.
|
66
|
+
|
67
|
+
require 'timeout' # for TimeoutError
|
68
|
+
|
69
|
+
# = Timer
|
70
|
+
#
|
71
|
+
# Provides a strightforward means for controlling time critical execution.
|
72
|
+
# Can be used as a "stop watch" timer or as a "time bomb" timer.
|
73
|
+
#
|
74
|
+
# t = Timer.new(10) { raise TimeoutError, "timeout!" }
|
75
|
+
# t.start
|
76
|
+
# : # done within 10sec timeout
|
77
|
+
# t.stop
|
78
|
+
# t.start
|
79
|
+
# :
|
80
|
+
# if condition then
|
81
|
+
# t.reset #--> restart timer
|
82
|
+
# end
|
83
|
+
#
|
84
|
+
# A Kernel method is also provided for easily timing the exectuion of a block.
|
85
|
+
#
|
86
|
+
# timed { |timer|
|
87
|
+
# timer.total_time.round #=> 0
|
88
|
+
#
|
89
|
+
# sleep 1
|
90
|
+
# timer.total_time.round #=> 1
|
91
|
+
#
|
92
|
+
# timer.stop
|
93
|
+
# timer.total_time.round #=> 1
|
94
|
+
#
|
95
|
+
# sleep 2
|
96
|
+
# timer.total_time.round #=> 1
|
97
|
+
#
|
98
|
+
# timer.start
|
99
|
+
# timer.total_time.round #=> 1
|
100
|
+
#
|
101
|
+
# sleep 1
|
102
|
+
# timer.total_time.round #=> 2
|
103
|
+
# }
|
104
|
+
|
105
|
+
class Timer
|
106
|
+
|
107
|
+
attr_reader :start_time, :end_time
|
108
|
+
attr_accessor :time_limit
|
109
|
+
|
110
|
+
def initialize( time_limit=nil, &block )
|
111
|
+
# standard timer
|
112
|
+
@start_time = nil
|
113
|
+
@end_time = nil
|
114
|
+
@total_time = 0
|
115
|
+
@runnning = nil
|
116
|
+
# for using time limit
|
117
|
+
@time_limit = time_limit
|
118
|
+
@on_timeout = block
|
119
|
+
@current_thread = nil
|
120
|
+
@timer_thread = nil
|
121
|
+
end
|
122
|
+
|
123
|
+
def on_timeout( &block )
|
124
|
+
if block then
|
125
|
+
@on_timeout = block
|
126
|
+
true
|
127
|
+
else
|
128
|
+
false
|
129
|
+
end
|
130
|
+
end
|
131
|
+
|
132
|
+
# Start the timer.
|
133
|
+
|
134
|
+
def start
|
135
|
+
@running = true
|
136
|
+
@start_time = Time.now
|
137
|
+
|
138
|
+
limit if @time_limit
|
139
|
+
|
140
|
+
self
|
141
|
+
|
142
|
+
#if block_given? then
|
143
|
+
# begin
|
144
|
+
# yield( self )
|
145
|
+
# ensure
|
146
|
+
# stop
|
147
|
+
# end
|
148
|
+
#else
|
149
|
+
# @time_limit
|
150
|
+
#end
|
151
|
+
end
|
152
|
+
|
153
|
+
# Establish a time limit on execution.
|
154
|
+
|
155
|
+
def limit( time_limit=nil )
|
156
|
+
if @time_limit || time_limit
|
157
|
+
@current_thread = Thread.current
|
158
|
+
@timer_thread = Thread.fork {
|
159
|
+
sleep @time_limit
|
160
|
+
if @on_timeout then
|
161
|
+
@on_timeout.call @time_limit
|
162
|
+
else
|
163
|
+
@current_thread.raise TimeoutError, "#{@time_limit} seconds past"
|
164
|
+
end
|
165
|
+
}
|
166
|
+
end
|
167
|
+
end
|
168
|
+
|
169
|
+
# Kill time limit thread, if any.
|
170
|
+
|
171
|
+
def defuse
|
172
|
+
if @timer_thread
|
173
|
+
Thread.kill @timer_thread
|
174
|
+
@timer_thread = nil
|
175
|
+
end
|
176
|
+
end
|
177
|
+
|
178
|
+
# Stops timer and returns total time.
|
179
|
+
# If timer was not running returns false.
|
180
|
+
|
181
|
+
def stop
|
182
|
+
if @running
|
183
|
+
defuse
|
184
|
+
# record running time
|
185
|
+
@end_time = Time.now
|
186
|
+
@running = false
|
187
|
+
@total_time += (@end_time - @start_time)
|
188
|
+
else
|
189
|
+
nil
|
190
|
+
end
|
191
|
+
end
|
192
|
+
|
193
|
+
# Stops and resets the timer. If the timer was running
|
194
|
+
# returns the total time. If not returns 0.
|
195
|
+
|
196
|
+
def reset
|
197
|
+
if running?
|
198
|
+
r = stop
|
199
|
+
else
|
200
|
+
r = 0
|
201
|
+
end
|
202
|
+
@total_time = 0
|
203
|
+
return r
|
204
|
+
end
|
205
|
+
|
206
|
+
# Resets the time limit. Same as:
|
207
|
+
#
|
208
|
+
# t.stop
|
209
|
+
# t.start
|
210
|
+
#
|
211
|
+
|
212
|
+
def reset_limit
|
213
|
+
#stop
|
214
|
+
#start
|
215
|
+
defuse
|
216
|
+
limit
|
217
|
+
end
|
218
|
+
|
219
|
+
# Queries whether the timer is still running.
|
220
|
+
|
221
|
+
def running?
|
222
|
+
return @running
|
223
|
+
end
|
224
|
+
|
225
|
+
# Queries whether the timer is still not running.
|
226
|
+
|
227
|
+
def stopped?
|
228
|
+
return !@running
|
229
|
+
end
|
230
|
+
|
231
|
+
# Queries total recorded time of timer.
|
232
|
+
|
233
|
+
def total_time
|
234
|
+
if running? then
|
235
|
+
return @total_time + (Time.now - @start_time)
|
236
|
+
else
|
237
|
+
return @total_time
|
238
|
+
end
|
239
|
+
end
|
240
|
+
|
241
|
+
#
|
242
|
+
# Timer::Dummy - Dummy Timer (i.e. no real time limit)
|
243
|
+
#--
|
244
|
+
# NEEDS WORK!
|
245
|
+
#++
|
246
|
+
|
247
|
+
class Dummy < self
|
248
|
+
def start
|
249
|
+
if block_given? then
|
250
|
+
yield
|
251
|
+
else
|
252
|
+
time_limit()
|
253
|
+
end
|
254
|
+
end
|
255
|
+
|
256
|
+
def stop
|
257
|
+
false
|
258
|
+
end
|
259
|
+
end #class Dummy
|
260
|
+
|
261
|
+
end #class Timer
|
262
|
+
|
263
|
+
|
264
|
+
module Kernel
|
265
|
+
|
266
|
+
# Takes a block and returns the total time it took to execute.
|
267
|
+
|
268
|
+
def timed
|
269
|
+
yield( timer = Timer.new.start )
|
270
|
+
return timer.total_time
|
271
|
+
end
|
272
|
+
|
273
|
+
end
|
274
|
+
|