facets 0.9.0 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +9 -2
- data/ProjectInfo +15 -22
- data/Rakefile +17 -15
- data/TODO +2 -29
- data/lib/facet/array.rb +33 -1
- data/lib/facet/array/at_rand.rb +52 -1
- data/lib/facet/array/body.rb +2 -1
- data/lib/facet/array/delete_unless.rb +35 -1
- data/lib/facet/array/delete_values.rb +38 -1
- data/lib/facet/array/delete_values_at.rb +57 -1
- data/lib/facet/array/each_with_key.rb +9 -1
- data/lib/facet/array/first.rb +84 -1
- data/lib/facet/array/foot.rb +2 -1
- data/lib/facet/array/head.rb +80 -1
- data/lib/facet/array/last.rb +2 -1
- data/lib/facet/array/last_index.rb +35 -1
- data/lib/facet/array/merge.rb +40 -1
- data/lib/facet/array/mid.rb +50 -1
- data/lib/facet/array/middle.rb +45 -1
- data/lib/facet/array/op_fetch.rb +40 -1
- data/lib/facet/array/op_store.rb +47 -1
- data/lib/facet/array/pick.rb +68 -1
- data/lib/facet/array/pos.rb +39 -1
- data/lib/facet/array/pull.rb +37 -1
- data/lib/facet/array/rand_index.rb +30 -1
- data/lib/facet/array/rand_subset.rb +56 -1
- data/lib/facet/array/range.rb +47 -1
- data/lib/facet/array/rotate.rb +67 -1
- data/lib/facet/array/select.rb +37 -1
- data/lib/facet/array/shuffle.rb +66 -1
- data/lib/facet/array/slap.rb +37 -1
- data/lib/facet/array/store.rb +7 -1
- data/lib/facet/array/tail.rb +2 -1
- data/lib/facet/array/thru.rb +38 -1
- data/lib/facet/array/to_b.rb +31 -1
- data/lib/facet/array/to_h.rb +57 -1
- data/lib/facet/array/to_hash.rb +46 -1
- data/lib/facet/array/unzip.rb +20 -1
- data/lib/facet/binding.rb +14 -1
- data/lib/facet/binding/__DIR__.rb +2 -1
- data/lib/facet/binding/__FILE__.rb +2 -1
- data/lib/facet/binding/__LINE__.rb +58 -1
- data/lib/facet/binding/call_stack.rb +42 -1
- data/lib/facet/binding/called.rb +41 -1
- data/lib/facet/binding/caller.rb +42 -1
- data/lib/facet/binding/defined.rb +41 -1
- data/lib/facet/binding/eval.rb +42 -1
- data/lib/facet/binding/local_variables.rb +45 -1
- data/lib/facet/binding/method_name.rb +48 -1
- data/lib/facet/binding/op_fetch.rb +45 -1
- data/lib/facet/binding/op_store.rb +46 -1
- data/lib/facet/binding/self.rb +41 -1
- data/lib/facet/binding/self/of_caller.rb +122 -1
- data/lib/facet/class.rb +5 -1
- data/lib/facet/class/by_name.rb +1 -1
- data/lib/facet/class/descendents.rb +44 -1
- data/lib/facet/class/remove_descendents.rb +46 -1
- data/lib/facet/class/remove_subclasses.rb +2 -1
- data/lib/facet/class/subclasses.rb +2 -1
- data/lib/facet/comparable.rb +5 -1
- data/lib/facet/comparable/at_least.rb +53 -1
- data/lib/facet/comparable/at_most.rb +2 -1
- data/lib/facet/comparable/cap.rb +2 -1
- data/lib/facet/comparable/clip.rb +72 -1
- data/lib/facet/comparable/cmp.rb +38 -1
- data/lib/facet/continuation.rb +1 -1
- data/lib/facet/continuation/self/create.rb +71 -1
- data/lib/facet/date.rb +0 -1
- data/lib/facet/date/days_in_month.rb +42 -1
- data/lib/facet/date/days_of_month.rb +34 -1
- data/lib/facet/date/stamp.rb +52 -1
- data/lib/facet/date/to_date.rb +36 -1
- data/lib/facet/date/to_s.rb +33 -1
- data/lib/facet/date/to_time.rb +36 -1
- data/lib/facet/dir.rb +4 -1
- data/lib/facet/dir/self/ancestor.rb +33 -1
- data/lib/facet/dir/self/ascend.rb +56 -1
- data/lib/facet/dir/self/ls_r.rb +76 -1
- data/lib/facet/dir/self/recurse.rb +2 -1
- data/lib/facet/enumerable.rb +38 -1
- data/lib/facet/enumerable/collect_with_counter.rb +2 -1
- data/lib/facet/enumerable/collect_with_index.rb +51 -1
- data/lib/facet/enumerable/commonality.rb +63 -1
- data/lib/facet/enumerable/compact_collect.rb +50 -1
- data/lib/facet/enumerable/compact_map.rb +2 -1
- data/lib/facet/enumerable/cross.rb +44 -1
- data/lib/facet/enumerable/each_by.rb +2 -1
- data/lib/facet/enumerable/each_combination.rb +59 -1
- data/lib/facet/enumerable/each_pair.rb +50 -1
- data/lib/facet/enumerable/each_permutation.rb +2 -1
- data/lib/facet/enumerable/each_slice.rb +131 -1
- data/lib/facet/enumerable/each_unique_pair.rb +66 -1
- data/lib/facet/enumerable/each_with_counter.rb +8 -1
- data/lib/facet/enumerable/elementwise.rb +2 -1
- data/lib/facet/enumerable/entropy.rb +52 -1
- data/lib/facet/enumerable/every.rb +65 -1
- data/lib/facet/enumerable/ew.rb +64 -1
- data/lib/facet/enumerable/filter_collect.rb +58 -1
- data/lib/facet/enumerable/filter_map.rb +2 -1
- data/lib/facet/enumerable/find_collisions.rb +41 -1
- data/lib/facet/enumerable/frequency.rb +39 -1
- data/lib/facet/enumerable/graph.rb +59 -1
- data/lib/facet/enumerable/ideal_entropy.rb +49 -1
- data/lib/facet/enumerable/map_with_counter.rb +2 -1
- data/lib/facet/enumerable/map_with_index.rb +2 -1
- data/lib/facet/enumerable/none.rb +56 -1
- data/lib/facet/enumerable/nonuniq.rb +39 -1
- data/lib/facet/enumerable/occur.rb +62 -1
- data/lib/facet/enumerable/one.rb +65 -1
- data/lib/facet/enumerable/op_pow.rb +38 -1
- data/lib/facet/enumerable/partition_by.rb +55 -1
- data/lib/facet/enumerable/permute.rb +135 -0
- data/lib/facet/enumerable/probability.rb +59 -1
- data/lib/facet/enumerable/project.rb +11 -1
- data/lib/facet/enumerable/self/combinations.rb +68 -1
- data/lib/facet/enumerable/self/cross.rb +79 -1
- data/lib/facet/enumerable/to_h.rb +50 -1
- data/lib/facet/enumerable/uniq_by.rb +39 -1
- data/lib/facet/enumerable/where.rb +12 -1
- data/lib/facet/file.rb +5 -1
- data/lib/facet/file/self/create.rb +52 -1
- data/lib/facet/file/self/open_as_string.rb +81 -1
- data/lib/facet/file/self/read_list.rb +47 -1
- data/lib/facet/file/self/sanitize.rb +50 -1
- data/lib/facet/file/self/split_all.rb +36 -1
- data/lib/facet/fileutils.rb +0 -1
- data/lib/facet/fileutils/head.rb +2 -1
- data/lib/facet/fileutils/safe_ln.rb +38 -1
- data/lib/facet/fileutils/slice.rb +152 -1
- data/lib/facet/fileutils/split_all.rb +29 -1
- data/lib/facet/fileutils/tail.rb +2 -1
- data/lib/facet/fileutils/wc.rb +128 -1
- data/lib/facet/fileutils/whereis.rb +76 -1
- data/lib/facet/fileutils/which.rb +117 -1
- data/lib/facet/float.rb +3 -1
- data/lib/facet/float/approx.rb +42 -1
- data/lib/facet/float/round_at.rb +72 -1
- data/lib/facet/float/round_to.rb +73 -1
- data/lib/facet/hash.rb +40 -1
- data/lib/facet/hash/alias.rb +54 -1
- data/lib/facet/hash/assert_has_keys.rb +38 -1
- data/lib/facet/hash/assert_has_only_keys.rb +38 -1
- data/lib/facet/hash/at.rb +26 -1
- data/lib/facet/hash/collate.rb +53 -1
- data/lib/facet/hash/delete_unless.rb +15 -1
- data/lib/facet/hash/each.rb +61 -1
- data/lib/facet/hash/each_with_index.rb +35 -1
- data/lib/facet/hash/each_with_key.rb +32 -1
- data/lib/facet/hash/graph.rb +31 -1
- data/lib/facet/hash/has_keys.rb +37 -1
- data/lib/facet/hash/has_only_keys.rb +37 -1
- data/lib/facet/hash/inverse.rb +51 -1
- data/lib/facet/hash/join.rb +19 -1
- data/lib/facet/hash/keys_to_iv.rb +60 -1
- data/lib/facet/hash/keys_to_s.rb +80 -1
- data/lib/facet/hash/keys_to_sym.rb +91 -1
- data/lib/facet/hash/op_fetch.rb +146 -1
- data/lib/facet/hash/op_lshift.rb +28 -1
- data/lib/facet/hash/op_store.rb +2 -1
- data/lib/facet/hash/rand_key.rb +47 -1
- data/lib/facet/hash/rand_pair.rb +50 -1
- data/lib/facet/hash/rand_value.rb +60 -1
- data/lib/facet/hash/replace_each.rb +33 -1
- data/lib/facet/hash/self/zipnew.rb +37 -1
- data/lib/facet/hash/shuffle.rb +53 -1
- data/lib/facet/hash/slice.rb +33 -1
- data/lib/facet/hash/stringify_keys.rb +2 -1
- data/lib/facet/hash/swap.rb +36 -1
- data/lib/facet/hash/swapkey.rb +44 -1
- data/lib/facet/hash/symoblize_keys.rb +2 -1
- data/lib/facet/hash/to_h.rb +35 -1
- data/lib/facet/hash/to_ostruct.rb +40 -1
- data/lib/facet/hash/to_ostruct_recurse.rb +45 -1
- data/lib/facet/hash/traverse.rb +63 -1
- data/lib/facet/hash/update_each.rb +43 -1
- data/lib/facet/hash/update_keys.rb +31 -1
- data/lib/facet/hash/update_values.rb +32 -1
- data/lib/facet/hash/variablize_keys.rb +2 -1
- data/lib/facet/hash/weave.rb +88 -1
- data/lib/facet/integer.rb +8 -1
- data/lib/facet/integer/even.rb +2 -1
- data/lib/facet/integer/fac.rb +2 -0
- data/lib/facet/integer/fact.rb +2 -1
- data/lib/facet/integer/factorial.rb +61 -1
- data/lib/facet/integer/multiple.rb +69 -1
- data/lib/facet/integer/odd.rb +2 -1
- data/lib/facet/integer/ordinal.rb +41 -1
- data/lib/facet/integer/times_collect.rb +39 -1
- data/lib/facet/integer/times_map.rb +2 -1
- data/lib/facet/kernel.rb +65 -1
- data/lib/facet/kernel/__DIR__.rb +11 -0
- data/lib/facet/kernel/__class__.rb +31 -1
- data/lib/facet/kernel/__meta__.rb +28 -1
- data/lib/facet/kernel/adhoc.rb +11 -0
- data/lib/facet/kernel/as.rb +91 -1
- data/lib/facet/kernel/assign_from.rb +82 -1
- data/lib/facet/kernel/assign_with.rb +75 -1
- data/lib/facet/kernel/autoreload.rb +46 -1
- data/lib/facet/kernel/autoreload_glob.rb +36 -1
- data/lib/facet/kernel/bool.rb +77 -1
- data/lib/facet/kernel/bug.rb +39 -1
- data/lib/facet/kernel/call_stack.rb +59 -1
- data/lib/facet/kernel/called.rb +40 -1
- data/lib/facet/kernel/complete.rb +6 -1
- data/lib/facet/kernel/constant.rb +52 -1
- data/lib/facet/kernel/copy.rb +48 -1
- data/lib/facet/kernel/deep_copy.rb +49 -1
- data/lib/facet/kernel/demo.rb +46 -1
- data/lib/facet/kernel/eigenclass.rb +17 -1
- data/lib/facet/kernel/false.rb +2 -1
- data/lib/facet/kernel/fn.rb +33 -1
- data/lib/facet/kernel/generate_method_name.rb +39 -1
- data/lib/facet/kernel/get_by_id.rb +33 -1
- data/lib/facet/kernel/here.rb +34 -1
- data/lib/facet/kernel/in.rb +35 -1
- data/lib/facet/kernel/instance_assign.rb +25 -1
- data/lib/facet/kernel/instvar.rb +13 -1
- data/lib/facet/kernel/is.rb +5 -1
- data/lib/facet/kernel/maybe.rb +41 -1
- data/lib/facet/kernel/me.rb +17 -1
- data/lib/facet/kernel/meta.rb +2 -1
- data/lib/facet/kernel/metaclass.rb +42 -1
- data/lib/facet/kernel/method.rb +76 -1
- data/lib/facet/kernel/method_name.rb +49 -1
- data/lib/facet/kernel/methods.rb +79 -1
- data/lib/facet/kernel/nack.rb +12 -1
- data/lib/facet/kernel/new.rb +40 -1
- data/lib/facet/kernel/object_class.rb +31 -1
- data/lib/facet/kernel/object_hexid.rb +35 -1
- data/lib/facet/kernel/op_esc.rb +37 -1
- data/lib/facet/kernel/own.rb +17 -1
- data/lib/facet/kernel/p.rb +12 -1
- data/lib/facet/kernel/require_all.rb +44 -1
- data/lib/facet/kernel/require_esc.rb +42 -1
- data/lib/facet/kernel/require_facet.rb +41 -1
- data/lib/facet/kernel/require_local.rb +25 -1
- data/lib/facet/kernel/resc.rb +32 -1
- data/lib/facet/kernel/returning.rb +49 -1
- data/lib/facet/kernel/send_as.rb +34 -1
- data/lib/facet/kernel/set_from.rb +69 -1
- data/lib/facet/kernel/set_with.rb +74 -1
- data/lib/facet/kernel/silence_warnings.rb +2 -1
- data/lib/facet/kernel/silently.rb +41 -1
- data/lib/facet/kernel/singleton.rb +47 -1
- data/lib/facet/kernel/superior.rb +53 -1
- data/lib/facet/kernel/supermethod.rb +44 -1
- data/lib/facet/kernel/this.rb +33 -1
- data/lib/facet/kernel/to_b.rb +41 -1
- data/lib/facet/kernel/to_bool.rb +47 -1
- data/lib/facet/kernel/true.rb +2 -1
- data/lib/facet/kernel/unuri.rb +2 -1
- data/lib/facet/kernel/uri.rb +38 -1
- data/lib/facet/kernel/val.rb +52 -1
- data/lib/facet/kernel/warn_with_line.rb +30 -1
- data/lib/facet/kernel/with_accessor.rb +94 -1
- data/lib/facet/kernel/with_reader.rb +2 -1
- data/lib/facet/kernel/with_writer.rb +2 -1
- data/lib/facet/logger.rb +0 -1
- data/lib/facet/logger/format.rb +28 -1
- data/lib/facet/logger/format_message.rb +1 -1
- data/lib/facet/matchdata.rb +3 -1
- data/lib/facet/matchdata/match.rb +37 -1
- data/lib/facet/matchdata/matchset.rb +2 -1
- data/lib/facet/matchdata/matchtree.rb +62 -1
- data/lib/facet/module.rb +40 -1
- data/lib/facet/module/abstract.rb +50 -1
- data/lib/facet/module/alias_module_function.rb +57 -1
- data/lib/facet/module/ancestor.rb +38 -1
- data/lib/facet/module/attr.rb +23 -1
- data/lib/facet/module/attr_setter.rb +48 -1
- data/lib/facet/module/attr_tester.rb +56 -1
- data/lib/facet/module/basename.rb +39 -1
- data/lib/facet/module/by_name.rb +68 -1
- data/lib/facet/module/cattr_accessor.rb +141 -1
- data/lib/facet/module/cattr_reader.rb +2 -1
- data/lib/facet/module/cattr_writer.rb +2 -1
- data/lib/facet/module/clone_removing.rb +2 -1
- data/lib/facet/module/clone_renaming.rb +2 -1
- data/lib/facet/module/clone_using.rb +87 -1
- data/lib/facet/module/dirname.rb +42 -1
- data/lib/facet/module/equate_on.rb +70 -1
- data/lib/facet/module/generate_instance_method_name.rb +47 -1
- data/lib/facet/module/include_as.rb +102 -1
- data/lib/facet/module/initializer.rb +65 -1
- data/lib/facet/module/instance_methods.rb +186 -1
- data/lib/facet/module/integrate.rb +51 -1
- data/lib/facet/module/is.rb +34 -1
- data/lib/facet/module/memoize.rb +95 -1
- data/lib/facet/module/modspace.rb +43 -1
- data/lib/facet/module/namespace.rb +61 -1
- data/lib/facet/module/nesting.rb +45 -1
- data/lib/facet/module/redef.rb +31 -1
- data/lib/facet/module/redefine_method.rb +57 -1
- data/lib/facet/module/redirect.rb +30 -1
- data/lib/facet/module/redirect_method.rb +64 -1
- data/lib/facet/module/remove.rb +29 -1
- data/lib/facet/module/rename.rb +31 -1
- data/lib/facet/module/rename_method.rb +38 -1
- data/lib/facet/module/revisal.rb +49 -1
- data/lib/facet/module/shadow_all.rb +17 -1
- data/lib/facet/module/shadow_method.rb +42 -1
- data/lib/facet/module/sort_on.rb +73 -1
- data/lib/facet/module/undef.rb +29 -1
- data/lib/facet/module/wrap.rb +30 -1
- data/lib/facet/module/wrap_method.rb +48 -1
- data/lib/facet/nilclass.rb +7 -1
- data/lib/facet/nilclass/empty.rb +32 -1
- data/lib/facet/nilclass/include.rb +32 -1
- data/lib/facet/nilclass/length.rb +2 -1
- data/lib/facet/nilclass/op_fetch.rb +37 -1
- data/lib/facet/nilclass/size.rb +44 -1
- data/lib/facet/nilclass/to_f.rb +32 -1
- data/lib/facet/nilclass/to_h.rb +33 -1
- data/lib/facet/numeric.rb +5 -1
- data/lib/facet/numeric/ceil_multiple.rb +40 -1
- data/lib/facet/numeric/pred.rb +2 -1
- data/lib/facet/numeric/succ.rb +69 -1
- data/lib/facet/numeric/to_b.rb +38 -1
- data/lib/facet/ostruct.rb +0 -1
- data/lib/facet/ostruct/__merge__.rb +52 -1
- data/lib/facet/ostruct/__table__.rb +17 -1
- data/lib/facet/ostruct/__update__.rb +45 -1
- data/lib/facet/ostruct/op_fetch.rb +40 -1
- data/lib/facet/ostruct/op_store.rb +42 -1
- data/lib/facet/ostruct/to_h.rb +8 -1
- data/lib/facet/pathname.rb +2 -1
- data/lib/facet/pathname/ascend.rb +22 -1
- data/lib/facet/pathname/descend.rb +20 -1
- data/lib/facet/proc.rb +3 -1
- data/lib/facet/proc/compose.rb +62 -1
- data/lib/facet/proc/op_mul.rb +2 -1
- data/lib/facet/proc/to_method.rb +74 -1
- data/lib/facet/range.rb +4 -1
- data/lib/facet/range/to_r.rb +32 -1
- data/lib/facet/range/to_range.rb +36 -1
- data/lib/facet/range/umbrella.rb +67 -1
- data/lib/facet/range/within.rb +44 -1
- data/lib/facet/regexp.rb +3 -1
- data/lib/facet/regexp/arity.rb +41 -1
- data/lib/facet/regexp/to_re.rb +38 -1
- data/lib/facet/regexp/to_regexp.rb +36 -1
- data/lib/facet/string.rb +86 -1
- data/lib/facet/string/align_center.rb +87 -1
- data/lib/facet/string/align_left.rb +2 -1
- data/lib/facet/string/align_right.rb +2 -1
- data/lib/facet/string/at.rb +8 -1
- data/lib/facet/string/at_rand.rb +65 -1
- data/lib/facet/string/basename.rb +48 -1
- data/lib/facet/string/blank.rb +36 -1
- data/lib/facet/string/bracket.rb +70 -1
- data/lib/facet/string/brief.rb +33 -1
- data/lib/facet/string/bytes.rb +19 -1
- data/lib/facet/string/camelcase.rb +58 -1
- data/lib/facet/string/camelize.rb +35 -1
- data/lib/facet/string/capitalized.rb +38 -1
- data/lib/facet/string/chars.rb +34 -1
- data/lib/facet/string/cmp.rb +43 -1
- data/lib/facet/string/demodulize.rb +40 -1
- data/lib/facet/string/dequote.rb +29 -1
- data/lib/facet/string/downcase.rb +37 -1
- data/lib/facet/string/dresner.rb +49 -1
- data/lib/facet/string/each_char.rb +35 -1
- data/lib/facet/string/each_word.rb +50 -1
- data/lib/facet/string/ends_with.rb +2 -1
- data/lib/facet/string/first.rb +94 -1
- data/lib/facet/string/first_char.rb +20 -1
- data/lib/facet/string/fold.rb +67 -1
- data/lib/facet/string/format.rb +17 -1
- data/lib/facet/string/frequency.rb +39 -1
- data/lib/facet/string/humanize.rb +31 -1
- data/lib/facet/string/indent.rb +68 -1
- data/lib/facet/string/index_all.rb +40 -1
- data/lib/facet/string/last.rb +94 -1
- data/lib/facet/string/last_char.rb +22 -1
- data/lib/facet/string/line_wrap.rb +77 -1
- data/lib/facet/string/lines.rb +33 -1
- data/lib/facet/string/lowercase.rb +32 -1
- data/lib/facet/string/margin.rb +138 -1
- data/lib/facet/string/mscan.rb +42 -1
- data/lib/facet/string/natcmp.rb +108 -1
- data/lib/facet/string/nchar.rb +45 -1
- data/lib/facet/string/ordinal.rb +16 -1
- data/lib/facet/string/plural.rb +2 -1
- data/lib/facet/string/pop.rb +54 -1
- data/lib/facet/string/probability.rb +34 -1
- data/lib/facet/string/pull.rb +17 -1
- data/lib/facet/string/push.rb +44 -1
- data/lib/facet/string/quote.rb +68 -1
- data/lib/facet/string/rand_byte.rb +55 -1
- data/lib/facet/string/rand_index.rb +29 -1
- data/lib/facet/string/range.rb +37 -1
- data/lib/facet/string/range_all.rb +48 -1
- data/lib/facet/string/range_of_line.rb +42 -1
- data/lib/facet/string/regesc.rb +32 -0
- data/lib/facet/string/self/format.rb +17 -1
- data/lib/facet/string/self/interpolate.rb +31 -1
- data/lib/facet/string/self/patterns.rb +51 -1
- data/lib/facet/string/self/rand_letter.rb +34 -1
- data/lib/facet/string/self/random.rb +36 -1
- data/lib/facet/string/shatter.rb +45 -1
- data/lib/facet/string/shift.rb +42 -1
- data/lib/facet/string/shuffle.rb +42 -1
- data/lib/facet/string/similarity.rb +108 -1
- data/lib/facet/string/singular.rb +117 -1
- data/lib/facet/string/slap.rb +44 -1
- data/lib/facet/string/soundex.rb +102 -1
- data/lib/facet/string/starts_with.rb +24 -1
- data/lib/facet/string/succ.rb +38 -1
- data/lib/facet/string/tab.rb +2 -1
- data/lib/facet/string/tabto.rb +2 -1
- data/lib/facet/string/to_a.rb +35 -1
- data/lib/facet/string/to_arr.rb +55 -1
- data/lib/facet/string/to_b.rb +64 -1
- data/lib/facet/string/to_const.rb +39 -1
- data/lib/facet/string/to_date.rb +35 -1
- data/lib/facet/string/to_proc.rb +54 -1
- data/lib/facet/string/to_re.rb +46 -1
- data/lib/facet/string/to_rx.rb +2 -0
- data/lib/facet/string/to_time.rb +34 -1
- data/lib/facet/string/unbracket.rb +46 -1
- data/lib/facet/string/underscore.rb +18 -1
- data/lib/facet/string/unix_crypt.rb +41 -1
- data/lib/facet/string/unpack.rb +45 -1
- data/lib/facet/string/unshift.rb +42 -1
- data/lib/facet/string/upcase.rb +45 -1
- data/lib/facet/string/uppercase.rb +2 -1
- data/lib/facet/string/whitespace.rb +27 -1
- data/lib/facet/string/word_filter.rb +61 -1
- data/lib/facet/string/word_wrap.rb +90 -1
- data/lib/facet/string/words.rb +45 -1
- data/lib/facet/symbol.rb +13 -1
- data/lib/facet/symbol/camelcase.rb +42 -1
- data/lib/facet/symbol/camelize.rb +33 -1
- data/lib/facet/symbol/capitalize.rb +31 -1
- data/lib/facet/symbol/capitalized.rb +33 -1
- data/lib/facet/symbol/downcase.rb +36 -1
- data/lib/facet/symbol/not.rb +40 -1
- data/lib/facet/symbol/pad.rb +43 -1
- data/lib/facet/symbol/succ.rb +42 -1
- data/lib/facet/symbol/to_const.rb +40 -1
- data/lib/facet/symbol/to_proc.rb +45 -1
- data/lib/facet/symbol/to_str.rb +39 -1
- data/lib/facet/symbol/underscore.rb +32 -1
- data/lib/facet/symbol/upcase.rb +37 -1
- data/lib/facet/time.rb +7 -1
- data/lib/facet/time/change.rb +51 -1
- data/lib/facet/time/elapse.rb +41 -1
- data/lib/facet/time/self/days_extrema.rb +22 -1
- data/lib/facet/time/stamp.rb +47 -1
- data/lib/facet/time/to_date.rb +37 -1
- data/lib/facet/time/to_s.rb +33 -1
- data/lib/facet/time/to_time.rb +36 -1
- data/lib/facet/unboundmethod.rb +1 -1
- data/lib/facet/unboundmethod/name.rb +8 -1
- data/lib/facets.rb +135 -154
- data/lib/facets/english/bytes.rb +212 -0
- data/lib/facets/english/multipliers.rb +192 -0
- data/lib/facets/english/ormsupport.rb +233 -0
- data/lib/facets/english/time.rb +327 -0
- data/lib/facets/group/inflect.rb +71 -0
- data/lib/facets/group/nilasemptiness.rb +34 -0
- data/lib/facets/group/random.rb +21 -0
- data/lib/facets/group/stringasarray.rb +16 -0
- data/lib/facets/method/README +1 -0
- data/lib/facets/support/functor.rb +49 -0
- data/test/lib/facet/array/test_at_rand.rb +34 -0
- data/test/lib/facet/array/test_delete_unless.rb +28 -0
- data/test/lib/facet/array/test_delete_values.rb +28 -0
- data/test/lib/facet/array/test_delete_values_at.rb +31 -0
- data/test/lib/facet/array/test_first.rb +46 -0
- data/test/lib/facet/array/test_head.rb +42 -0
- data/test/lib/facet/array/test_last_index.rb +26 -0
- data/test/lib/facet/array/test_merge.rb +35 -0
- data/test/lib/facet/array/test_mid.rb +33 -0
- data/test/lib/facet/array/test_middle.rb +29 -0
- data/test/lib/facet/array/test_op_fetch.rb +27 -0
- data/test/lib/facet/array/test_op_store.rb +30 -0
- data/test/lib/facet/array/test_pick.rb +40 -0
- data/test/lib/facet/array/test_pos.rb +28 -0
- data/test/lib/facet/array/test_pull.rb +28 -0
- data/test/lib/facet/array/test_rand_index.rb +29 -0
- data/test/lib/facet/array/test_rand_subset.rb +29 -0
- data/test/lib/facet/array/test_range.rb +32 -0
- data/test/lib/facet/array/test_rotate.rb +36 -0
- data/test/lib/facet/array/test_select.rb +28 -0
- data/test/lib/facet/array/test_shuffle.rb +35 -0
- data/test/lib/facet/array/test_slap.rb +28 -0
- data/test/lib/facet/array/test_thru.rb +27 -0
- data/test/lib/facet/array/test_to_b.rb +27 -0
- data/test/lib/facet/array/test_to_h.rb +33 -0
- data/test/lib/facet/array/test_to_hash.rb +27 -0
- data/test/lib/facet/binding/self/test_of_caller.rb +35 -0
- data/test/lib/facet/binding/test___LINE__.rb +43 -0
- data/test/lib/facet/binding/test_call_stack.rb +34 -0
- data/test/lib/facet/binding/test_called.rb +30 -0
- data/test/lib/facet/binding/test_caller.rb +35 -0
- data/test/lib/facet/binding/test_defined.rb +34 -0
- data/test/lib/facet/binding/test_eval.rb +34 -0
- data/test/lib/facet/binding/test_local_variables.rb +34 -0
- data/test/lib/facet/binding/test_method_name.rb +34 -0
- data/test/lib/facet/binding/test_op_fetch.rb +34 -0
- data/test/lib/facet/binding/test_op_store.rb +35 -0
- data/test/lib/facet/binding/test_self.rb +34 -0
- data/test/lib/facet/class/test_descendents.rb +30 -0
- data/test/lib/facet/class/test_remove_descendents.rb +32 -0
- data/test/lib/facet/comparable/test_at_least.rb +34 -0
- data/test/lib/facet/comparable/test_clip.rb +44 -0
- data/test/lib/facet/comparable/test_cmp.rb +28 -0
- data/test/lib/facet/continuation/self/test_create.rb +26 -0
- data/test/lib/facet/date/test_days_in_month.rb +30 -0
- data/test/lib/facet/date/test_days_of_month.rb +30 -0
- data/test/lib/facet/date/test_stamp.rb +38 -0
- data/test/lib/facet/date/test_to_date.rb +30 -0
- data/test/lib/facet/date/test_to_s.rb +30 -0
- data/test/lib/facet/date/test_to_time.rb +30 -0
- data/test/lib/facet/dir/self/test_ancestor.rb +26 -0
- data/test/lib/facet/dir/self/test_ascend.rb +41 -0
- data/test/lib/facet/dir/self/test_ls_r.rb +52 -0
- data/test/lib/facet/enumerable/self/test_combinations.rb +43 -0
- data/test/lib/facet/enumerable/self/test_cross.rb +31 -0
- data/test/lib/facet/enumerable/test_collect_with_index.rb +27 -0
- data/test/lib/facet/enumerable/test_commonality.rb +31 -0
- data/test/lib/facet/enumerable/test_compact_collect.rb +27 -0
- data/test/lib/facet/enumerable/test_cross.rb +30 -0
- data/test/lib/facet/enumerable/test_each_combination.rb +29 -0
- data/test/lib/facet/enumerable/test_each_pair.rb +29 -0
- data/test/lib/facet/enumerable/test_each_slice.rb +74 -0
- data/test/lib/facet/enumerable/test_each_unique_pair.rb +29 -0
- data/test/lib/facet/enumerable/test_entropy.rb +26 -0
- data/test/lib/facet/enumerable/test_every.rb +35 -0
- data/test/lib/facet/enumerable/test_ew.rb +31 -0
- data/test/lib/facet/enumerable/test_filter_collect.rb +31 -0
- data/test/lib/facet/enumerable/test_find_collisions.rb +30 -0
- data/test/lib/facet/enumerable/test_frequency.rb +27 -0
- data/test/lib/facet/enumerable/test_graph.rb +30 -0
- data/test/lib/facet/enumerable/test_ideal_entropy.rb +27 -0
- data/test/lib/facet/enumerable/test_none.rb +33 -0
- data/test/lib/facet/enumerable/test_occur.rb +30 -0
- data/test/lib/facet/enumerable/test_one.rb +35 -0
- data/test/lib/facet/enumerable/test_op_pow.rb +27 -0
- data/test/lib/facet/enumerable/test_partition_by.rb +31 -0
- data/test/lib/facet/enumerable/test_permute.rb +29 -0
- data/test/lib/facet/enumerable/test_probability.rb +27 -0
- data/test/lib/facet/enumerable/test_to_h.rb +27 -0
- data/test/lib/facet/enumerable/test_uniq_by.rb +28 -0
- data/test/lib/facet/file/self/test_create.rb +39 -0
- data/test/lib/facet/file/self/test_open_as_string.rb +40 -0
- data/test/lib/facet/file/self/test_read_list.rb +37 -0
- data/test/lib/facet/file/self/test_sanitize.rb +46 -0
- data/test/lib/facet/file/self/test_split_all.rb +27 -0
- data/test/lib/facet/fileutils/test_slice.rb +96 -0
- data/test/lib/facet/fileutils/test_wc.rb +68 -0
- data/test/lib/facet/fileutils/test_which.rb +61 -0
- data/test/lib/facet/float/test_approx.rb +28 -0
- data/test/lib/facet/float/test_round_at.rb +46 -0
- data/test/lib/facet/float/test_round_to.rb +46 -0
- data/test/lib/facet/hash/self/test_zipnew.rb +28 -0
- data/test/lib/facet/hash/test_alias.rb +31 -0
- data/test/lib/facet/hash/test_assert_has_keys.rb +27 -0
- data/test/lib/facet/hash/test_assert_has_only_keys.rb +27 -0
- data/test/lib/facet/hash/test_at.rb +28 -0
- data/test/lib/facet/hash/test_collate.rb +35 -0
- data/test/lib/facet/hash/test_each.rb +36 -0
- data/test/lib/facet/hash/test_each_with_index.rb +29 -0
- data/test/lib/facet/hash/test_each_with_key.rb +29 -0
- data/test/lib/facet/hash/test_graph.rb +28 -0
- data/test/lib/facet/hash/test_has_keys.rb +27 -0
- data/test/lib/facet/hash/test_has_only_keys.rb +27 -0
- data/test/lib/facet/hash/test_inverse.rb +28 -0
- data/test/lib/facet/hash/test_keys_to_s.rb +34 -0
- data/test/lib/facet/hash/test_keys_to_sym.rb +34 -0
- data/test/lib/facet/hash/test_op_fetch.rb +111 -0
- data/test/lib/facet/hash/test_op_lshift.rb +29 -0
- data/test/lib/facet/hash/test_rand_key.rb +27 -0
- data/test/lib/facet/hash/test_rand_pair.rb +27 -0
- data/test/lib/facet/hash/test_rand_value.rb +27 -0
- data/test/lib/facet/hash/test_replace_each.rb +29 -0
- data/test/lib/facet/hash/test_shuffle.rb +32 -0
- data/test/lib/facet/hash/test_slice.rb +27 -0
- data/test/lib/facet/hash/test_swap.rb +27 -0
- data/test/lib/facet/hash/test_swapkey.rb +29 -0
- data/test/lib/facet/hash/test_to_h.rb +27 -0
- data/test/lib/facet/hash/test_to_ostruct.rb +30 -0
- data/test/lib/facet/hash/test_to_ostruct_recurse.rb +30 -0
- data/test/lib/facet/hash/test_traverse.rb +37 -0
- data/test/lib/facet/hash/test_update_each.rb +29 -0
- data/test/lib/facet/hash/test_update_keys.rb +28 -0
- data/test/lib/facet/hash/test_update_values.rb +28 -0
- data/test/lib/facet/hash/test_weave.rb +29 -0
- data/test/lib/facet/integer/test_factorial.rb +30 -0
- data/test/lib/facet/integer/test_multiple.rb +43 -0
- data/test/lib/facet/integer/test_ordinal.rb +29 -0
- data/test/lib/facet/integer/test_times_collect.rb +28 -0
- data/test/lib/facet/kernel/test___class__.rb +26 -0
- data/test/lib/facet/kernel/test_as.rb +42 -0
- data/test/lib/facet/kernel/test_assign_from.rb +31 -0
- data/test/lib/facet/kernel/test_assign_with.rb +31 -0
- data/test/lib/facet/kernel/test_bool.rb +41 -0
- data/test/lib/facet/kernel/test_bug.rb +26 -0
- data/test/lib/facet/kernel/test_call_stack.rb +26 -0
- data/test/lib/facet/kernel/test_called.rb +26 -0
- data/test/lib/facet/kernel/test_constant.rb +33 -0
- data/test/lib/facet/kernel/test_copy.rb +40 -0
- data/test/lib/facet/kernel/test_deep_copy.rb +40 -0
- data/test/lib/facet/kernel/test_demo.rb +28 -0
- data/test/lib/facet/kernel/test_fn.rb +26 -0
- data/test/lib/facet/kernel/test_generate_method_name.rb +26 -0
- data/test/lib/facet/kernel/test_get_by_id.rb +28 -0
- data/test/lib/facet/kernel/test_here.rb +26 -0
- data/test/lib/facet/kernel/test_in.rb +27 -0
- data/test/lib/facet/kernel/test_maybe.rb +26 -0
- data/test/lib/facet/kernel/test_metaclass.rb +34 -0
- data/test/lib/facet/kernel/test_method.rb +32 -0
- data/test/lib/facet/kernel/test_method_name.rb +31 -0
- data/test/lib/facet/kernel/test_methods.rb +50 -0
- data/test/lib/facet/kernel/test_new.rb +30 -0
- data/test/lib/facet/kernel/test_object_class.rb +26 -0
- data/test/lib/facet/kernel/test_object_hexid.rb +27 -0
- data/test/lib/facet/kernel/test_require_all.rb +26 -0
- data/test/lib/facet/kernel/test_require_esc.rb +27 -0
- data/test/lib/facet/kernel/test_require_facet.rb +27 -0
- data/test/lib/facet/kernel/test_resc.rb +27 -0
- data/test/lib/facet/kernel/test_returning.rb +30 -0
- data/test/lib/facet/kernel/test_send_as.rb +26 -0
- data/test/lib/facet/kernel/test_set_from.rb +33 -0
- data/test/lib/facet/kernel/test_set_with.rb +33 -0
- data/test/lib/facet/kernel/test_silently.rb +28 -0
- data/test/lib/facet/kernel/test_singleton.rb +40 -0
- data/test/lib/facet/kernel/test_superior.rb +30 -0
- data/test/lib/facet/kernel/test_supermethod.rb +33 -0
- data/test/lib/facet/kernel/test_this.rb +26 -0
- data/test/lib/facet/kernel/test_to_b.rb +28 -0
- data/test/lib/facet/kernel/test_to_bool.rb +28 -0
- data/test/lib/facet/kernel/test_uri.rb +30 -0
- data/test/lib/facet/kernel/test_val.rb +43 -0
- data/test/lib/facet/kernel/test_with_accessor.rb +51 -0
- data/test/lib/facet/matchdata/test_match.rb +29 -0
- data/test/lib/facet/matchdata/test_matchtree.rb +32 -0
- data/test/lib/facet/module/test_abstract.rb +36 -0
- data/test/lib/facet/module/test_alias_module_function.rb +34 -0
- data/test/lib/facet/module/test_ancestor.rb +26 -0
- data/test/lib/facet/module/test_basename.rb +26 -0
- data/test/lib/facet/module/test_by_name.rb +29 -0
- data/test/lib/facet/module/test_cattr_accessor.rb +55 -0
- data/test/lib/facet/module/test_clone_using.rb +55 -0
- data/test/lib/facet/module/test_dirname.rb +26 -0
- data/test/lib/facet/module/test_equate_on.rb +37 -0
- data/test/lib/facet/module/test_generate_instance_method_name.rb +33 -0
- data/test/lib/facet/module/test_include_as.rb +35 -0
- data/test/lib/facet/module/test_initializer.rb +32 -0
- data/test/lib/facet/module/test_instance_methods.rb +59 -0
- data/test/lib/facet/module/test_integrate.rb +35 -0
- data/test/lib/facet/module/test_memoize.rb +50 -0
- data/test/lib/facet/module/test_modspace.rb +27 -0
- data/test/lib/facet/module/test_namespace.rb +33 -0
- data/test/lib/facet/module/test_nesting.rb +36 -0
- data/test/lib/facet/module/test_redef.rb +30 -0
- data/test/lib/facet/module/test_redefine_method.rb +30 -0
- data/test/lib/facet/module/test_redirect.rb +30 -0
- data/test/lib/facet/module/test_redirect_method.rb +30 -0
- data/test/lib/facet/module/test_remove.rb +30 -0
- data/test/lib/facet/module/test_rename.rb +31 -0
- data/test/lib/facet/module/test_rename_method.rb +31 -0
- data/test/lib/facet/module/test_revisal.rb +35 -0
- data/test/lib/facet/module/test_shadow_method.rb +30 -0
- data/test/lib/facet/module/test_sort_on.rb +42 -0
- data/test/lib/facet/module/test_undef.rb +30 -0
- data/test/lib/facet/module/test_wrap.rb +30 -0
- data/test/lib/facet/module/test_wrap_method.rb +30 -0
- data/test/lib/facet/nilclass/test_empty.rb +26 -0
- data/test/lib/facet/nilclass/test_include.rb +26 -0
- data/test/lib/facet/nilclass/test_op_fetch.rb +28 -0
- data/test/lib/facet/nilclass/test_size.rb +30 -0
- data/test/lib/facet/nilclass/test_to_f.rb +26 -0
- data/test/lib/facet/nilclass/test_to_h.rb +26 -0
- data/test/lib/facet/numeric/test_ceil_multiple.rb +31 -0
- data/test/lib/facet/numeric/test_succ.rb +40 -0
- data/test/lib/facet/numeric/test_to_b.rb +27 -0
- data/test/lib/facet/ostruct/test___merge__.rb +38 -0
- data/test/lib/facet/ostruct/test___update__.rb +29 -0
- data/test/lib/facet/ostruct/test_op_fetch.rb +27 -0
- data/test/lib/facet/ostruct/test_op_store.rb +28 -0
- data/test/lib/facet/proc/test_compose.rb +36 -0
- data/test/lib/facet/proc/test_to_method.rb +31 -0
- data/test/lib/facet/range/test_to_r.rb +27 -0
- data/test/lib/facet/range/test_to_range.rb +27 -0
- data/test/lib/facet/range/test_umbrella.rb +34 -0
- data/test/lib/facet/range/test_within.rb +29 -0
- data/test/lib/facet/regexp/test_arity.rb +33 -0
- data/test/lib/facet/regexp/test_to_re.rb +27 -0
- data/test/lib/facet/regexp/test_to_regexp.rb +27 -0
- data/test/lib/facet/string/self/test_interpolate.rb +27 -0
- data/test/lib/facet/string/self/test_patterns.rb +28 -0
- data/test/lib/facet/string/self/test_rand_letter.rb +26 -0
- data/test/lib/facet/string/test_align_center.rb +34 -0
- data/test/lib/facet/string/test_at_rand.rb +35 -0
- data/test/lib/facet/string/test_basename.rb +41 -0
- data/test/lib/facet/string/test_blank.rb +27 -0
- data/test/lib/facet/string/test_bracket.rb +49 -0
- data/test/lib/facet/string/test_camelcase.rb +39 -0
- data/test/lib/facet/string/test_camelize.rb +26 -0
- data/test/lib/facet/string/test_capitalized.rb +26 -0
- data/test/lib/facet/string/test_chars.rb +27 -0
- data/test/lib/facet/string/test_cmp.rb +30 -0
- data/test/lib/facet/string/test_demodulize.rb +38 -0
- data/test/lib/facet/string/test_downcase.rb +26 -0
- data/test/lib/facet/string/test_dresner.rb +32 -0
- data/test/lib/facet/string/test_each_char.rb +29 -0
- data/test/lib/facet/string/test_each_word.rb +29 -0
- data/test/lib/facet/string/test_first.rb +43 -0
- data/test/lib/facet/string/test_fold.rb +34 -0
- data/test/lib/facet/string/test_frequency.rb +28 -0
- data/test/lib/facet/string/test_humanize.rb +26 -0
- data/test/lib/facet/string/test_indent.rb +40 -0
- data/test/lib/facet/string/test_index_all.rb +26 -0
- data/test/lib/facet/string/test_last.rb +46 -0
- data/test/lib/facet/string/test_line_wrap.rb +27 -0
- data/test/lib/facet/string/test_lines.rb +26 -0
- data/test/lib/facet/string/test_lowercase.rb +26 -0
- data/test/lib/facet/string/test_margin.rb +117 -0
- data/test/lib/facet/string/test_mscan.rb +30 -0
- data/test/lib/facet/string/test_natcmp.rb +30 -0
- data/test/lib/facet/string/test_nchar.rb +29 -0
- data/test/lib/facet/string/test_pop.rb +47 -0
- data/test/lib/facet/string/test_probability.rb +28 -0
- data/test/lib/facet/string/test_push.rb +40 -0
- data/test/lib/facet/string/test_quote.rb +49 -0
- data/test/lib/facet/string/test_rand_byte.rb +35 -0
- data/test/lib/facet/string/test_rand_index.rb +26 -0
- data/test/lib/facet/string/test_range.rb +27 -0
- data/test/lib/facet/string/test_range_all.rb +27 -0
- data/test/lib/facet/string/test_range_of_line.rb +28 -0
- data/test/lib/facet/string/test_regesc.rb +28 -0
- data/test/lib/facet/string/test_shatter.rb +29 -0
- data/test/lib/facet/string/test_shift.rb +40 -0
- data/test/lib/facet/string/test_shuffle.rb +27 -0
- data/test/lib/facet/string/test_similarity.rb +26 -0
- data/test/lib/facet/string/test_singular.rb +32 -0
- data/test/lib/facet/string/test_slap.rb +40 -0
- data/test/lib/facet/string/test_soundex.rb +41 -0
- data/test/lib/facet/string/test_succ.rb +29 -0
- data/test/lib/facet/string/test_to_a.rb +27 -0
- data/test/lib/facet/string/test_to_arr.rb +26 -0
- data/test/lib/facet/string/test_to_b.rb +41 -0
- data/test/lib/facet/string/test_to_const.rb +28 -0
- data/test/lib/facet/string/test_to_date.rb +30 -0
- data/test/lib/facet/string/test_to_proc.rb +33 -0
- data/test/lib/facet/string/test_to_re.rb +28 -0
- data/test/lib/facet/string/test_to_time.rb +30 -0
- data/test/lib/facet/string/test_unix_crypt.rb +30 -0
- data/test/lib/facet/string/test_unpack.rb +34 -0
- data/test/lib/facet/string/test_unshift.rb +39 -0
- data/test/lib/facet/string/test_upcase.rb +30 -0
- data/test/lib/facet/string/test_whitespace.rb +27 -0
- data/test/lib/facet/string/test_word_filter.rb +34 -0
- data/test/lib/facet/string/test_word_wrap.rb +51 -0
- data/test/lib/facet/string/test_words.rb +37 -0
- data/test/lib/facet/symbol/test_camelcase.rb +26 -0
- data/test/lib/facet/symbol/test_camelize.rb +27 -0
- data/test/lib/facet/symbol/test_capitalize.rb +26 -0
- data/test/lib/facet/symbol/test_capitalized.rb +27 -0
- data/test/lib/facet/symbol/test_downcase.rb +27 -0
- data/test/lib/facet/symbol/test_not.rb +29 -0
- data/test/lib/facet/symbol/test_pad.rb +27 -0
- data/test/lib/facet/symbol/test_succ.rb +28 -0
- data/test/lib/facet/symbol/test_to_const.rb +28 -0
- data/test/lib/facet/symbol/test_to_proc.rb +27 -0
- data/test/lib/facet/symbol/test_to_str.rb +28 -0
- data/test/lib/facet/symbol/test_underscore.rb +26 -0
- data/test/lib/facet/symbol/test_upcase.rb +27 -0
- data/test/lib/facet/time/test_change.rb +33 -0
- data/test/lib/facet/time/test_elapse.rb +27 -0
- data/test/lib/facet/time/test_stamp.rb +31 -0
- data/test/lib/facet/time/test_to_date.rb +31 -0
- data/test/lib/facet/time/test_to_s.rb +31 -0
- data/test/lib/facet/time/test_to_time.rb +31 -0
- data/test/lib/facets/english/test_bytes.rb +84 -0
- data/test/lib/facets/english/test_multipliers.rb +114 -0
- data/test/lib/facets/english/test_time.rb +73 -0
- metadata +895 -1625
- data/ANN +0 -59
- data/LICENSE/COPYING-GPL +0 -341
- data/LICENSE/LICENSE-ART +0 -50
- data/LICENSE/LICENSE-LGPL +0 -175
- data/LICENSE/LICENSE-MIT +0 -8
- data/LICENSE/LICENSE-RUBY +0 -60
- data/bench/b_calls.rb +0 -74
- data/bench/b_harray.rb +0 -49
- data/bench/b_pathname.rb +0 -24
- data/bench/b_range.rb +0 -64
- data/bench/return-bench.rb +0 -56
- data/bin/uri +0 -6
- data/conf/facets/extra +0 -7
- data/data/facets/units/binary/base.yaml +0 -12
- data/data/facets/units/binary/extra.yaml +0 -8
- data/data/facets/units/cex.yaml +0 -7
- data/data/facets/units/currency/base.yaml +0 -268
- data/data/facets/units/default.yaml +0 -22
- data/data/facets/units/dump_yaml.rb +0 -309
- data/data/facets/units/si/base.yaml +0 -36
- data/data/facets/units/si/derived.yaml +0 -133
- data/data/facets/units/si/extra.yaml +0 -107
- data/data/facets/units/standard.yaml +0 -5
- data/data/facets/units/uk.yaml +0 -16
- data/data/facets/units/uk/base.yaml +0 -107
- data/data/facets/units/us.yaml +0 -16
- data/data/facets/units/us/base.yaml +0 -112
- data/data/facets/units/xmethods/cached.yaml +0 -83
- data/data/facets/units/xmethods/mapping.yaml +0 -85
- data/demo/ann-demo.rb +0 -22
- data/lib/facet/all.rb +0 -1
- data/lib/facet/annotation.rb +0 -1
- data/lib/facet/ansicolor.rb +0 -1
- data/lib/facet/association.rb +0 -1
- data/lib/facet/base.rb +0 -1
- data/lib/facet/basicobject.rb +0 -1
- data/lib/facet/bbcode.rb +0 -1
- data/lib/facet/binary_multiplier.rb +0 -1
- data/lib/facet/binaryreader.rb +0 -1
- data/lib/facet/blankslate.rb +0 -1
- data/lib/facet/byteorder.rb +0 -1
- data/lib/facet/class_inherit.rb +0 -1
- data/lib/facet/classmethods.rb +0 -1
- data/lib/facet/cloneable.rb +0 -1
- data/lib/facet/constants.rb +0 -1
- data/lib/facet/coroutine.rb +0 -1
- data/lib/facet/crosscase.rb +0 -1
- data/lib/facet/crypt.rb +0 -1
- data/lib/facet/dictionary.rb +0 -1
- data/lib/facet/downloader.rb +0 -1
- data/lib/facet/dynamod.rb +0 -1
- data/lib/facet/enumerable_args.rb +0 -1
- data/lib/facet/enumtype.rb +0 -1
- data/lib/facet/expirable.rb +0 -1
- data/lib/facet/filelist.rb +0 -1
- data/lib/facet/fixnum_const.rb +0 -1
- data/lib/facet/floatstring.rb +0 -1
- data/lib/facet/functor.rb +0 -1
- data/lib/facet/harray.rb +0 -1
- data/lib/facet/heap.rb +0 -1
- data/lib/facet/infinity.rb +0 -1
- data/lib/facet/inflect.rb +0 -1
- data/lib/facet/inheritor.rb +0 -1
- data/lib/facet/interval.rb +0 -1
- data/lib/facet/ioreactor.rb +0 -1
- data/lib/facet/ioredirect.rb +0 -1
- data/lib/facet/lisp.rb +0 -1
- data/lib/facet/lru_cache.rb +0 -1
- data/lib/facet/methodprobe.rb +0 -1
- data/lib/facet/mock.rb +0 -1
- data/lib/facet/multiplier.rb +0 -1
- data/lib/facet/multiton.rb +0 -1
- data/lib/facet/nack.rb +0 -1
- data/lib/facet/nil_as_emptiness.rb +0 -1
- data/lib/facet/nilcomparable.rb +0 -1
- data/lib/facet/notcopyable.rb +0 -1
- data/lib/facet/null.rb +0 -1
- data/lib/facet/ohash.rb +0 -1
- data/lib/facet/one.rb +0 -1
- data/lib/facet/openobject.rb +0 -1
- data/lib/facet/orm_support.rb +0 -1
- data/lib/facet/ostructable.rb +0 -1
- data/lib/facet/package.rb +0 -1
- data/lib/facet/pool.rb +0 -1
- data/lib/facet/preinitialize.rb +0 -1
- data/lib/facet/progressbar.rb +0 -1
- data/lib/facet/promoteself.rb +0 -1
- data/lib/facet/proxy.rb +0 -1
- data/lib/facet/quicktest.rb +0 -1
- data/lib/facet/random.rb +0 -1
- data/lib/facet/reference.rb +0 -1
- data/lib/facet/semaphore.rb +0 -1
- data/lib/facet/shellcommand.rb +0 -1
- data/lib/facet/snapshot.rb +0 -1
- data/lib/facet/stateparser.rb +0 -1
- data/lib/facet/statichash.rb +0 -1
- data/lib/facet/string_as_array.rb +0 -1
- data/lib/facet/superstruct.rb +0 -1
- data/lib/facet/syncarray.rb +0 -1
- data/lib/facet/synchash.rb +0 -1
- data/lib/facet/tagiter.rb +0 -1
- data/lib/facet/template.rb +0 -1
- data/lib/facet/test.rb +0 -1
- data/lib/facet/time_in_english.rb +0 -1
- data/lib/facet/timer.rb +0 -1
- data/lib/facet/tracepoint.rb +0 -1
- data/lib/facet/tuple.rb +0 -1
- data/lib/facet/uninheritable.rb +0 -1
- data/lib/facet/units.rb +0 -1
- data/lib/facet/version.rb +0 -1
- data/lib/facet/yamlstruct.rb +0 -1
- data/lib/mega/annotation.rb +0 -568
- data/lib/mega/ansicolor.rb +0 -193
- data/lib/mega/association.rb +0 -174
- data/lib/mega/basicobject.rb +0 -108
- data/lib/mega/bbcode.rb +0 -410
- data/lib/mega/binary_multiplier.rb +0 -250
- data/lib/mega/binaryreader.rb +0 -210
- data/lib/mega/blankslate.rb +0 -3
- data/lib/mega/byteorder.rb +0 -119
- data/lib/mega/class_inherit.rb +0 -208
- data/lib/mega/classmethods.rb +0 -111
- data/lib/mega/cloneable.rb +0 -52
- data/lib/mega/constants.rb +0 -308
- data/lib/mega/coroutine.rb +0 -173
- data/lib/mega/crosscase.rb +0 -347
- data/lib/mega/crypt.rb +0 -167
- data/lib/mega/dictionary.rb +0 -340
- data/lib/mega/downloader.rb +0 -240
- data/lib/mega/dynamod.rb +0 -249
- data/lib/mega/enumerable_args.rb +0 -218
- data/lib/mega/enumtype.rb +0 -105
- data/lib/mega/expirable.rb +0 -88
- data/lib/mega/filelist.rb +0 -478
- data/lib/mega/fixnum_const.rb +0 -62
- data/lib/mega/floatstring.rb +0 -179
- data/lib/mega/functor.rb +0 -98
- data/lib/mega/harray.rb +0 -817
- data/lib/mega/heap.rb +0 -226
- data/lib/mega/infinity.rb +0 -123
- data/lib/mega/inheritor.rb +0 -236
- data/lib/mega/interval.rb +0 -426
- data/lib/mega/ioreactor.rb +0 -671
- data/lib/mega/ioredirect.rb +0 -130
- data/lib/mega/lisp.rb +0 -387
- data/lib/mega/lru_cache.rb +0 -184
- data/lib/mega/mock.rb +0 -224
- data/lib/mega/multiplier.rb +0 -180
- data/lib/mega/multiton.rb +0 -360
- data/lib/mega/nack.rb +0 -162
- data/lib/mega/nilcomparable.rb +0 -128
- data/lib/mega/notcopyable.rb +0 -146
- data/lib/mega/null.rb +0 -40
- data/lib/mega/ohash.rb +0 -3
- data/lib/mega/one.rb +0 -72
- data/lib/mega/openobject.rb +0 -220
- data/lib/mega/orm_support.rb +0 -233
- data/lib/mega/ostructable.rb +0 -212
- data/lib/mega/package.rb +0 -58
- data/lib/mega/pool.rb +0 -98
- data/lib/mega/preinitialize.rb +0 -152
- data/lib/mega/progressbar.rb +0 -214
- data/lib/mega/promoteself.rb +0 -104
- data/lib/mega/proxy.rb +0 -13
- data/lib/mega/reference.rb +0 -83
- data/lib/mega/semaphore.rb +0 -106
- data/lib/mega/shellcommand.rb +0 -55
- data/lib/mega/snapshot.rb +0 -190
- data/lib/mega/stateparser.rb +0 -576
- data/lib/mega/statichash.rb +0 -86
- data/lib/mega/superstruct.rb +0 -744
- data/lib/mega/syncarray.rb +0 -118
- data/lib/mega/synchash.rb +0 -173
- data/lib/mega/tagiter.rb +0 -389
- data/lib/mega/template.rb +0 -211
- data/lib/mega/time_in_english.rb +0 -347
- data/lib/mega/timer.rb +0 -293
- data/lib/mega/tracepoint.rb +0 -184
- data/lib/mega/tuple.rb +0 -97
- data/lib/mega/uninheritable.rb +0 -92
- data/lib/mega/units.rb +0 -926
- data/lib/mega/version.rb +0 -245
- data/lib/mega/yamlstruct.rb +0 -16
- data/lib/nano/all.rb +0 -18
- data/lib/nano/array.rb +0 -33
- data/lib/nano/array/at_rand.rb +0 -52
- data/lib/nano/array/body.rb +0 -35
- data/lib/nano/array/delete_unless.rb +0 -35
- data/lib/nano/array/delete_values.rb +0 -38
- data/lib/nano/array/delete_values_at.rb +0 -57
- data/lib/nano/array/each_with_key.rb +0 -9
- data/lib/nano/array/first.rb +0 -53
- data/lib/nano/array/foot.rb +0 -36
- data/lib/nano/array/head.rb +0 -36
- data/lib/nano/array/last.rb +0 -53
- data/lib/nano/array/last_index.rb +0 -35
- data/lib/nano/array/merge.rb +0 -40
- data/lib/nano/array/mid.rb +0 -50
- data/lib/nano/array/middle.rb +0 -45
- data/lib/nano/array/op_fetch.rb +0 -40
- data/lib/nano/array/op_store.rb +0 -47
- data/lib/nano/array/pick.rb +0 -68
- data/lib/nano/array/pos.rb +0 -39
- data/lib/nano/array/pull.rb +0 -37
- data/lib/nano/array/rand_index.rb +0 -30
- data/lib/nano/array/rand_subset.rb +0 -56
- data/lib/nano/array/range.rb +0 -47
- data/lib/nano/array/rotate.rb +0 -67
- data/lib/nano/array/select.rb +0 -37
- data/lib/nano/array/shuffle.rb +0 -66
- data/lib/nano/array/slap.rb +0 -37
- data/lib/nano/array/store.rb +0 -7
- data/lib/nano/array/tail.rb +0 -34
- data/lib/nano/array/thru.rb +0 -38
- data/lib/nano/array/to_b.rb +0 -31
- data/lib/nano/array/to_h.rb +0 -57
- data/lib/nano/array/to_hash.rb +0 -46
- data/lib/nano/array/unzip.rb +0 -20
- data/lib/nano/base.rb +0 -73
- data/lib/nano/binding.rb +0 -14
- data/lib/nano/binding/__DIR__.rb +0 -2
- data/lib/nano/binding/__FILE__.rb +0 -2
- data/lib/nano/binding/__LINE__.rb +0 -58
- data/lib/nano/binding/call_stack.rb +0 -41
- data/lib/nano/binding/called.rb +0 -41
- data/lib/nano/binding/caller.rb +0 -41
- data/lib/nano/binding/defined.rb +0 -40
- data/lib/nano/binding/eval.rb +0 -41
- data/lib/nano/binding/local_variables.rb +0 -44
- data/lib/nano/binding/method_name.rb +0 -47
- data/lib/nano/binding/op_fetch.rb +0 -45
- data/lib/nano/binding/op_store.rb +0 -46
- data/lib/nano/binding/self.rb +0 -41
- data/lib/nano/binding/self/of_caller.rb +0 -122
- data/lib/nano/class.rb +0 -5
- data/lib/nano/class/by_name.rb +0 -1
- data/lib/nano/class/descendents.rb +0 -44
- data/lib/nano/class/remove_descendents.rb +0 -46
- data/lib/nano/class/remove_subclasses.rb +0 -2
- data/lib/nano/class/subclasses.rb +0 -2
- data/lib/nano/comparable.rb +0 -5
- data/lib/nano/comparable/at_least.rb +0 -53
- data/lib/nano/comparable/at_most.rb +0 -2
- data/lib/nano/comparable/cap.rb +0 -2
- data/lib/nano/comparable/clip.rb +0 -72
- data/lib/nano/comparable/cmp.rb +0 -38
- data/lib/nano/continuation.rb +0 -1
- data/lib/nano/continuation/self/create.rb +0 -71
- data/lib/nano/date.rb +0 -0
- data/lib/nano/date/days_in_month.rb +0 -42
- data/lib/nano/date/days_of_month.rb +0 -34
- data/lib/nano/date/stamp.rb +0 -52
- data/lib/nano/date/to_date.rb +0 -36
- data/lib/nano/date/to_s.rb +0 -33
- data/lib/nano/date/to_time.rb +0 -36
- data/lib/nano/dir.rb +0 -4
- data/lib/nano/dir/self/ancestor.rb +0 -33
- data/lib/nano/dir/self/ascend.rb +0 -56
- data/lib/nano/dir/self/ls_r.rb +0 -76
- data/lib/nano/dir/self/recurse.rb +0 -2
- data/lib/nano/enumerable.rb +0 -38
- data/lib/nano/enumerable/collect_with_counter.rb +0 -2
- data/lib/nano/enumerable/collect_with_index.rb +0 -51
- data/lib/nano/enumerable/commonality.rb +0 -63
- data/lib/nano/enumerable/compact_collect.rb +0 -50
- data/lib/nano/enumerable/compact_map.rb +0 -2
- data/lib/nano/enumerable/cross.rb +0 -44
- data/lib/nano/enumerable/each_by.rb +0 -2
- data/lib/nano/enumerable/each_combination.rb +0 -59
- data/lib/nano/enumerable/each_pair.rb +0 -50
- data/lib/nano/enumerable/each_permutation.rb +0 -42
- data/lib/nano/enumerable/each_slice.rb +0 -131
- data/lib/nano/enumerable/each_unique_pair.rb +0 -66
- data/lib/nano/enumerable/each_with_counter.rb +0 -8
- data/lib/nano/enumerable/elementwise.rb +0 -2
- data/lib/nano/enumerable/entropy.rb +0 -52
- data/lib/nano/enumerable/every.rb +0 -61
- data/lib/nano/enumerable/ew.rb +0 -59
- data/lib/nano/enumerable/filter_collect.rb +0 -58
- data/lib/nano/enumerable/filter_map.rb +0 -2
- data/lib/nano/enumerable/find_collisions.rb +0 -41
- data/lib/nano/enumerable/frequency.rb +0 -39
- data/lib/nano/enumerable/graph.rb +0 -59
- data/lib/nano/enumerable/ideal_entropy.rb +0 -49
- data/lib/nano/enumerable/map_with_counter.rb +0 -2
- data/lib/nano/enumerable/map_with_index.rb +0 -2
- data/lib/nano/enumerable/none.rb +0 -56
- data/lib/nano/enumerable/nonuniq.rb +0 -39
- data/lib/nano/enumerable/occur.rb +0 -62
- data/lib/nano/enumerable/one.rb +0 -65
- data/lib/nano/enumerable/op_pow.rb +0 -38
- data/lib/nano/enumerable/partition_by.rb +0 -55
- data/lib/nano/enumerable/probability.rb +0 -59
- data/lib/nano/enumerable/project.rb +0 -11
- data/lib/nano/enumerable/self/combinations.rb +0 -68
- data/lib/nano/enumerable/self/cross.rb +0 -79
- data/lib/nano/enumerable/to_h.rb +0 -50
- data/lib/nano/enumerable/uniq_by.rb +0 -39
- data/lib/nano/enumerable/where.rb +0 -12
- data/lib/nano/file.rb +0 -5
- data/lib/nano/file/self/create.rb +0 -52
- data/lib/nano/file/self/open_as_string.rb +0 -81
- data/lib/nano/file/self/read_list.rb +0 -47
- data/lib/nano/file/self/sanitize.rb +0 -50
- data/lib/nano/file/self/split_all.rb +0 -36
- data/lib/nano/fileutils.rb +0 -0
- data/lib/nano/fileutils/head.rb +0 -2
- data/lib/nano/fileutils/safe_ln.rb +0 -38
- data/lib/nano/fileutils/slice.rb +0 -148
- data/lib/nano/fileutils/split_all.rb +0 -29
- data/lib/nano/fileutils/tail.rb +0 -2
- data/lib/nano/fileutils/wc.rb +0 -128
- data/lib/nano/fileutils/whereis.rb +0 -76
- data/lib/nano/fileutils/which.rb +0 -117
- data/lib/nano/float.rb +0 -3
- data/lib/nano/float/approx.rb +0 -42
- data/lib/nano/float/round_at.rb +0 -72
- data/lib/nano/float/round_to.rb +0 -73
- data/lib/nano/hash.rb +0 -40
- data/lib/nano/hash/alias.rb +0 -54
- data/lib/nano/hash/assert_has_keys.rb +0 -38
- data/lib/nano/hash/assert_has_only_keys.rb +0 -38
- data/lib/nano/hash/at.rb +0 -26
- data/lib/nano/hash/collate.rb +0 -53
- data/lib/nano/hash/delete_unless.rb +0 -15
- data/lib/nano/hash/each.rb +0 -61
- data/lib/nano/hash/each_with_index.rb +0 -35
- data/lib/nano/hash/each_with_key.rb +0 -32
- data/lib/nano/hash/graph.rb +0 -31
- data/lib/nano/hash/has_keys.rb +0 -37
- data/lib/nano/hash/has_only_keys.rb +0 -37
- data/lib/nano/hash/inverse.rb +0 -51
- data/lib/nano/hash/join.rb +0 -19
- data/lib/nano/hash/keys_to_iv.rb +0 -60
- data/lib/nano/hash/keys_to_s.rb +0 -80
- data/lib/nano/hash/keys_to_sym.rb +0 -91
- data/lib/nano/hash/op_fetch.rb +0 -146
- data/lib/nano/hash/op_lshift.rb +0 -28
- data/lib/nano/hash/op_store.rb +0 -2
- data/lib/nano/hash/rand_key.rb +0 -47
- data/lib/nano/hash/rand_pair.rb +0 -50
- data/lib/nano/hash/rand_value.rb +0 -60
- data/lib/nano/hash/replace_each.rb +0 -33
- data/lib/nano/hash/self/zipnew.rb +0 -37
- data/lib/nano/hash/shuffle.rb +0 -53
- data/lib/nano/hash/slice.rb +0 -33
- data/lib/nano/hash/stringify_keys.rb +0 -2
- data/lib/nano/hash/swap.rb +0 -36
- data/lib/nano/hash/swapkey.rb +0 -44
- data/lib/nano/hash/symoblize_keys.rb +0 -2
- data/lib/nano/hash/to_h.rb +0 -35
- data/lib/nano/hash/to_ostruct.rb +0 -40
- data/lib/nano/hash/to_ostruct_recurse.rb +0 -45
- data/lib/nano/hash/traverse.rb +0 -63
- data/lib/nano/hash/update_each.rb +0 -43
- data/lib/nano/hash/update_keys.rb +0 -31
- data/lib/nano/hash/update_values.rb +0 -32
- data/lib/nano/hash/variablize_keys.rb +0 -2
- data/lib/nano/hash/weave.rb +0 -88
- data/lib/nano/inflect.rb +0 -36
- data/lib/nano/integer.rb +0 -8
- data/lib/nano/integer/even.rb +0 -2
- data/lib/nano/integer/fact.rb +0 -2
- data/lib/nano/integer/factorial.rb +0 -47
- data/lib/nano/integer/multiple.rb +0 -69
- data/lib/nano/integer/odd.rb +0 -2
- data/lib/nano/integer/ordinal.rb +0 -41
- data/lib/nano/integer/times_collect.rb +0 -37
- data/lib/nano/integer/times_map.rb +0 -28
- data/lib/nano/kernel.rb +0 -65
- data/lib/nano/kernel/__class__.rb +0 -31
- data/lib/nano/kernel/__meta__.rb +0 -57
- data/lib/nano/kernel/as.rb +0 -87
- data/lib/nano/kernel/assign_from.rb +0 -82
- data/lib/nano/kernel/assign_with.rb +0 -75
- data/lib/nano/kernel/autoreload.rb +0 -46
- data/lib/nano/kernel/autoreload_glob.rb +0 -36
- data/lib/nano/kernel/bool.rb +0 -77
- data/lib/nano/kernel/bug.rb +0 -39
- data/lib/nano/kernel/call_stack.rb +0 -59
- data/lib/nano/kernel/called.rb +0 -40
- data/lib/nano/kernel/complete.rb +0 -6
- data/lib/nano/kernel/constant.rb +0 -52
- data/lib/nano/kernel/copy.rb +0 -48
- data/lib/nano/kernel/deep_copy.rb +0 -49
- data/lib/nano/kernel/demo.rb +0 -46
- data/lib/nano/kernel/eigenclass.rb +0 -17
- data/lib/nano/kernel/false.rb +0 -2
- data/lib/nano/kernel/fn.rb +0 -33
- data/lib/nano/kernel/generate_method_name.rb +0 -39
- data/lib/nano/kernel/get_by_id.rb +0 -33
- data/lib/nano/kernel/here.rb +0 -34
- data/lib/nano/kernel/in.rb +0 -35
- data/lib/nano/kernel/instance_assign.rb +0 -25
- data/lib/nano/kernel/instvar.rb +0 -13
- data/lib/nano/kernel/is.rb +0 -5
- data/lib/nano/kernel/maybe.rb +0 -41
- data/lib/nano/kernel/me.rb +0 -17
- data/lib/nano/kernel/meta.rb +0 -2
- data/lib/nano/kernel/metaclass.rb +0 -42
- data/lib/nano/kernel/method.rb +0 -76
- data/lib/nano/kernel/method_name.rb +0 -49
- data/lib/nano/kernel/methods.rb +0 -79
- data/lib/nano/kernel/nack.rb +0 -12
- data/lib/nano/kernel/new.rb +0 -40
- data/lib/nano/kernel/object_class.rb +0 -31
- data/lib/nano/kernel/object_hexid.rb +0 -35
- data/lib/nano/kernel/op_esc.rb +0 -37
- data/lib/nano/kernel/own.rb +0 -17
- data/lib/nano/kernel/p.rb +0 -12
- data/lib/nano/kernel/require_all.rb +0 -44
- data/lib/nano/kernel/require_esc.rb +0 -42
- data/lib/nano/kernel/require_facet.rb +0 -41
- data/lib/nano/kernel/require_local.rb +0 -25
- data/lib/nano/kernel/resc.rb +0 -32
- data/lib/nano/kernel/returning.rb +0 -49
- data/lib/nano/kernel/send_as.rb +0 -34
- data/lib/nano/kernel/set_from.rb +0 -69
- data/lib/nano/kernel/set_with.rb +0 -74
- data/lib/nano/kernel/silence_warnings.rb +0 -2
- data/lib/nano/kernel/silently.rb +0 -41
- data/lib/nano/kernel/singleton.rb +0 -47
- data/lib/nano/kernel/superior.rb +0 -53
- data/lib/nano/kernel/supermethod.rb +0 -44
- data/lib/nano/kernel/this.rb +0 -33
- data/lib/nano/kernel/to_b.rb +0 -41
- data/lib/nano/kernel/to_bool.rb +0 -47
- data/lib/nano/kernel/true.rb +0 -2
- data/lib/nano/kernel/unuri.rb +0 -2
- data/lib/nano/kernel/uri.rb +0 -38
- data/lib/nano/kernel/val.rb +0 -52
- data/lib/nano/kernel/warn_with_line.rb +0 -30
- data/lib/nano/kernel/with_accessor.rb +0 -94
- data/lib/nano/kernel/with_reader.rb +0 -2
- data/lib/nano/kernel/with_writer.rb +0 -2
- data/lib/nano/logger.rb +0 -0
- data/lib/nano/logger/format.rb +0 -28
- data/lib/nano/logger/format_message.rb +0 -1
- data/lib/nano/matchdata.rb +0 -3
- data/lib/nano/matchdata/match.rb +0 -37
- data/lib/nano/matchdata/matchset.rb +0 -2
- data/lib/nano/matchdata/matchtree.rb +0 -62
- data/lib/nano/module.rb +0 -40
- data/lib/nano/module/abstract.rb +0 -50
- data/lib/nano/module/alias_module_function.rb +0 -57
- data/lib/nano/module/ancestor.rb +0 -38
- data/lib/nano/module/attr.rb +0 -23
- data/lib/nano/module/attr_setter.rb +0 -48
- data/lib/nano/module/attr_tester.rb +0 -56
- data/lib/nano/module/basename.rb +0 -39
- data/lib/nano/module/by_name.rb +0 -68
- data/lib/nano/module/cattr_accessor.rb +0 -141
- data/lib/nano/module/cattr_reader.rb +0 -2
- data/lib/nano/module/cattr_writer.rb +0 -2
- data/lib/nano/module/clone_removing.rb +0 -2
- data/lib/nano/module/clone_renaming.rb +0 -2
- data/lib/nano/module/clone_using.rb +0 -87
- data/lib/nano/module/dirname.rb +0 -42
- data/lib/nano/module/equate_on.rb +0 -70
- data/lib/nano/module/generate_instance_method_name.rb +0 -47
- data/lib/nano/module/include_as.rb +0 -102
- data/lib/nano/module/initializer.rb +0 -65
- data/lib/nano/module/instance_methods.rb +0 -186
- data/lib/nano/module/integrate.rb +0 -48
- data/lib/nano/module/is.rb +0 -34
- data/lib/nano/module/memoize.rb +0 -95
- data/lib/nano/module/modspace.rb +0 -43
- data/lib/nano/module/namespace.rb +0 -61
- data/lib/nano/module/nesting.rb +0 -45
- data/lib/nano/module/redef.rb +0 -31
- data/lib/nano/module/redefine_method.rb +0 -57
- data/lib/nano/module/redirect.rb +0 -30
- data/lib/nano/module/redirect_method.rb +0 -64
- data/lib/nano/module/remove.rb +0 -29
- data/lib/nano/module/rename.rb +0 -31
- data/lib/nano/module/rename_method.rb +0 -38
- data/lib/nano/module/revisal.rb +0 -49
- data/lib/nano/module/shadow_all.rb +0 -17
- data/lib/nano/module/shadow_method.rb +0 -42
- data/lib/nano/module/sort_on.rb +0 -73
- data/lib/nano/module/undef.rb +0 -29
- data/lib/nano/module/wrap.rb +0 -30
- data/lib/nano/module/wrap_method.rb +0 -48
- data/lib/nano/nil_as_emptiness.rb +0 -34
- data/lib/nano/nilclass.rb +0 -7
- data/lib/nano/nilclass/empty.rb +0 -32
- data/lib/nano/nilclass/include.rb +0 -32
- data/lib/nano/nilclass/length.rb +0 -2
- data/lib/nano/nilclass/op_fetch.rb +0 -37
- data/lib/nano/nilclass/size.rb +0 -44
- data/lib/nano/nilclass/to_f.rb +0 -32
- data/lib/nano/nilclass/to_h.rb +0 -33
- data/lib/nano/numeric.rb +0 -5
- data/lib/nano/numeric/ceil_multiple.rb +0 -40
- data/lib/nano/numeric/pred.rb +0 -2
- data/lib/nano/numeric/succ.rb +0 -69
- data/lib/nano/numeric/to_b.rb +0 -38
- data/lib/nano/ostruct.rb +0 -0
- data/lib/nano/ostruct/__merge__.rb +0 -52
- data/lib/nano/ostruct/__table__.rb +0 -17
- data/lib/nano/ostruct/__update__.rb +0 -45
- data/lib/nano/ostruct/op_fetch.rb +0 -40
- data/lib/nano/ostruct/op_store.rb +0 -42
- data/lib/nano/ostruct/to_h.rb +0 -8
- data/lib/nano/pathname.rb +0 -2
- data/lib/nano/pathname/ascend.rb +0 -22
- data/lib/nano/pathname/descend.rb +0 -20
- data/lib/nano/proc.rb +0 -3
- data/lib/nano/proc/compose.rb +0 -62
- data/lib/nano/proc/op_mul.rb +0 -2
- data/lib/nano/proc/to_method.rb +0 -74
- data/lib/nano/random.rb +0 -21
- data/lib/nano/range.rb +0 -4
- data/lib/nano/range/to_r.rb +0 -32
- data/lib/nano/range/to_range.rb +0 -36
- data/lib/nano/range/umbrella.rb +0 -67
- data/lib/nano/range/within.rb +0 -44
- data/lib/nano/regexp.rb +0 -3
- data/lib/nano/regexp/arity.rb +0 -41
- data/lib/nano/regexp/to_re.rb +0 -38
- data/lib/nano/regexp/to_regexp.rb +0 -36
- data/lib/nano/string.rb +0 -86
- data/lib/nano/string/align_center.rb +0 -87
- data/lib/nano/string/align_left.rb +0 -2
- data/lib/nano/string/align_right.rb +0 -2
- data/lib/nano/string/at.rb +0 -8
- data/lib/nano/string/at_rand.rb +0 -65
- data/lib/nano/string/basename.rb +0 -48
- data/lib/nano/string/blank.rb +0 -36
- data/lib/nano/string/bracket.rb +0 -70
- data/lib/nano/string/brief.rb +0 -33
- data/lib/nano/string/bytes.rb +0 -19
- data/lib/nano/string/camelcase.rb +0 -58
- data/lib/nano/string/camelize.rb +0 -35
- data/lib/nano/string/capitalized.rb +0 -38
- data/lib/nano/string/chars.rb +0 -34
- data/lib/nano/string/cmp.rb +0 -43
- data/lib/nano/string/demodulize.rb +0 -40
- data/lib/nano/string/dequote.rb +0 -29
- data/lib/nano/string/downcase.rb +0 -37
- data/lib/nano/string/dresner.rb +0 -49
- data/lib/nano/string/each_char.rb +0 -35
- data/lib/nano/string/each_word.rb +0 -50
- data/lib/nano/string/ends_with.rb +0 -2
- data/lib/nano/string/first.rb +0 -94
- data/lib/nano/string/first_char.rb +0 -20
- data/lib/nano/string/fold.rb +0 -67
- data/lib/nano/string/format.rb +0 -17
- data/lib/nano/string/frequency.rb +0 -39
- data/lib/nano/string/humanize.rb +0 -31
- data/lib/nano/string/indent.rb +0 -68
- data/lib/nano/string/index_all.rb +0 -40
- data/lib/nano/string/last.rb +0 -94
- data/lib/nano/string/last_char.rb +0 -22
- data/lib/nano/string/line_wrap.rb +0 -77
- data/lib/nano/string/lines.rb +0 -33
- data/lib/nano/string/lowercase.rb +0 -32
- data/lib/nano/string/margin.rb +0 -138
- data/lib/nano/string/mscan.rb +0 -42
- data/lib/nano/string/natcmp.rb +0 -108
- data/lib/nano/string/nchar.rb +0 -45
- data/lib/nano/string/ordinal.rb +0 -16
- data/lib/nano/string/plural.rb +0 -2
- data/lib/nano/string/pop.rb +0 -54
- data/lib/nano/string/probability.rb +0 -34
- data/lib/nano/string/pull.rb +0 -17
- data/lib/nano/string/push.rb +0 -44
- data/lib/nano/string/quote.rb +0 -68
- data/lib/nano/string/rand_byte.rb +0 -55
- data/lib/nano/string/rand_index.rb +0 -29
- data/lib/nano/string/range.rb +0 -37
- data/lib/nano/string/range_all.rb +0 -48
- data/lib/nano/string/range_of_line.rb +0 -42
- data/lib/nano/string/self/format.rb +0 -17
- data/lib/nano/string/self/interpolate.rb +0 -31
- data/lib/nano/string/self/patterns.rb +0 -51
- data/lib/nano/string/self/rand_letter.rb +0 -34
- data/lib/nano/string/self/random.rb +0 -36
- data/lib/nano/string/shatter.rb +0 -45
- data/lib/nano/string/shift.rb +0 -42
- data/lib/nano/string/shuffle.rb +0 -42
- data/lib/nano/string/similarity.rb +0 -105
- data/lib/nano/string/singular.rb +0 -117
- data/lib/nano/string/slap.rb +0 -44
- data/lib/nano/string/soundex.rb +0 -102
- data/lib/nano/string/starts_with.rb +0 -24
- data/lib/nano/string/succ.rb +0 -38
- data/lib/nano/string/tab.rb +0 -2
- data/lib/nano/string/tabto.rb +0 -2
- data/lib/nano/string/to_a.rb +0 -35
- data/lib/nano/string/to_arr.rb +0 -55
- data/lib/nano/string/to_b.rb +0 -64
- data/lib/nano/string/to_const.rb +0 -39
- data/lib/nano/string/to_date.rb +0 -35
- data/lib/nano/string/to_proc.rb +0 -54
- data/lib/nano/string/to_re.rb +0 -37
- data/lib/nano/string/to_time.rb +0 -34
- data/lib/nano/string/unbracket.rb +0 -46
- data/lib/nano/string/underscore.rb +0 -18
- data/lib/nano/string/unix_crypt.rb +0 -41
- data/lib/nano/string/unpack.rb +0 -45
- data/lib/nano/string/unshift.rb +0 -42
- data/lib/nano/string/upcase.rb +0 -45
- data/lib/nano/string/uppercase.rb +0 -2
- data/lib/nano/string/whitespace.rb +0 -27
- data/lib/nano/string/word_filter.rb +0 -61
- data/lib/nano/string/word_wrap.rb +0 -90
- data/lib/nano/string/words.rb +0 -35
- data/lib/nano/string_as_array.rb +0 -16
- data/lib/nano/symbol.rb +0 -13
- data/lib/nano/symbol/camelcase.rb +0 -42
- data/lib/nano/symbol/camelize.rb +0 -33
- data/lib/nano/symbol/capitalize.rb +0 -31
- data/lib/nano/symbol/capitalized.rb +0 -33
- data/lib/nano/symbol/downcase.rb +0 -36
- data/lib/nano/symbol/not.rb +0 -40
- data/lib/nano/symbol/pad.rb +0 -43
- data/lib/nano/symbol/succ.rb +0 -42
- data/lib/nano/symbol/to_const.rb +0 -40
- data/lib/nano/symbol/to_proc.rb +0 -45
- data/lib/nano/symbol/to_str.rb +0 -39
- data/lib/nano/symbol/underscore.rb +0 -32
- data/lib/nano/symbol/upcase.rb +0 -37
- data/lib/nano/time.rb +0 -7
- data/lib/nano/time/change.rb +0 -51
- data/lib/nano/time/elapse.rb +0 -41
- data/lib/nano/time/self/days_extrema.rb +0 -22
- data/lib/nano/time/stamp.rb +0 -47
- data/lib/nano/time/to_date.rb +0 -37
- data/lib/nano/time/to_s.rb +0 -33
- data/lib/nano/time/to_time.rb +0 -36
- data/lib/nano/unboundmethod.rb +0 -1
- data/lib/nano/unboundmethod/name.rb +0 -8
- data/lib/unit/methodprobe.rb +0 -215
- data/lib/unit/quicktest.rb +0 -36
- data/lib/unit/test.rb +0 -145
- data/test/lib/mega/test_annotation.rb +0 -217
- data/test/lib/mega/test_ansicolor.rb +0 -36
- data/test/lib/mega/test_bbcode.rb +0 -34
- data/test/lib/mega/test_binary_multiplier.rb +0 -84
- data/test/lib/mega/test_byteorder.rb +0 -56
- data/test/lib/mega/test_class_inherit.rb +0 -118
- data/test/lib/mega/test_classmethods.rb +0 -47
- data/test/lib/mega/test_constants.rb +0 -18
- data/test/lib/mega/test_coroutine.rb +0 -60
- data/test/lib/mega/test_crosscase.rb +0 -45
- data/test/lib/mega/test_dictionary.rb +0 -90
- data/test/lib/mega/test_dynamod.rb +0 -62
- data/test/lib/mega/test_enumerable_args.rb +0 -80
- data/test/lib/mega/test_enumtype.rb +0 -25
- data/test/lib/mega/test_expirable.rb +0 -25
- data/test/lib/mega/test_filelist.rb +0 -40
- data/test/lib/mega/test_fixnum_const.rb +0 -25
- data/test/lib/mega/test_floatstring.rb +0 -36
- data/test/lib/mega/test_functor.rb +0 -39
- data/test/lib/mega/test_harray.rb +0 -294
- data/test/lib/mega/test_heap.rb +0 -18
- data/test/lib/mega/test_infinity.rb +0 -36
- data/test/lib/mega/test_inheritor.rb +0 -155
- data/test/lib/mega/test_interval.rb +0 -119
- data/test/lib/mega/test_lisp.rb +0 -47
- data/test/lib/mega/test_lru_cache.rb +0 -25
- data/test/lib/mega/test_mock.rb +0 -36
- data/test/lib/mega/test_multiplier.rb +0 -114
- data/test/lib/mega/test_multiton.rb +0 -200
- data/test/lib/mega/test_nack.rb +0 -45
- data/test/lib/mega/test_nilcomparable.rb +0 -43
- data/test/lib/mega/test_notcopyable.rb +0 -74
- data/test/lib/mega/test_openobject.rb +0 -66
- data/test/lib/mega/test_ostructable.rb +0 -43
- data/test/lib/mega/test_package.rb +0 -39
- data/test/lib/mega/test_promoteself.rb +0 -45
- data/test/lib/mega/test_snapshot.rb +0 -34
- data/test/lib/mega/test_statichash.rb +0 -31
- data/test/lib/mega/test_superstruct.rb +0 -334
- data/test/lib/mega/test_syncarray.rb +0 -28
- data/test/lib/mega/test_synchash.rb +0 -28
- data/test/lib/mega/test_tagiter.rb +0 -93
- data/test/lib/mega/test_time_in_english.rb +0 -73
- data/test/lib/mega/test_timer.rb +0 -66
- data/test/lib/mega/test_tuple.rb +0 -32
- data/test/lib/mega/test_uninheritable.rb +0 -42
- data/test/lib/mega/test_units.rb +0 -104
- data/test/lib/mega/test_version.rb +0 -104
- data/test/lib/nano/array/test_at_rand.rb +0 -34
- data/test/lib/nano/array/test_body.rb +0 -27
- data/test/lib/nano/array/test_delete_unless.rb +0 -28
- data/test/lib/nano/array/test_delete_values.rb +0 -28
- data/test/lib/nano/array/test_delete_values_at.rb +0 -31
- data/test/lib/nano/array/test_first.rb +0 -34
- data/test/lib/nano/array/test_foot.rb +0 -27
- data/test/lib/nano/array/test_head.rb +0 -27
- data/test/lib/nano/array/test_last.rb +0 -34
- data/test/lib/nano/array/test_last_index.rb +0 -26
- data/test/lib/nano/array/test_merge.rb +0 -35
- data/test/lib/nano/array/test_mid.rb +0 -33
- data/test/lib/nano/array/test_middle.rb +0 -29
- data/test/lib/nano/array/test_op_fetch.rb +0 -27
- data/test/lib/nano/array/test_op_store.rb +0 -30
- data/test/lib/nano/array/test_pick.rb +0 -40
- data/test/lib/nano/array/test_pos.rb +0 -28
- data/test/lib/nano/array/test_pull.rb +0 -28
- data/test/lib/nano/array/test_rand_index.rb +0 -29
- data/test/lib/nano/array/test_rand_subset.rb +0 -29
- data/test/lib/nano/array/test_range.rb +0 -32
- data/test/lib/nano/array/test_rotate.rb +0 -36
- data/test/lib/nano/array/test_select.rb +0 -28
- data/test/lib/nano/array/test_shuffle.rb +0 -35
- data/test/lib/nano/array/test_slap.rb +0 -28
- data/test/lib/nano/array/test_tail.rb +0 -27
- data/test/lib/nano/array/test_thru.rb +0 -27
- data/test/lib/nano/array/test_to_b.rb +0 -27
- data/test/lib/nano/array/test_to_h.rb +0 -33
- data/test/lib/nano/array/test_to_hash.rb +0 -27
- data/test/lib/nano/binding/self/test_of_caller.rb +0 -35
- data/test/lib/nano/binding/test___LINE__.rb +0 -43
- data/test/lib/nano/binding/test_call_stack.rb +0 -34
- data/test/lib/nano/binding/test_called.rb +0 -30
- data/test/lib/nano/binding/test_caller.rb +0 -35
- data/test/lib/nano/binding/test_defined.rb +0 -34
- data/test/lib/nano/binding/test_eval.rb +0 -34
- data/test/lib/nano/binding/test_local_variables.rb +0 -34
- data/test/lib/nano/binding/test_method_name.rb +0 -34
- data/test/lib/nano/binding/test_op_fetch.rb +0 -34
- data/test/lib/nano/binding/test_op_store.rb +0 -35
- data/test/lib/nano/binding/test_self.rb +0 -34
- data/test/lib/nano/class/test_descendents.rb +0 -30
- data/test/lib/nano/class/test_remove_descendents.rb +0 -32
- data/test/lib/nano/comparable/test_at_least.rb +0 -34
- data/test/lib/nano/comparable/test_clip.rb +0 -44
- data/test/lib/nano/comparable/test_cmp.rb +0 -28
- data/test/lib/nano/continuation/self/test_create.rb +0 -26
- data/test/lib/nano/date/test_days_in_month.rb +0 -30
- data/test/lib/nano/date/test_days_of_month.rb +0 -30
- data/test/lib/nano/date/test_stamp.rb +0 -38
- data/test/lib/nano/date/test_to_date.rb +0 -30
- data/test/lib/nano/date/test_to_s.rb +0 -30
- data/test/lib/nano/date/test_to_time.rb +0 -30
- data/test/lib/nano/dir/self/test_ancestor.rb +0 -26
- data/test/lib/nano/dir/self/test_ascend.rb +0 -41
- data/test/lib/nano/dir/self/test_ls_r.rb +0 -52
- data/test/lib/nano/enumerable/self/test_combinations.rb +0 -43
- data/test/lib/nano/enumerable/self/test_cross.rb +0 -31
- data/test/lib/nano/enumerable/test_collect_with_index.rb +0 -27
- data/test/lib/nano/enumerable/test_commonality.rb +0 -31
- data/test/lib/nano/enumerable/test_compact_collect.rb +0 -27
- data/test/lib/nano/enumerable/test_cross.rb +0 -30
- data/test/lib/nano/enumerable/test_each_combination.rb +0 -29
- data/test/lib/nano/enumerable/test_each_pair.rb +0 -29
- data/test/lib/nano/enumerable/test_each_slice.rb +0 -74
- data/test/lib/nano/enumerable/test_each_unique_pair.rb +0 -29
- data/test/lib/nano/enumerable/test_entropy.rb +0 -26
- data/test/lib/nano/enumerable/test_every.rb +0 -35
- data/test/lib/nano/enumerable/test_ew.rb +0 -31
- data/test/lib/nano/enumerable/test_filter_collect.rb +0 -31
- data/test/lib/nano/enumerable/test_find_collisions.rb +0 -30
- data/test/lib/nano/enumerable/test_frequency.rb +0 -27
- data/test/lib/nano/enumerable/test_graph.rb +0 -30
- data/test/lib/nano/enumerable/test_ideal_entropy.rb +0 -27
- data/test/lib/nano/enumerable/test_none.rb +0 -33
- data/test/lib/nano/enumerable/test_occur.rb +0 -30
- data/test/lib/nano/enumerable/test_one.rb +0 -35
- data/test/lib/nano/enumerable/test_op_pow.rb +0 -27
- data/test/lib/nano/enumerable/test_partition_by.rb +0 -31
- data/test/lib/nano/enumerable/test_probability.rb +0 -27
- data/test/lib/nano/enumerable/test_to_h.rb +0 -27
- data/test/lib/nano/enumerable/test_uniq_by.rb +0 -28
- data/test/lib/nano/file/self/test_create.rb +0 -39
- data/test/lib/nano/file/self/test_open_as_string.rb +0 -40
- data/test/lib/nano/file/self/test_read_list.rb +0 -37
- data/test/lib/nano/file/self/test_sanitize.rb +0 -46
- data/test/lib/nano/file/self/test_split_all.rb +0 -27
- data/test/lib/nano/fileutils/test_slice.rb +0 -96
- data/test/lib/nano/fileutils/test_wc.rb +0 -68
- data/test/lib/nano/fileutils/test_which.rb +0 -61
- data/test/lib/nano/float/test_approx.rb +0 -28
- data/test/lib/nano/float/test_round_at.rb +0 -46
- data/test/lib/nano/float/test_round_to.rb +0 -46
- data/test/lib/nano/hash/self/test_zipnew.rb +0 -28
- data/test/lib/nano/hash/test_alias.rb +0 -31
- data/test/lib/nano/hash/test_assert_has_keys.rb +0 -27
- data/test/lib/nano/hash/test_assert_has_only_keys.rb +0 -27
- data/test/lib/nano/hash/test_at.rb +0 -28
- data/test/lib/nano/hash/test_collate.rb +0 -35
- data/test/lib/nano/hash/test_each.rb +0 -36
- data/test/lib/nano/hash/test_each_with_index.rb +0 -29
- data/test/lib/nano/hash/test_each_with_key.rb +0 -29
- data/test/lib/nano/hash/test_graph.rb +0 -28
- data/test/lib/nano/hash/test_has_keys.rb +0 -27
- data/test/lib/nano/hash/test_has_only_keys.rb +0 -27
- data/test/lib/nano/hash/test_inverse.rb +0 -28
- data/test/lib/nano/hash/test_keys_to_s.rb +0 -34
- data/test/lib/nano/hash/test_keys_to_sym.rb +0 -34
- data/test/lib/nano/hash/test_op_fetch.rb +0 -111
- data/test/lib/nano/hash/test_op_lshift.rb +0 -29
- data/test/lib/nano/hash/test_rand_key.rb +0 -27
- data/test/lib/nano/hash/test_rand_pair.rb +0 -27
- data/test/lib/nano/hash/test_rand_value.rb +0 -27
- data/test/lib/nano/hash/test_replace_each.rb +0 -29
- data/test/lib/nano/hash/test_shuffle.rb +0 -32
- data/test/lib/nano/hash/test_slice.rb +0 -27
- data/test/lib/nano/hash/test_swap.rb +0 -27
- data/test/lib/nano/hash/test_swapkey.rb +0 -29
- data/test/lib/nano/hash/test_to_h.rb +0 -27
- data/test/lib/nano/hash/test_to_ostruct.rb +0 -30
- data/test/lib/nano/hash/test_to_ostruct_recurse.rb +0 -30
- data/test/lib/nano/hash/test_traverse.rb +0 -37
- data/test/lib/nano/hash/test_update_each.rb +0 -29
- data/test/lib/nano/hash/test_update_keys.rb +0 -28
- data/test/lib/nano/hash/test_update_values.rb +0 -28
- data/test/lib/nano/hash/test_weave.rb +0 -29
- data/test/lib/nano/integer/test_factorial.rb +0 -30
- data/test/lib/nano/integer/test_multiple.rb +0 -43
- data/test/lib/nano/integer/test_ordinal.rb +0 -29
- data/test/lib/nano/integer/test_times_collect.rb +0 -28
- data/test/lib/nano/integer/test_times_map.rb +0 -28
- data/test/lib/nano/kernel/test___class__.rb +0 -26
- data/test/lib/nano/kernel/test_as.rb +0 -42
- data/test/lib/nano/kernel/test_assign_from.rb +0 -31
- data/test/lib/nano/kernel/test_assign_with.rb +0 -31
- data/test/lib/nano/kernel/test_bool.rb +0 -41
- data/test/lib/nano/kernel/test_bug.rb +0 -26
- data/test/lib/nano/kernel/test_call_stack.rb +0 -26
- data/test/lib/nano/kernel/test_called.rb +0 -26
- data/test/lib/nano/kernel/test_constant.rb +0 -33
- data/test/lib/nano/kernel/test_copy.rb +0 -40
- data/test/lib/nano/kernel/test_deep_copy.rb +0 -40
- data/test/lib/nano/kernel/test_demo.rb +0 -28
- data/test/lib/nano/kernel/test_fn.rb +0 -26
- data/test/lib/nano/kernel/test_generate_method_name.rb +0 -26
- data/test/lib/nano/kernel/test_get_by_id.rb +0 -28
- data/test/lib/nano/kernel/test_here.rb +0 -26
- data/test/lib/nano/kernel/test_in.rb +0 -27
- data/test/lib/nano/kernel/test_maybe.rb +0 -26
- data/test/lib/nano/kernel/test_metaclass.rb +0 -34
- data/test/lib/nano/kernel/test_method.rb +0 -32
- data/test/lib/nano/kernel/test_method_name.rb +0 -31
- data/test/lib/nano/kernel/test_methods.rb +0 -50
- data/test/lib/nano/kernel/test_new.rb +0 -30
- data/test/lib/nano/kernel/test_object_class.rb +0 -26
- data/test/lib/nano/kernel/test_object_hexid.rb +0 -27
- data/test/lib/nano/kernel/test_require_all.rb +0 -26
- data/test/lib/nano/kernel/test_require_esc.rb +0 -27
- data/test/lib/nano/kernel/test_require_facet.rb +0 -27
- data/test/lib/nano/kernel/test_resc.rb +0 -27
- data/test/lib/nano/kernel/test_returning.rb +0 -30
- data/test/lib/nano/kernel/test_send_as.rb +0 -26
- data/test/lib/nano/kernel/test_set_from.rb +0 -33
- data/test/lib/nano/kernel/test_set_with.rb +0 -33
- data/test/lib/nano/kernel/test_silently.rb +0 -28
- data/test/lib/nano/kernel/test_singleton.rb +0 -40
- data/test/lib/nano/kernel/test_superior.rb +0 -30
- data/test/lib/nano/kernel/test_supermethod.rb +0 -33
- data/test/lib/nano/kernel/test_this.rb +0 -26
- data/test/lib/nano/kernel/test_to_b.rb +0 -28
- data/test/lib/nano/kernel/test_to_bool.rb +0 -28
- data/test/lib/nano/kernel/test_uri.rb +0 -30
- data/test/lib/nano/kernel/test_val.rb +0 -43
- data/test/lib/nano/kernel/test_with_accessor.rb +0 -51
- data/test/lib/nano/matchdata/test_match.rb +0 -29
- data/test/lib/nano/matchdata/test_matchtree.rb +0 -32
- data/test/lib/nano/module/test_abstract.rb +0 -36
- data/test/lib/nano/module/test_alias_module_function.rb +0 -34
- data/test/lib/nano/module/test_ancestor.rb +0 -26
- data/test/lib/nano/module/test_basename.rb +0 -26
- data/test/lib/nano/module/test_by_name.rb +0 -29
- data/test/lib/nano/module/test_cattr_accessor.rb +0 -55
- data/test/lib/nano/module/test_clone_using.rb +0 -55
- data/test/lib/nano/module/test_dirname.rb +0 -26
- data/test/lib/nano/module/test_equate_on.rb +0 -37
- data/test/lib/nano/module/test_generate_instance_method_name.rb +0 -33
- data/test/lib/nano/module/test_include_as.rb +0 -35
- data/test/lib/nano/module/test_initializer.rb +0 -32
- data/test/lib/nano/module/test_instance_methods.rb +0 -59
- data/test/lib/nano/module/test_integrate.rb +0 -35
- data/test/lib/nano/module/test_memoize.rb +0 -50
- data/test/lib/nano/module/test_modspace.rb +0 -27
- data/test/lib/nano/module/test_namespace.rb +0 -33
- data/test/lib/nano/module/test_nesting.rb +0 -36
- data/test/lib/nano/module/test_redef.rb +0 -30
- data/test/lib/nano/module/test_redefine_method.rb +0 -30
- data/test/lib/nano/module/test_redirect.rb +0 -30
- data/test/lib/nano/module/test_redirect_method.rb +0 -30
- data/test/lib/nano/module/test_remove.rb +0 -30
- data/test/lib/nano/module/test_rename.rb +0 -31
- data/test/lib/nano/module/test_rename_method.rb +0 -31
- data/test/lib/nano/module/test_revisal.rb +0 -35
- data/test/lib/nano/module/test_shadow_method.rb +0 -30
- data/test/lib/nano/module/test_sort_on.rb +0 -42
- data/test/lib/nano/module/test_undef.rb +0 -30
- data/test/lib/nano/module/test_wrap.rb +0 -30
- data/test/lib/nano/module/test_wrap_method.rb +0 -30
- data/test/lib/nano/nilclass/test_empty.rb +0 -26
- data/test/lib/nano/nilclass/test_include.rb +0 -26
- data/test/lib/nano/nilclass/test_op_fetch.rb +0 -28
- data/test/lib/nano/nilclass/test_size.rb +0 -30
- data/test/lib/nano/nilclass/test_to_f.rb +0 -26
- data/test/lib/nano/nilclass/test_to_h.rb +0 -26
- data/test/lib/nano/numeric/test_ceil_multiple.rb +0 -31
- data/test/lib/nano/numeric/test_succ.rb +0 -40
- data/test/lib/nano/numeric/test_to_b.rb +0 -27
- data/test/lib/nano/ostruct/test___merge__.rb +0 -38
- data/test/lib/nano/ostruct/test___update__.rb +0 -29
- data/test/lib/nano/ostruct/test_op_fetch.rb +0 -27
- data/test/lib/nano/ostruct/test_op_store.rb +0 -28
- data/test/lib/nano/proc/test_compose.rb +0 -36
- data/test/lib/nano/proc/test_to_method.rb +0 -31
- data/test/lib/nano/range/test_to_r.rb +0 -27
- data/test/lib/nano/range/test_to_range.rb +0 -27
- data/test/lib/nano/range/test_umbrella.rb +0 -34
- data/test/lib/nano/range/test_within.rb +0 -29
- data/test/lib/nano/regexp/test_arity.rb +0 -33
- data/test/lib/nano/regexp/test_to_re.rb +0 -27
- data/test/lib/nano/regexp/test_to_regexp.rb +0 -27
- data/test/lib/nano/string/self/test_interpolate.rb +0 -27
- data/test/lib/nano/string/self/test_patterns.rb +0 -28
- data/test/lib/nano/string/self/test_rand_letter.rb +0 -26
- data/test/lib/nano/string/test_align_center.rb +0 -34
- data/test/lib/nano/string/test_at_rand.rb +0 -35
- data/test/lib/nano/string/test_basename.rb +0 -41
- data/test/lib/nano/string/test_blank.rb +0 -27
- data/test/lib/nano/string/test_bracket.rb +0 -49
- data/test/lib/nano/string/test_camelcase.rb +0 -39
- data/test/lib/nano/string/test_camelize.rb +0 -26
- data/test/lib/nano/string/test_capitalized.rb +0 -26
- data/test/lib/nano/string/test_chars.rb +0 -27
- data/test/lib/nano/string/test_cmp.rb +0 -30
- data/test/lib/nano/string/test_demodulize.rb +0 -38
- data/test/lib/nano/string/test_downcase.rb +0 -26
- data/test/lib/nano/string/test_dresner.rb +0 -32
- data/test/lib/nano/string/test_each_char.rb +0 -29
- data/test/lib/nano/string/test_each_word.rb +0 -29
- data/test/lib/nano/string/test_first.rb +0 -43
- data/test/lib/nano/string/test_fold.rb +0 -28
- data/test/lib/nano/string/test_frequency.rb +0 -28
- data/test/lib/nano/string/test_humanize.rb +0 -26
- data/test/lib/nano/string/test_indent.rb +0 -40
- data/test/lib/nano/string/test_index_all.rb +0 -26
- data/test/lib/nano/string/test_last.rb +0 -46
- data/test/lib/nano/string/test_line_wrap.rb +0 -27
- data/test/lib/nano/string/test_lines.rb +0 -26
- data/test/lib/nano/string/test_lowercase.rb +0 -26
- data/test/lib/nano/string/test_margin.rb +0 -117
- data/test/lib/nano/string/test_mscan.rb +0 -30
- data/test/lib/nano/string/test_natcmp.rb +0 -30
- data/test/lib/nano/string/test_nchar.rb +0 -29
- data/test/lib/nano/string/test_pop.rb +0 -47
- data/test/lib/nano/string/test_probability.rb +0 -28
- data/test/lib/nano/string/test_push.rb +0 -40
- data/test/lib/nano/string/test_quote.rb +0 -49
- data/test/lib/nano/string/test_rand_byte.rb +0 -35
- data/test/lib/nano/string/test_rand_index.rb +0 -26
- data/test/lib/nano/string/test_range.rb +0 -27
- data/test/lib/nano/string/test_range_all.rb +0 -27
- data/test/lib/nano/string/test_range_of_line.rb +0 -28
- data/test/lib/nano/string/test_shatter.rb +0 -29
- data/test/lib/nano/string/test_shift.rb +0 -40
- data/test/lib/nano/string/test_shuffle.rb +0 -27
- data/test/lib/nano/string/test_similarity.rb +0 -26
- data/test/lib/nano/string/test_singular.rb +0 -32
- data/test/lib/nano/string/test_slap.rb +0 -40
- data/test/lib/nano/string/test_soundex.rb +0 -41
- data/test/lib/nano/string/test_succ.rb +0 -29
- data/test/lib/nano/string/test_to_a.rb +0 -27
- data/test/lib/nano/string/test_to_arr.rb +0 -26
- data/test/lib/nano/string/test_to_b.rb +0 -41
- data/test/lib/nano/string/test_to_const.rb +0 -28
- data/test/lib/nano/string/test_to_date.rb +0 -30
- data/test/lib/nano/string/test_to_proc.rb +0 -33
- data/test/lib/nano/string/test_to_re.rb +0 -28
- data/test/lib/nano/string/test_to_time.rb +0 -30
- data/test/lib/nano/string/test_unix_crypt.rb +0 -30
- data/test/lib/nano/string/test_unpack.rb +0 -34
- data/test/lib/nano/string/test_unshift.rb +0 -39
- data/test/lib/nano/string/test_upcase.rb +0 -30
- data/test/lib/nano/string/test_whitespace.rb +0 -27
- data/test/lib/nano/string/test_word_filter.rb +0 -34
- data/test/lib/nano/string/test_word_wrap.rb +0 -51
- data/test/lib/nano/string/test_words.rb +0 -27
- data/test/lib/nano/symbol/test_camelcase.rb +0 -26
- data/test/lib/nano/symbol/test_camelize.rb +0 -27
- data/test/lib/nano/symbol/test_capitalize.rb +0 -26
- data/test/lib/nano/symbol/test_capitalized.rb +0 -27
- data/test/lib/nano/symbol/test_downcase.rb +0 -27
- data/test/lib/nano/symbol/test_not.rb +0 -29
- data/test/lib/nano/symbol/test_pad.rb +0 -27
- data/test/lib/nano/symbol/test_succ.rb +0 -28
- data/test/lib/nano/symbol/test_to_const.rb +0 -28
- data/test/lib/nano/symbol/test_to_proc.rb +0 -27
- data/test/lib/nano/symbol/test_to_str.rb +0 -28
- data/test/lib/nano/symbol/test_underscore.rb +0 -26
- data/test/lib/nano/symbol/test_upcase.rb +0 -27
- data/test/lib/nano/time/test_change.rb +0 -33
- data/test/lib/nano/time/test_elapse.rb +0 -27
- data/test/lib/nano/time/test_stamp.rb +0 -31
- data/test/lib/nano/time/test_to_date.rb +0 -31
- data/test/lib/nano/time/test_to_s.rb +0 -31
- data/test/lib/nano/time/test_to_time.rb +0 -31
- data/test/lib/unit/test_methodprobe.rb +0 -53
- data/test/tc_nil_as_emptiness.rb +0 -20
- data/web/favicon.ico +0 -0
- data/web/images/abc.png +0 -0
- data/web/images/abc1.png +0 -0
- data/web/images/gray.jpg +0 -0
- data/web/images/ruby-lg.png +0 -0
- data/web/images/ruby.gif +0 -0
- data/web/index.html +0 -310
data/lib/mega/tuple.rb
DELETED
@@ -1,97 +0,0 @@
|
|
1
|
-
#--
|
2
|
-
# Tuple
|
3
|
-
#
|
4
|
-
# Copyright (c) 2005 Thomas Sawyer
|
5
|
-
#
|
6
|
-
# Ruby License
|
7
|
-
#
|
8
|
-
# This module is free software. You may use, modify, and/or
|
9
|
-
# redistribute this software under the same terms as Ruby.
|
10
|
-
#
|
11
|
-
# This program is distributed in the hope that it will be useful,
|
12
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
14
|
-
#
|
15
|
-
# ==========================================================================
|
16
|
-
# Revision History:
|
17
|
-
# ==========================================================================
|
18
|
-
# 2005.04.24 trans
|
19
|
-
# Adjusted to use Tuple::[] instead of ::new, which now takes a single
|
20
|
-
# argument, either an Array or a String which it splits.
|
21
|
-
# 2005.04.24 trans
|
22
|
-
# Created.
|
23
|
-
# ==========================================================================
|
24
|
-
#
|
25
|
-
# TODO: Not a true tuple?
|
26
|
-
# This class probably needs some enhancements to be truly considered a
|
27
|
-
# Tuple. For instance, should a Tuple by multiton?
|
28
|
-
#
|
29
|
-
#++
|
30
|
-
|
31
|
-
#:title: Tuple
|
32
|
-
#
|
33
|
-
# A Tuple is essentially an Array that is also Comaparable.
|
34
|
-
#
|
35
|
-
# == Usage
|
36
|
-
#
|
37
|
-
# t1 = Tuple[1,2,3]
|
38
|
-
# t2 = Tuple[2,3,4]
|
39
|
-
#
|
40
|
-
# t1 < t2 #=> true
|
41
|
-
# t1 > t2 #=> false
|
42
|
-
#
|
43
|
-
class Tuple < Array
|
44
|
-
include Comparable
|
45
|
-
|
46
|
-
def self.[](*args)
|
47
|
-
new(args)
|
48
|
-
end
|
49
|
-
|
50
|
-
def initialize(arg)
|
51
|
-
super()
|
52
|
-
@divider = '.'
|
53
|
-
case arg
|
54
|
-
when String
|
55
|
-
if md = /([-.,;:'\\\/])/.match(arg)
|
56
|
-
@divider = md[1]
|
57
|
-
end
|
58
|
-
self.concat arg.split(/([-.,;:'\\\/])/)
|
59
|
-
else
|
60
|
-
self.concat arg
|
61
|
-
end
|
62
|
-
end
|
63
|
-
|
64
|
-
def to_s
|
65
|
-
join(@divider)
|
66
|
-
end
|
67
|
-
end
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
# _____ _
|
72
|
-
# |_ _|__ ___| |_
|
73
|
-
# | |/ _ \/ __| __|
|
74
|
-
# | | __/\__ \ |_
|
75
|
-
# |_|\___||___/\__|
|
76
|
-
#
|
77
|
-
|
78
|
-
=begin testing
|
79
|
-
|
80
|
-
require 'test/unit'
|
81
|
-
|
82
|
-
class TC_Tuple < Test::Unit::TestCase
|
83
|
-
|
84
|
-
def setup
|
85
|
-
@t1 = Tuple[1,2,3]
|
86
|
-
@t2 = Tuple[2,4,5]
|
87
|
-
end
|
88
|
-
|
89
|
-
def test_compare
|
90
|
-
assert( @t1 < @t2 )
|
91
|
-
assert( @t2 > @t1 )
|
92
|
-
end
|
93
|
-
|
94
|
-
end
|
95
|
-
|
96
|
-
=end
|
97
|
-
|
data/lib/mega/uninheritable.rb
DELETED
@@ -1,92 +0,0 @@
|
|
1
|
-
#--
|
2
|
-
# Uninheritable
|
3
|
-
#
|
4
|
-
# Copyright (c) 2003 Austin Ziegler
|
5
|
-
#
|
6
|
-
# Ruby License
|
7
|
-
#
|
8
|
-
# This module is free software. You may use, modify, and/or redistribute this
|
9
|
-
# software under the same terms as Ruby.
|
10
|
-
#
|
11
|
-
# This program is distributed in the hope that it will be useful, but WITHOUT
|
12
|
-
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
13
|
-
# FOR A PARTICULAR PURPOSE.
|
14
|
-
#
|
15
|
-
# ==========================================================================
|
16
|
-
# Revision History
|
17
|
-
# ==========================================================================
|
18
|
-
#
|
19
|
-
# 2003.9.17 Austin Ziegler
|
20
|
-
# - Minor modifications to documentation.
|
21
|
-
#
|
22
|
-
# ==========================================================================
|
23
|
-
#++
|
24
|
-
|
25
|
-
#:title: Uninheritable
|
26
|
-
#
|
27
|
-
# Allows an object to declare itself as unable to be subclassed. The
|
28
|
-
# technique behind this is very simple (redefinition of #inherited), so this
|
29
|
-
# just provides an easier way to do the same thing with a consistent error
|
30
|
-
# message.
|
31
|
-
#
|
32
|
-
# == Usage
|
33
|
-
#
|
34
|
-
# require 'mega/uninheritable'
|
35
|
-
#
|
36
|
-
# class A
|
37
|
-
# extend Uninheritable
|
38
|
-
# end
|
39
|
-
#
|
40
|
-
# class B < A; end # => raises TypeError
|
41
|
-
#
|
42
|
-
# == Author(s)
|
43
|
-
#
|
44
|
-
# * Austin Ziegler
|
45
|
-
#
|
46
|
-
|
47
|
-
module Uninheritable
|
48
|
-
# Redefines a class's #inherited definition to prevent subclassing of the
|
49
|
-
# class extended by this module.
|
50
|
-
def inherited(klass)
|
51
|
-
raise TypeError, "Class #{self} cannot be subclassed."
|
52
|
-
end
|
53
|
-
end
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
# _____ _
|
58
|
-
# |_ _|__ ___| |_
|
59
|
-
# | |/ _ \/ __| __|
|
60
|
-
# | | __/\__ \ |_
|
61
|
-
# |_|\___||___/\__|
|
62
|
-
#
|
63
|
-
|
64
|
-
=begin testing
|
65
|
-
|
66
|
-
require 'test/unit'
|
67
|
-
|
68
|
-
class TC_Uninheritable < Test::Unit::TestCase
|
69
|
-
|
70
|
-
class Cannot
|
71
|
-
extend Uninheritable
|
72
|
-
end
|
73
|
-
|
74
|
-
class Can
|
75
|
-
end
|
76
|
-
|
77
|
-
def test_module
|
78
|
-
assert_nothing_raised {
|
79
|
-
self.instance_eval <<-EOS
|
80
|
-
class A < Can; end
|
81
|
-
EOS
|
82
|
-
}
|
83
|
-
assert_raises(TypeError, "Class Cannot cannot be subclassed.") do
|
84
|
-
self.instance_eval <<-EOS
|
85
|
-
class B < Cannot; end
|
86
|
-
EOS
|
87
|
-
end
|
88
|
-
end
|
89
|
-
|
90
|
-
end
|
91
|
-
|
92
|
-
=end
|
data/lib/mega/units.rb
DELETED
@@ -1,926 +0,0 @@
|
|
1
|
-
#--
|
2
|
-
# Units
|
3
|
-
#
|
4
|
-
# Copyright (c) 2005 Peter Vanbroekhoven & Thomas Sawyer
|
5
|
-
#
|
6
|
-
# Ruby License
|
7
|
-
#
|
8
|
-
# This module is free software. You may use, modify, and/or redistribute this
|
9
|
-
# software under the same terms as Ruby.
|
10
|
-
#
|
11
|
-
# This program is distributed in the hope that it will be useful, but WITHOUT
|
12
|
-
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
13
|
-
# FOR A PARTICULAR PURPOSE.
|
14
|
-
#
|
15
|
-
# ==========================================================================
|
16
|
-
# Revision History ::
|
17
|
-
# --------------------------------------------------------------------------
|
18
|
-
# 2005.10.01 peter Finished
|
19
|
-
# 2005.08.01 trans Started
|
20
|
-
# ==========================================================================
|
21
|
-
#
|
22
|
-
#++
|
23
|
-
|
24
|
-
# :title: Units
|
25
|
-
#
|
26
|
-
# This is a very extensive SI units system.
|
27
|
-
#
|
28
|
-
# == Usage
|
29
|
-
#
|
30
|
-
# Here are some examples of usage.
|
31
|
-
#
|
32
|
-
# 1.bit/s + 8.bytes/s
|
33
|
-
# (1.bit/s).to(byte/s)
|
34
|
-
# 1.mile.to(feet)
|
35
|
-
# 1.acre.to(yd**2)
|
36
|
-
# 1.acre.to(sq_yd)
|
37
|
-
# 1.gallon.to(self.L)
|
38
|
-
# 1.lb.to(kg)
|
39
|
-
# 1.m.s.to(m.s)
|
40
|
-
# 1.sq_mi.to(km**2)
|
41
|
-
# 1.mile.to(km)
|
42
|
-
# 1.usd.to(twd)
|
43
|
-
#
|
44
|
-
# == Author(s)
|
45
|
-
#
|
46
|
-
# * Peter Vanbroekhoven
|
47
|
-
# * Thomas Sawyer
|
48
|
-
#
|
49
|
-
|
50
|
-
require 'rbconfig'
|
51
|
-
require 'soap/wsdlDriver'
|
52
|
-
require 'yaml'
|
53
|
-
|
54
|
-
# The namespace for all unit related classes. Mixing this in has the additional effect
|
55
|
-
# of making Units.with_unit_converter available without the <code>Units.</code> prefix,
|
56
|
-
# as well as the shortcuts for creating Units (see Units#method_missing).
|
57
|
-
module Units
|
58
|
-
|
59
|
-
def method_missing(m, *args, &blk)
|
60
|
-
if args.length == 1
|
61
|
-
args[0] = Units::Converter.converter(args[0]) if not args[0].is_a? Units::Converter
|
62
|
-
return Units::Unit.new({m => 1}, args[0]) if args[0].registered?(m)
|
63
|
-
elsif Units::Converter.current.registered?(m)
|
64
|
-
raise ArgumentError, "Wrong number of arguments" if args.length != 0
|
65
|
-
return Units::Unit.new({m => 1}, Units::Converter.current)
|
66
|
-
end
|
67
|
-
super
|
68
|
-
end
|
69
|
-
|
70
|
-
# Executes the block with the current Converter changed to
|
71
|
-
# the given Converter. This allows to temporarily change the
|
72
|
-
# Converter used by default.
|
73
|
-
#
|
74
|
-
# Example:
|
75
|
-
#
|
76
|
-
# with_unit_converter(:uk) {
|
77
|
-
# puts 1.cwt.to(lb) # => 112.0 lb
|
78
|
-
# }
|
79
|
-
#
|
80
|
-
# with_unit_converter(:us) {
|
81
|
-
# puts 1.cwt.to(lb) # => 100.0 lb
|
82
|
-
# }
|
83
|
-
#
|
84
|
-
# See also Converter.current.
|
85
|
-
def with_unit_converter(name, &blk) # :yields:
|
86
|
-
Units::Converter.with_converter(name, &blk)
|
87
|
-
end
|
88
|
-
|
89
|
-
module_function :with_unit_converter
|
90
|
-
|
91
|
-
# This class represents a Unit. A Unit uses a given Converter with
|
92
|
-
# a number of registered Units in which it can be expressed.
|
93
|
-
# A Unit is the product of the powers of other Units. In principle, these
|
94
|
-
# need not be integer powers, but this may cause problems with rounding.
|
95
|
-
# The following code for example returns +false+:
|
96
|
-
# Unit.new(:m => 0.1) * Unit.new(:m => 0.2) == Unit.new(:m => 0.3)
|
97
|
-
#
|
98
|
-
# Units can be multiplied and divided, or raised to a given power.
|
99
|
-
# This can only be done when both units use the same Converter.
|
100
|
-
# As an extra, 1 can be divided by a Unit.
|
101
|
-
#
|
102
|
-
# Examples:
|
103
|
-
#
|
104
|
-
# Unit.new(:mi => 1, :s => -1) ** 2 # => mi**2/s**2
|
105
|
-
# Unit.new(:mi => 1, :s => -1) * Unit.new(:s => 1, :usd => -1) # => mi/usd
|
106
|
-
# Unit.new(:mi => 1, :s => -1, Converter.converter(:uk)) *
|
107
|
-
# Unit.new(:s => 1, :usd => -1, Converter.converter(:us)) # => TypeError
|
108
|
-
# 1 / Unit.new(:mi => 1, :s => -1) # => s/mi
|
109
|
-
class Unit
|
110
|
-
|
111
|
-
attr_reader :units, :converter
|
112
|
-
|
113
|
-
# Creates a new (composite) Unit.
|
114
|
-
# It is passed a hash of the form <code>{:unit => exponent}</code>, and the
|
115
|
-
# Converter to use.
|
116
|
-
#
|
117
|
-
# Examples:
|
118
|
-
#
|
119
|
-
# Unit.new(:m => 1, :s => -1, Converter.converter(:uk)) # => m/s
|
120
|
-
# Unit.new(:mi => 1, :s => -2) # => mi/s**2
|
121
|
-
#
|
122
|
-
# See also Converter, Converter.converter
|
123
|
-
def initialize(units = {}, converter = Units::Converter.current)
|
124
|
-
@units, @converter = {}, converter
|
125
|
-
units.each_pair { |k, v| @units[k.to_sym] = v }
|
126
|
-
check_units
|
127
|
-
end
|
128
|
-
|
129
|
-
# Raises to the given power.
|
130
|
-
def **(p)
|
131
|
-
result = {}
|
132
|
-
@units.each_pair do |u, e|
|
133
|
-
result[u] = e * p
|
134
|
-
end
|
135
|
-
Units::Unit.new(result, @converter)
|
136
|
-
end
|
137
|
-
|
138
|
-
# Multiplies with the given Unit.
|
139
|
-
def *(other)
|
140
|
-
do_op(:*, :+, other)
|
141
|
-
end
|
142
|
-
|
143
|
-
# Divides by the given Unit.
|
144
|
-
def /(other)
|
145
|
-
do_op(:/, :-, other)
|
146
|
-
end
|
147
|
-
|
148
|
-
# Returns +true+ iff this Unit has all exponents equal to 0.
|
149
|
-
def unitless?
|
150
|
-
@units.empty?
|
151
|
-
end
|
152
|
-
|
153
|
-
def coerce(other) # :nodoc:
|
154
|
-
return [self, Units::Unit.new({}, converter)] if other == 1
|
155
|
-
raise TypeError, "incompatible converters" if converter != other.converter
|
156
|
-
converter.coerce_units(self, other)
|
157
|
-
end
|
158
|
-
|
159
|
-
# Returns +true+ iff the two Units are equals, <i>i.e.,</i> iff they have
|
160
|
-
# the same exponent for all units, and they both use the same Converter.
|
161
|
-
def ==(other)
|
162
|
-
other.is_a?(Units::Unit) && other.units == units && other.converter == converter
|
163
|
-
end
|
164
|
-
|
165
|
-
# Returns +true+ iff this Unit is compatible with the given
|
166
|
-
# Unit. This is less strict than equality because for example hours are
|
167
|
-
# compatible with seconds ("we can add them"), but hours are not seconds.
|
168
|
-
def compatible_with?(other)
|
169
|
-
return false if converter != other.converter
|
170
|
-
conv1, conv2 = converter.coerce_units(self, other)
|
171
|
-
conv1.units == conv2.units
|
172
|
-
end
|
173
|
-
|
174
|
-
# Returns a human readable string representation.
|
175
|
-
def to_s
|
176
|
-
numerator = ""
|
177
|
-
denominator = ""
|
178
|
-
@units.each_pair do |u, e|
|
179
|
-
(e > 0 ? numerator : denominator) << " #{u.to_s}#{"**#{e.abs}" if e.abs != 1}"
|
180
|
-
end
|
181
|
-
"#{numerator.lstrip}#{"/" + denominator.lstrip if not denominator.empty?}"
|
182
|
-
end
|
183
|
-
|
184
|
-
alias inspect to_s
|
185
|
-
|
186
|
-
def method_missing(m, *args, &blk)
|
187
|
-
if converter.registered?(m)
|
188
|
-
raise ArgumentError, "Wrong number of arguments" if args.length != 0
|
189
|
-
return Units::Unit.new({m => 1}, converter) * self
|
190
|
-
end
|
191
|
-
super
|
192
|
-
end
|
193
|
-
|
194
|
-
private
|
195
|
-
|
196
|
-
def check_units
|
197
|
-
@units.keys.each do |unit|
|
198
|
-
raise ArgumentError, "unit #{unit.to_s.dump} not registered" if not @converter.registered? unit
|
199
|
-
@units.delete(unit) if @units[unit] == 0
|
200
|
-
end
|
201
|
-
end
|
202
|
-
|
203
|
-
def do_op(op, dual_op, other)
|
204
|
-
raise TypeError, "incompatible converters for #{op}" if converter != other.converter
|
205
|
-
result = @units.dup
|
206
|
-
other.units.each_pair do |u, e|
|
207
|
-
result[u] = 0 if not result[u]
|
208
|
-
result[u] = result[u].send(dual_op, e)
|
209
|
-
end
|
210
|
-
Units::Unit.new(result, @converter)
|
211
|
-
end
|
212
|
-
|
213
|
-
end
|
214
|
-
|
215
|
-
# This class represents a Value with a numeric value and a Unit.
|
216
|
-
# The numeric value can be any Numeric, though it is not recommended
|
217
|
-
# to use Values.
|
218
|
-
#
|
219
|
-
# A Value can be added to, subtracted from and multiplied with another value,
|
220
|
-
# though only when both Values are using the same Converter. While multiplication
|
221
|
-
# is always possible, adding or subtracting values with incompatible Units
|
222
|
-
# results in a TypeError. When two Units are compatible but not the same,
|
223
|
-
# the Value with the larger of the Units is converted to the smaller of the Units.
|
224
|
-
# For example adding 100 seconds and 1 minute, the latter is converted to 60 seconds
|
225
|
-
# because a second is smaller than a minute. The result is 160 seconds.
|
226
|
-
class Value < Numeric
|
227
|
-
|
228
|
-
# The numeric value of this Value.
|
229
|
-
attr_reader :value
|
230
|
-
# The Unit of this value.
|
231
|
-
attr_reader :unit
|
232
|
-
|
233
|
-
# Creates a new Value with the given numeric value and the given unit.
|
234
|
-
# Simply returns the given value if the given unit is valueless,
|
235
|
-
# <i>i.e.,</i> when <code>unit.unitless?</code> is true.
|
236
|
-
def self.new(value, unit)
|
237
|
-
return value if unit.unitless?
|
238
|
-
super
|
239
|
-
end
|
240
|
-
|
241
|
-
def initialize(value, unit) # :nodoc:
|
242
|
-
@value, @unit = value, unit
|
243
|
-
end
|
244
|
-
|
245
|
-
# Returns the Converter used by this Value's Unit.
|
246
|
-
# Equivalent to <code>unit.converter</code>.
|
247
|
-
def converter
|
248
|
-
unit.converter
|
249
|
-
end
|
250
|
-
|
251
|
-
def *(other) # :nodoc:
|
252
|
-
do_multiplicative_op(:*, other)
|
253
|
-
end
|
254
|
-
|
255
|
-
def /(other) # :nodoc:
|
256
|
-
do_multiplicative_op(:/, other)
|
257
|
-
end
|
258
|
-
|
259
|
-
def +(other) # :nodoc:
|
260
|
-
do_additive_op(:+, other)
|
261
|
-
end
|
262
|
-
|
263
|
-
def -(other) # :nodoc:
|
264
|
-
do_additive_op(:-, other)
|
265
|
-
end
|
266
|
-
|
267
|
-
def ==(other) # :nodoc:
|
268
|
-
(self - other).value == 0.0
|
269
|
-
end
|
270
|
-
|
271
|
-
# Converts this Value to the given Unit.
|
272
|
-
# This only works if the Converters used by this Value's Unit
|
273
|
-
# and the given Unit are the same. It obviously fails if the
|
274
|
-
# Units are not compatible (can't add apples and oranges).
|
275
|
-
def to(to_unit)
|
276
|
-
conv1, conv2 = unit.coerce(to_unit)
|
277
|
-
raise TypeError, "incompatible units for operation" if conv1.units != conv2.units
|
278
|
-
mult = conv1.multiplier / conv2.multiplier
|
279
|
-
Value.new(value * mult, to_unit)
|
280
|
-
end
|
281
|
-
|
282
|
-
def coerce(other) # :nodoc:
|
283
|
-
[self, Value.new(other, Units::Unit.new({}, @unit.converter))]
|
284
|
-
end
|
285
|
-
|
286
|
-
# Returns a human readable string representation.
|
287
|
-
def to_s
|
288
|
-
"#{@value} #{@unit}"
|
289
|
-
end
|
290
|
-
|
291
|
-
alias inspect to_s
|
292
|
-
|
293
|
-
def method_missing(m, *args, &blk)
|
294
|
-
if self.converter.registered?(m)
|
295
|
-
raise ArgumentError, "Wrong number of arguments" if args.length != 0
|
296
|
-
return self * Value.new(1, Units::Unit.new({m => 1}, self.converter))
|
297
|
-
end
|
298
|
-
super
|
299
|
-
end
|
300
|
-
|
301
|
-
private
|
302
|
-
|
303
|
-
def do_additive_op(op, other)
|
304
|
-
if other.is_a? Value
|
305
|
-
conv1, conv2 = unit.coerce(other.unit)
|
306
|
-
raise TypeError, "incompatible units for #{op}" if conv1.units != conv2.units
|
307
|
-
mult = conv2.multiplier / conv1.multiplier
|
308
|
-
if mult > 1
|
309
|
-
Value.new(value.send(op, other.value * mult), unit)
|
310
|
-
else
|
311
|
-
Value.new(other.value.send(op, value * mult), other.unit)
|
312
|
-
end
|
313
|
-
else
|
314
|
-
raise TypeError, "incompatible operands for #{op}"
|
315
|
-
end
|
316
|
-
end
|
317
|
-
|
318
|
-
def do_multiplicative_op(op, other)
|
319
|
-
if other.is_a? Value
|
320
|
-
Value.new(value.send(op, other.value), unit.send(op, other.unit))
|
321
|
-
elsif other.is_a? Units::Unit
|
322
|
-
Value.new(value, unit.send(op, other))
|
323
|
-
else
|
324
|
-
Value.new(value.send(op, other), unit)
|
325
|
-
end
|
326
|
-
end
|
327
|
-
|
328
|
-
end
|
329
|
-
|
330
|
-
# This class handles all conversions between Units.
|
331
|
-
#
|
332
|
-
# There are two kinds of Units; those that are not expressed as a function
|
333
|
-
# of other Units --called base units-- and those that are expressed
|
334
|
-
# as a function of other Units --called derived units. The former kind is
|
335
|
-
# registered without specifying how it depends on other Units, while the latter
|
336
|
-
# kind is registered with doing so.
|
337
|
-
#
|
338
|
-
# This class also registers a list of Converters that are generally useable.
|
339
|
-
# The default Converter which is used when none is specified, can be retrieved
|
340
|
-
# with Converter.current. Converters can be registered with Converter.register.
|
341
|
-
#
|
342
|
-
# Converters can be loaded from YAML. This allows Converters to be specified in
|
343
|
-
# configuration files.
|
344
|
-
class Converter
|
345
|
-
|
346
|
-
# Encapsulates a service for retrieving exchange rates.
|
347
|
-
# This is used by Converter.register_currency.
|
348
|
-
# An instance of this class behaves like a Numeric when used
|
349
|
-
# in calculations. This class is used to look up exchange rates
|
350
|
-
# lazily.
|
351
|
-
#
|
352
|
-
# This class is not supposed to be instantiated by itself. Instead a
|
353
|
-
# subclass should be created that defines the method +get_rate+.
|
354
|
-
# The only subclass provided is currently XMethods.
|
355
|
-
#
|
356
|
-
# To be found automatically from YAML files, exchange services should
|
357
|
-
# be located under Units::Converter::ExchangeRate.
|
358
|
-
class ExchangeRate
|
359
|
-
|
360
|
-
def self.create_conversion(curr, converter) # :nodoc:
|
361
|
-
{:unit => Units::Unit.new({%s{--base-currency--} => 1}, converter), :multiplier => self.new(curr)}
|
362
|
-
end
|
363
|
-
|
364
|
-
def initialize(curr) # :nodoc:
|
365
|
-
@curr = curr
|
366
|
-
end
|
367
|
-
|
368
|
-
# This method should be overridden in subclasses to return the
|
369
|
-
# exchange rate represented by this object. The unit in question
|
370
|
-
# is available as a String in the instance variable <code>@curr</code>.
|
371
|
-
# The rate should be calculated against an arbitrary but fixed base currency.
|
372
|
-
# The rate should be such that the following would be true
|
373
|
-
# 1 * curr = rate * base_curr
|
374
|
-
# This function should return +nil+ if the currency is not supported by this
|
375
|
-
# retrieval service. It should <em>not</em> raise an exception.
|
376
|
-
def get_rate
|
377
|
-
raise NoMethodError, "undefined method `get_rate' for #{to_s}:#{self.class}"
|
378
|
-
end
|
379
|
-
|
380
|
-
def value # :nodoc:
|
381
|
-
@value ||= get_rate or raise TypeError, "currency not supported by current service: #{@curr.to_s.dump}"
|
382
|
-
end
|
383
|
-
|
384
|
-
def coerce(other) # :nodoc:
|
385
|
-
[value, other]
|
386
|
-
end
|
387
|
-
|
388
|
-
def *(other) # :nodoc:
|
389
|
-
value * other
|
390
|
-
end
|
391
|
-
|
392
|
-
def /(other) # :nodoc:
|
393
|
-
value / other
|
394
|
-
end
|
395
|
-
|
396
|
-
def +(other) # :nodoc:
|
397
|
-
value + other
|
398
|
-
end
|
399
|
-
|
400
|
-
def -(other) # :nodoc:
|
401
|
-
value - other
|
402
|
-
end
|
403
|
-
|
404
|
-
def **(other) # :nodoc:
|
405
|
-
value ** other
|
406
|
-
end
|
407
|
-
|
408
|
-
# Exchange rate retrieval service that uses a service from http://www.xmethods.com.
|
409
|
-
# See http://rubyurl.com/7uq.
|
410
|
-
class XMethods < ExchangeRate
|
411
|
-
|
412
|
-
# This is the only method that a subclass of ExchangeRate
|
413
|
-
# needs to implement. This is a good example to follow.
|
414
|
-
def get_rate
|
415
|
-
driver.getRate(country_mapping[@curr], country_mapping[base])
|
416
|
-
rescue
|
417
|
-
nil
|
418
|
-
end
|
419
|
-
|
420
|
-
private
|
421
|
-
|
422
|
-
def data
|
423
|
-
@@data ||= YAML.load_file(File.join(Units::Config::DATADIR, 'xmethods', 'mapping.yaml'))
|
424
|
-
end
|
425
|
-
|
426
|
-
def country_mapping
|
427
|
-
@@country_mapping ||= data[:mapping]
|
428
|
-
end
|
429
|
-
|
430
|
-
def base
|
431
|
-
@@base ||= data[:base]
|
432
|
-
end
|
433
|
-
|
434
|
-
def driver
|
435
|
-
@@driver ||= SOAP::WSDLDriverFactory.new("http://www.xmethods.net/sd/2001/CurrencyExchangeService.wsdl").create_rpc_driver #.createDriver
|
436
|
-
end
|
437
|
-
|
438
|
-
end
|
439
|
-
|
440
|
-
# Cached values for the XMethods exchange rate service.
|
441
|
-
class CachedXMethods < ExchangeRate
|
442
|
-
|
443
|
-
# This is the only method that a subclass of ExchangeRate
|
444
|
-
# needs to implement. This is a good example to follow.
|
445
|
-
def get_rate
|
446
|
-
data[@curr]
|
447
|
-
end
|
448
|
-
|
449
|
-
private
|
450
|
-
|
451
|
-
def data
|
452
|
-
@@data ||= YAML.load_file(File.join(Units::Config::DATADIR, 'xmethods', 'cached.yaml'))
|
453
|
-
end
|
454
|
-
|
455
|
-
end
|
456
|
-
|
457
|
-
end
|
458
|
-
|
459
|
-
Conversion = Struct.new(:units, :multiplier) # :nodoc:
|
460
|
-
|
461
|
-
class Conversion # :nodoc:
|
462
|
-
|
463
|
-
def **(p)
|
464
|
-
Conversion.new(units ** p, multiplier ** p)
|
465
|
-
end
|
466
|
-
|
467
|
-
def *(m)
|
468
|
-
Conversion.new(units * m.units, multiplier * m.multiplier)
|
469
|
-
end
|
470
|
-
|
471
|
-
def /(m)
|
472
|
-
Conversion.new(units / m.units, multiplier / m.multiplier)
|
473
|
-
end
|
474
|
-
|
475
|
-
end
|
476
|
-
|
477
|
-
# The prefixes used for SI units. See also Converter#register_si_unit.
|
478
|
-
SI_PREFIXES = {
|
479
|
-
'yotta' => {:abbrev => 'Y', :multiplier => 1e24},
|
480
|
-
'zetta' => {:abbrev => 'Z', :multiplier => 1e21},
|
481
|
-
'exa' => {:abbrev => 'E', :multiplier => 1e18},
|
482
|
-
'peta' => {:abbrev => 'P', :multiplier => 1e14},
|
483
|
-
'tera' => {:abbrev => 'T', :multiplier => 1e12},
|
484
|
-
'giga' => {:abbrev => 'G', :multiplier => 1e9},
|
485
|
-
'mega' => {:abbrev => 'M', :multiplier => 1e6},
|
486
|
-
'kilo' => {:abbrev => 'k', :multiplier => 1e3},
|
487
|
-
'hecto' => {:abbrev => 'h', :multiplier => 1e2},
|
488
|
-
'deca' => {:abbrev => 'da', :multiplier => 1e1},
|
489
|
-
'deci' => {:abbrev => 'd', :multiplier => 1e-1},
|
490
|
-
'centi' => {:abbrev => 'c', :multiplier => 1e-2},
|
491
|
-
'milli' => {:abbrev => 'm', :multiplier => 1e-3},
|
492
|
-
'micro' => {:abbrev => 'u', :multiplier => 1e-6},
|
493
|
-
'nano' => {:abbrev => 'n', :multiplier => 1e-9},
|
494
|
-
'pico' => {:abbrev => 'p', :multiplier => 1e-12},
|
495
|
-
'femto' => {:abbrev => 'f', :multiplier => 1e-15},
|
496
|
-
'atto' => {:abbrev => 'a', :multiplier => 1e-18},
|
497
|
-
'zepto' => {:abbrev => 'z', :multiplier => 1e-21},
|
498
|
-
'yocto' => {:abbrev => 'y', :multiplier => 1e-24}
|
499
|
-
}
|
500
|
-
|
501
|
-
# The prefixes used for binary units. See also Converter#register_binary_unit.
|
502
|
-
BINARY_PREFIXES = {
|
503
|
-
'yotta' => {:abbrev => 'Y', :multiplier => 1024.0 ** 8},
|
504
|
-
'zetta' => {:abbrev => 'Z', :multiplier => 1024.0 ** 7},
|
505
|
-
'exa' => {:abbrev => 'E', :multiplier => 1024.0 ** 6},
|
506
|
-
'peta' => {:abbrev => 'P', :multiplier => 1024.0 ** 5},
|
507
|
-
'tera' => {:abbrev => 'T', :multiplier => 1024.0 ** 4},
|
508
|
-
'giga' => {:abbrev => 'G', :multiplier => 1024.0 ** 3},
|
509
|
-
'mega' => {:abbrev => 'M', :multiplier => 1024.0 ** 2},
|
510
|
-
'kilo' => {:abbrev => 'k', :multiplier => 1024.0},
|
511
|
-
}
|
512
|
-
|
513
|
-
# The prefixes used for length units. See also Converter#register_length_unit.
|
514
|
-
LENGTH_PREFIXES = {
|
515
|
-
'square_' => {:abbrev => 'sq_', :power => 2},
|
516
|
-
'cubic_' => {:abbrev => 'cu_', :power => 3}
|
517
|
-
}
|
518
|
-
|
519
|
-
# Creates a new Converter, where the data is loaded from the
|
520
|
-
# file with the given file name.
|
521
|
-
def self.from_yaml(file)
|
522
|
-
Units::Converter.new {
|
523
|
-
load_yaml(file)
|
524
|
-
}
|
525
|
-
end
|
526
|
-
|
527
|
-
# Creates a new Converter. If a block is given,
|
528
|
-
# it is executed in the newly created Converter's context.
|
529
|
-
def initialize(&blk)
|
530
|
-
@loaded_yaml = []
|
531
|
-
@conversions = {}
|
532
|
-
instance_eval(&blk) if blk
|
533
|
-
end
|
534
|
-
|
535
|
-
# Checks whether the unit with the given name is registered.
|
536
|
-
# The name can be a symbol or a string.
|
537
|
-
def registered?(unit)
|
538
|
-
unit = unit.to_sym
|
539
|
-
conversions(unit) != nil
|
540
|
-
end
|
541
|
-
|
542
|
-
# Returns the list of registered unit names as symbols.
|
543
|
-
def registered_units
|
544
|
-
@conversions.keys
|
545
|
-
end
|
546
|
-
|
547
|
-
# Registers a new Unit with the given name. The +data+ parameter
|
548
|
-
# is a Hash with some extra parameters (can be Strings or Symbols):
|
549
|
-
# +alias+:: Specifies possible aliases for the Unit.
|
550
|
-
# +abbrev+:: Specifies possible abbreviations or symbols for the Unit.
|
551
|
-
# The differences with aliases is that prefixes work differently;
|
552
|
-
# see +register_si_unit+ and +register_binary_unit+.
|
553
|
-
# +equals+:: If present, specifies how the Unit depends on other Units.
|
554
|
-
# The value for this key can either be a Hash with +unit+ mapping to
|
555
|
-
# a Unit and +multiplier+ mapping to a numeric multiplier, or
|
556
|
-
# a String containing the multiplier, followed by a space, followed by
|
557
|
-
# a representation of the Unit as returned by Unit#to_s.
|
558
|
-
#
|
559
|
-
# Examples:
|
560
|
-
#
|
561
|
-
# converter.register_unit(:pint, :alias => :pints, :abbrev => [:pt, :pts]))
|
562
|
-
# converter.register_unit(:quart, 'alias' => :quarts, :abbrev => ['qt', :qts], :equals => '2.0 pt'))
|
563
|
-
# converter.register_unit(:gallon, :alias => :gallons, :abbrev => :gal, 'equals' => {:unit => Unit.new('qt' => 1, converter), 'multiplier' => 4.0))
|
564
|
-
#
|
565
|
-
# Note that Symbols and Strings are generally exchangeable within this
|
566
|
-
# library (internally they are converted to Symbols). The number one reason
|
567
|
-
# for this is that String look better in YAML.
|
568
|
-
#
|
569
|
-
# See also +register_si_unit+, +register_binary_unit+, +register_length_unit+
|
570
|
-
# and +register_currency+.
|
571
|
-
def register_unit(name, data = {})
|
572
|
-
unit, aliases, abbrevs = extract_data(name, data, :to_sym)
|
573
|
-
conversion = data[:equals]
|
574
|
-
conversion = decode_conversion(conversion) if conversion
|
575
|
-
conversion = convert_conversion(conversion[:unit].units, conversion[:multiplier]) if conversion
|
576
|
-
register_unit_internal(unit, conversion)
|
577
|
-
conversion = convert_conversion({unit => 1}, 1) if not conversion
|
578
|
-
(aliases + abbrevs).each do |u|
|
579
|
-
register_unit_internal(u, conversion)
|
580
|
-
end
|
581
|
-
end
|
582
|
-
|
583
|
-
# Registers a new SI unit. The Unit and its aliases are registered with
|
584
|
-
# all available SI prefixes (see SI_PREFIXES) as well, while the
|
585
|
-
# abbreviations are registered with the abbreviated version of the
|
586
|
-
# prefixes.
|
587
|
-
#
|
588
|
-
# For the syntax of the options, see +register_unit+.
|
589
|
-
def register_si_unit(unit, data = {})
|
590
|
-
register_prefixed_unit(unit, SI_PREFIXES, data)
|
591
|
-
end
|
592
|
-
|
593
|
-
# Registers a new binary unit. The Unit and its aliases are registered with
|
594
|
-
# all available binary prefixes (see BINARY_PREFIXES) as well, while the
|
595
|
-
# abbreviations are registered with the abbreviated version of the
|
596
|
-
# prefixes.
|
597
|
-
#
|
598
|
-
# For the syntax of the options, see +register_unit+.
|
599
|
-
def register_binary_unit(unit, data = {})
|
600
|
-
register_prefixed_unit(unit, BINARY_PREFIXES, data)
|
601
|
-
end
|
602
|
-
|
603
|
-
# Registers a new length unit. The Unit and its aliases are registered with
|
604
|
-
# all available length prefixes (see LENGTH_PREFIXES) as well, while the
|
605
|
-
# abbreviations are registered with the abbreviated version of the
|
606
|
-
# prefixes.
|
607
|
-
#
|
608
|
-
# For the syntax of the options, see +register_unit+.
|
609
|
-
def register_length_unit(unit, data = {})
|
610
|
-
register_prefixed_unit(unit, LENGTH_PREFIXES, data)
|
611
|
-
end
|
612
|
-
|
613
|
-
# Registers a given currency, with a given servive to find the exchange
|
614
|
-
# rate between the given currency and a given base currency. The service
|
615
|
-
# should be a subclass of ExchangeRate. This is not strictly necessary,
|
616
|
-
# but ExchangeRate handles all of the magic.
|
617
|
-
def register_currency(curr, service = nil)
|
618
|
-
service ||= Units::Config::DEFAULT_CURRENCY_SERVICE
|
619
|
-
register_unit(curr, :equals => service.create_conversion(curr, self))
|
620
|
-
end
|
621
|
-
|
622
|
-
def coerce_units(unit1, unit2) # :nodoc:
|
623
|
-
[convert_conversion(unit1.units), convert_conversion(unit2.units)]
|
624
|
-
end
|
625
|
-
|
626
|
-
def method_missing(m, *args, &blk)
|
627
|
-
if registered?(m)
|
628
|
-
raise ArgumentError, "Wrong number of arguments" if args.length != 0
|
629
|
-
return Units::Unit.new({m => 1}, self)
|
630
|
-
end
|
631
|
-
super
|
632
|
-
end
|
633
|
-
|
634
|
-
# Loads data from the YAML file with the given name.
|
635
|
-
# Returns +self+.
|
636
|
-
def load_yaml(file)
|
637
|
-
return if @loaded_yaml.include? file
|
638
|
-
data = YAML.load_file(file)
|
639
|
-
@loaded_yaml << file
|
640
|
-
old_service = Thread.current['current_currency_exchange_service']
|
641
|
-
data.each do |r|
|
642
|
-
rule = {}
|
643
|
-
r.each_pair do |k, v|
|
644
|
-
rule[k.to_sym] = v
|
645
|
-
end
|
646
|
-
case rule[:type]
|
647
|
-
when 'import'
|
648
|
-
load_yaml(File.join(Units::Config::DATADIR, rule[:file] + '.yaml'))
|
649
|
-
when 'si'
|
650
|
-
register_si_unit(rule[:name], rule)
|
651
|
-
when 'unit'
|
652
|
-
register_unit(rule[:name], rule)
|
653
|
-
when 'length'
|
654
|
-
register_length_unit(rule[:name], rule)
|
655
|
-
when 'binary'
|
656
|
-
register_binary_unit(rule[:name], rule)
|
657
|
-
when 'currency'
|
658
|
-
register_currency(rule[:name], Thread.current['current_currency_exchange_service'])
|
659
|
-
when 'service'
|
660
|
-
begin
|
661
|
-
Thread.current['current_currency_exchange_service'] = Units::Converter::ExchangeRate.const_get(rule[:name])
|
662
|
-
rescue NameError
|
663
|
-
raise NameError, "Exchange service not found: #{rule[:name].to_s.dump}"
|
664
|
-
end
|
665
|
-
else
|
666
|
-
raise "unknown rule type #{rule[:type].to_s.dump}"
|
667
|
-
end
|
668
|
-
end
|
669
|
-
Thread.current['current_currency_exchange_service'] = old_service
|
670
|
-
self
|
671
|
-
end
|
672
|
-
|
673
|
-
# Returns the current Converter in the current Thread.
|
674
|
-
# The default converter is the one returned by <code>converter(:default)</code>.
|
675
|
-
# See also Units#with_converter and Converter.converter.
|
676
|
-
def self.current
|
677
|
-
Thread.current["current_unit_converter"] ||= converter(:default)
|
678
|
-
end
|
679
|
-
|
680
|
-
def self.with_converter(conv) # :nodoc:
|
681
|
-
old_conv = Thread.current["current_unit_converter"]
|
682
|
-
if conv.is_a? Units::Converter
|
683
|
-
Thread.current["current_unit_converter"] = conv
|
684
|
-
else
|
685
|
-
Thread.current["current_unit_converter"] = converter(conv)
|
686
|
-
end
|
687
|
-
yield
|
688
|
-
ensure
|
689
|
-
Thread.current["current_unit_converter"] = old_conv
|
690
|
-
end
|
691
|
-
|
692
|
-
# Returns the converter with the given name.
|
693
|
-
# This name can be a Symbol or a String.
|
694
|
-
def self.converter(name)
|
695
|
-
converters[name.to_sym] or raise ArgumentError, "No converter #{name.to_s.dump} found"
|
696
|
-
end
|
697
|
-
|
698
|
-
# Registers the given Converter under the given name.
|
699
|
-
# This name can be a Symbol or a String.
|
700
|
-
def self.register(name, converter)
|
701
|
-
converters[name.to_sym] = converter
|
702
|
-
end
|
703
|
-
|
704
|
-
# Returns the list of names of registered converters.
|
705
|
-
def self.registered_converters
|
706
|
-
converters.keys
|
707
|
-
end
|
708
|
-
|
709
|
-
private
|
710
|
-
|
711
|
-
def clean_eval(some_name_noone_uses)
|
712
|
-
eval some_name_noone_uses, binding, __FILE__, __LINE__
|
713
|
-
end
|
714
|
-
|
715
|
-
def register_unit_internal(unit, conversion)
|
716
|
-
raise "unit #{unit.to_s.dump} already registered with #{self}" if registered? unit
|
717
|
-
@conversions[unit] = conversion || :none
|
718
|
-
end
|
719
|
-
|
720
|
-
def register_prefixed_unit(unit, prefixes, data = {})
|
721
|
-
unit, aliases, abbrevs = extract_data(unit, data, :to_s)
|
722
|
-
register_unit(unit, :equals => data[:equals], :alias => aliases, :abbrev => abbrevs)
|
723
|
-
unit_sym = unit.to_sym
|
724
|
-
prefixes.each_pair do |pre,info|
|
725
|
-
abbrev = info[:abbrev]
|
726
|
-
multiplier = info[:multiplier] || 1
|
727
|
-
power = info[:power] || 1
|
728
|
-
register_unit(pre + unit, :equals => {:unit => Units::Unit.new({unit_sym => power}, self), :multiplier => multiplier})
|
729
|
-
aliases.each do |a|
|
730
|
-
register_unit(pre + a, :equals => {:unit => Units::Unit.new({unit_sym => power}, self), :multiplier => multiplier})
|
731
|
-
end
|
732
|
-
abbrevs.each do |a|
|
733
|
-
register_unit(abbrev + a, :equals => {:unit => Units::Unit.new({unit_sym => power}, self), :multiplier => multiplier})
|
734
|
-
end
|
735
|
-
end
|
736
|
-
end
|
737
|
-
|
738
|
-
def extract_data(unit, data, conv)
|
739
|
-
sarray = proc do |k|
|
740
|
-
list = data[k] || []
|
741
|
-
list = [list] if not list.is_a? Array
|
742
|
-
list.map { |a| a.send(conv) }
|
743
|
-
end
|
744
|
-
unit = unit.send(conv)
|
745
|
-
return unit, sarray[:alias], sarray[:abbrev].select { |a| a != unit }
|
746
|
-
end
|
747
|
-
|
748
|
-
def decode_conversion(data)
|
749
|
-
if not data.is_a? String
|
750
|
-
return {:unit => data[:unit] || data['unit'],
|
751
|
-
:multiplier => data[:multiplier] || data['multiplier']}
|
752
|
-
end
|
753
|
-
data.rstrip!
|
754
|
-
if m = /^(\d+(\.\d+(?:[eE][-+]?\d+)?)?(?:\s+|$))?(.+)?$/.match(data)
|
755
|
-
unit = m[3] ? clean_eval(m[3].gsub(/\b([A-Z]\w*|in)\b/, 'self.\1')) : Units::Unit.new({}, self)
|
756
|
-
if m[1]
|
757
|
-
multiplier = m[2] ? Float(m[1]) : Integer(m[1])
|
758
|
-
{:unit => unit, :multiplier => multiplier}
|
759
|
-
else
|
760
|
-
{:unit => unit}
|
761
|
-
end
|
762
|
-
else
|
763
|
-
raise ArgumentError, "Wrong unit string"
|
764
|
-
end
|
765
|
-
end
|
766
|
-
|
767
|
-
def convert_conversion(units, multiplier = nil)
|
768
|
-
multiplier ||= 1
|
769
|
-
base_units = {}
|
770
|
-
other_units = {}
|
771
|
-
units.each_pair do |u, e|
|
772
|
-
(conversions(u) != :none ? other_units : base_units)[u] = e
|
773
|
-
end
|
774
|
-
result = Conversion.new(Units::Unit.new(base_units, self), multiplier)
|
775
|
-
other_units.each_pair do |u, e|
|
776
|
-
result *= (conversions(u) ** e)
|
777
|
-
end
|
778
|
-
result
|
779
|
-
end
|
780
|
-
|
781
|
-
def conversions(unit)
|
782
|
-
@conversions[unit] || (unit == %s{--base-currency--} ? :none : nil)
|
783
|
-
end
|
784
|
-
|
785
|
-
def self.converters
|
786
|
-
@converters ||= {}
|
787
|
-
end
|
788
|
-
|
789
|
-
end
|
790
|
-
|
791
|
-
# Contains some configuration related constants
|
792
|
-
module Config
|
793
|
-
|
794
|
-
# The directory in which the data files are searched for
|
795
|
-
DATADIR = File.join( ::Config::CONFIG['datadir'], 'facets', 'units' )
|
796
|
-
|
797
|
-
# The standard service used for looking up currency exchange rates
|
798
|
-
DEFAULT_CURRENCY_SERVICE = Units::Converter::ExchangeRate::XMethods
|
799
|
-
|
800
|
-
end
|
801
|
-
|
802
|
-
#-- Initialization after everything is set up
|
803
|
-
class Converter
|
804
|
-
standard_converters = YAML.load_file(File.join(Units::Config::DATADIR, 'standard.yaml'))
|
805
|
-
standard_converters.each do |name|
|
806
|
-
register(name, Units::Converter.from_yaml(File.join(Units::Config::DATADIR, name + ".yaml")))
|
807
|
-
end
|
808
|
-
end
|
809
|
-
|
810
|
-
end
|
811
|
-
|
812
|
-
class Numeric
|
813
|
-
|
814
|
-
def method_missing(m, *args, &blk)
|
815
|
-
if args.length == 1
|
816
|
-
args[0] = Units::Converter.converter(args[0]) if not args[0].is_a? Units::Converter
|
817
|
-
return Value.new(self, Units::Unit.new({m => 1}, args[0])) if args[0].registered?(m)
|
818
|
-
elsif Units::Converter.current.registered?(m)
|
819
|
-
raise ArgumentError, "Wrong number of arguments" if args.length != 0
|
820
|
-
return Units::Value.new(self, Units::Unit.new({m => 1}, Units::Converter.current))
|
821
|
-
end
|
822
|
-
super
|
823
|
-
end
|
824
|
-
|
825
|
-
end
|
826
|
-
|
827
|
-
|
828
|
-
|
829
|
-
# _____ _
|
830
|
-
# |_ _|__ ___| |_
|
831
|
-
# | |/ _ \/ __| __|
|
832
|
-
# | | __/\__ \ |_
|
833
|
-
# |_|\___||___/\__|
|
834
|
-
#
|
835
|
-
|
836
|
-
=begin testing
|
837
|
-
|
838
|
-
require 'test/unit'
|
839
|
-
|
840
|
-
include Units
|
841
|
-
|
842
|
-
class TC01 < Test::Unit::TestCase
|
843
|
-
|
844
|
-
def test_01_001
|
845
|
-
assert_equal( "65.0 bit/s", (1.bit/s + 8.bytes/s).to_s )
|
846
|
-
end
|
847
|
-
|
848
|
-
def test_01_002
|
849
|
-
assert_equal( "0.125 byte/s", ((1.bit/s).to(byte/s)).to_s )
|
850
|
-
end
|
851
|
-
|
852
|
-
def test_01_003
|
853
|
-
assert_equal( "5280.0 feet", (1.mile.to(feet)).to_s )
|
854
|
-
end
|
855
|
-
|
856
|
-
def test_01_004
|
857
|
-
assert_equal( "4840.0 yd**2", (1.acre.to(yd**2)).to_s )
|
858
|
-
end
|
859
|
-
|
860
|
-
def test_01_005
|
861
|
-
assert_equal( "4840.0 sq_yd", (1.acre.to(sq_yd)).to_s )
|
862
|
-
end
|
863
|
-
|
864
|
-
def test_01_006
|
865
|
-
assert_equal( "3.785411784 L", (1.gallon.to(self.L)).to_s )
|
866
|
-
end
|
867
|
-
|
868
|
-
def test_01_007
|
869
|
-
assert_equal( "0.45359237 kg", (1.lb.to(kg)).to_s )
|
870
|
-
end
|
871
|
-
|
872
|
-
def test_01_008
|
873
|
-
assert_equal( "1 s m", (1.m.s.to(m.s)).to_s )
|
874
|
-
end
|
875
|
-
|
876
|
-
def test_01_009
|
877
|
-
assert_equal( "2.589988110336 km**2", (1.sq_mi.to(km**2)).to_s )
|
878
|
-
end
|
879
|
-
|
880
|
-
def test_01_010
|
881
|
-
assert_equal( "1.609344 km", (1.mile.to(km)).to_s )
|
882
|
-
end
|
883
|
-
|
884
|
-
# currency rates change frequently, temp commented
|
885
|
-
#def test_01_011
|
886
|
-
# assert_equal( "33.2750003803837 twd", (1.usd.to(twd)).to_s )
|
887
|
-
#end
|
888
|
-
|
889
|
-
def test_01_012
|
890
|
-
with_unit_converter(:uk) {
|
891
|
-
assert_equal( "112.0 lb", 1.cwt.to(lb).to_s )
|
892
|
-
}
|
893
|
-
end
|
894
|
-
|
895
|
-
def test_01_013
|
896
|
-
with_unit_converter(:us) {
|
897
|
-
assert_equal( "100.0 lb", 1.cwt.to(lb).to_s )
|
898
|
-
}
|
899
|
-
end
|
900
|
-
|
901
|
-
def test_01_014
|
902
|
-
assert_equal( "112.0 lb", (1.cwt(:uk).to(lb(:uk))).to_s )
|
903
|
-
assert_equal( "100.0 lb", (1.cwt(:us).to(lb(:us))).to_s )
|
904
|
-
end
|
905
|
-
|
906
|
-
def test_01_015
|
907
|
-
assert_equal( "lb", (Converter.current.lb).to_s )
|
908
|
-
end
|
909
|
-
|
910
|
-
def test_01_016
|
911
|
-
assert_equal( [:us, :cex, :default, :uk], Converter.registered_converters )
|
912
|
-
end
|
913
|
-
|
914
|
-
def test_01_017
|
915
|
-
assert_raises(TypeError) {
|
916
|
-
1.try.to(usd)
|
917
|
-
}
|
918
|
-
end
|
919
|
-
|
920
|
-
def test_01_016
|
921
|
-
assert_equal( "33.2190007563597 twd", (1.usd(:cex).to(twd(:cex))).to_s )
|
922
|
-
end
|
923
|
-
|
924
|
-
end
|
925
|
-
|
926
|
-
=end
|