facets-glimmer 3.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.index +89 -0
- data/.yardopts +10 -0
- data/CONTRIBUTING.md +112 -0
- data/HISTORY.md +2497 -0
- data/LICENSE.txt +26 -0
- data/NOTICE.rdoc +167 -0
- data/README.md +305 -0
- data/demo/applique/assertion_framework.rb +1 -0
- data/demo/applique/file_helpers.rb +34 -0
- data/demo/core/array/after.md +13 -0
- data/demo/core/array/arrange.md +17 -0
- data/demo/core/array/before.md +14 -0
- data/demo/core/array/collapse.md +15 -0
- data/demo/core/array/collisions.md +30 -0
- data/demo/core/array/commonality.md +31 -0
- data/demo/core/array/conjoin.md +47 -0
- data/demo/core/array/contains.md +9 -0
- data/demo/core/array/delete_unless.md +13 -0
- data/demo/core/array/delete_values.md +10 -0
- data/demo/core/array/delete_values_at.md +15 -0
- data/demo/core/array/divide.md +14 -0
- data/demo/core/array/duplicates.md +14 -0
- data/demo/core/array/each_overlap.md +12 -0
- data/demo/core/array/each_pair.md +13 -0
- data/demo/core/array/each_value.md +12 -0
- data/demo/core/array/entropy.md +13 -0
- data/demo/core/array/extract_options.md +13 -0
- data/demo/core/array/first.md +11 -0
- data/demo/core/array/from.md +11 -0
- data/demo/core/array/ideal_entropy.md +11 -0
- data/demo/core/array/intersection.md +11 -0
- data/demo/core/array/last.md +11 -0
- data/demo/core/array/median.md +23 -0
- data/demo/core/array/merge.md +15 -0
- data/demo/core/array/missing.md +10 -0
- data/demo/core/array/mode.md +9 -0
- data/demo/core/array/nonuniq.md +16 -0
- data/demo/core/array/not_empty.md +8 -0
- data/demo/core/array/occur.md +18 -0
- data/demo/core/array/occurrence.md +13 -0
- data/demo/core/array/only.md +9 -0
- data/demo/core/array/op_pow.md +10 -0
- data/demo/core/array/pad.md +28 -0
- data/demo/core/array/peek.md +10 -0
- data/demo/core/array/poke.md +15 -0
- data/demo/core/array/probability +8 -0
- data/demo/core/array/pull.md +10 -0
- data/demo/core/array/recurse.md +10 -0
- data/demo/core/array/recursively.md +20 -0
- data/demo/core/array/reject_values.md +10 -0
- data/demo/core/array/span.md +16 -0
- data/demo/core/array/splice.md +14 -0
- data/demo/core/array/split.md +13 -0
- data/demo/core/array/split_at.md +12 -0
- data/demo/core/array/squeeze.md +14 -0
- data/demo/core/array/step.md +16 -0
- data/demo/core/array/store.md +9 -0
- data/demo/core/array/thru.md +12 -0
- data/demo/core/array/to_h.md +11 -0
- data/demo/core/array/traverse.md +20 -0
- data/demo/core/array/uniq_by.md +16 -0
- data/demo/core/array/unique_permutation.md +14 -0
- data/demo/core/array/zip.md +8 -0
- data/demo/core/binding/caller.md +57 -0
- data/demo/core/binding/defined.md +10 -0
- data/demo/core/binding/opvars.md +16 -0
- data/demo/core/binding/self.md +6 -0
- data/demo/core/class/descendants.md +13 -0
- data/demo/core/class/to_proc.md +11 -0
- data/demo/core/comparable/at_least.md +11 -0
- data/demo/core/comparable/at_most.md +11 -0
- data/demo/core/comparable/bound.md +13 -0
- data/demo/core/comparable/cap.md +11 -0
- data/demo/core/comparable/clip.md +29 -0
- data/demo/core/comparable/cmp.md +18 -0
- data/demo/core/comparable/op_get.md +32 -0
- data/demo/core/dir/ascend.md +24 -0
- data/demo/core/dir/descend.md +16 -0
- data/demo/core/dir/multiglob.md +41 -0
- data/demo/core/dir/parent.md +6 -0
- data/demo/core/dir/recurse.md +41 -0
- data/demo/core/exception/detail.md +19 -0
- data/demo/core/facets.md +6 -0
- data/demo/core/filetest/root.md +13 -0
- data/demo/core/hash/recursively.md +21 -0
- data/demo/core/indexable.md +95 -0
- data/demo/core/integer/bitmask.md +46 -0
- data/demo/core/integer/factorial.md +10 -0
- data/demo/core/integer/length.md +7 -0
- data/demo/core/integer/multiple.md +12 -0
- data/demo/core/integer/of.md +11 -0
- data/demo/core/integer/ordinal.md +11 -0
- data/demo/core/integer/times_collect.md +9 -0
- data/demo/core/matchdata/match.md +7 -0
- data/demo/core/matchdata/matchset.md +7 -0
- data/demo/core/matchdata/matchtree.md +10 -0
- data/demo/core/module/cattr.md +43 -0
- data/demo/core/module/class_extend.md +64 -0
- data/demo/core/module/class_inheritor.md +126 -0
- data/demo/core/module/copy_inheritor.md +30 -0
- data/demo/core/module/include_as.md +31 -0
- data/demo/core/module/method_space.md +24 -0
- data/demo/core/string/acronym.md +9 -0
- data/demo/core/string/align.md +34 -0
- data/demo/core/string/ascii_only.md +37 -0
- data/demo/core/string/bracket.md +35 -0
- data/demo/core/string/camelcase.md +47 -0
- data/demo/core/string/capitalized.md +27 -0
- data/demo/core/string/cleanlines.md +10 -0
- data/demo/core/string/cleave.md +49 -0
- data/demo/core/string/compress_lines.md +22 -0
- data/demo/core/string/crypt.md +15 -0
- data/demo/core/string/divide.md +9 -0
- data/demo/core/string/each_word.md +11 -0
- data/demo/core/string/edit_distance.md +15 -0
- data/demo/core/string/exclude.md +15 -0
- data/demo/core/string/expand_tabs.md +69 -0
- data/demo/core/string/fold.md +14 -0
- data/demo/core/string/indent.md +65 -0
- data/demo/core/string/index_all.md +14 -0
- data/demo/core/string/interpolate.md +8 -0
- data/demo/core/string/lchomp.md +14 -0
- data/demo/core/string/line_wrap.md +7 -0
- data/demo/core/string/lowercase.md +12 -0
- data/demo/core/string/methodize.md +22 -0
- data/demo/core/string/modulize.md +22 -0
- data/demo/core/string/mscan.md +10 -0
- data/demo/core/string/natcmp.md +10 -0
- data/demo/core/string/nchar.md +9 -0
- data/demo/core/string/newlines.md +9 -0
- data/demo/core/string/number.md +27 -0
- data/demo/core/string/op_div.md +10 -0
- data/demo/core/string/op_sub.md +7 -0
- data/demo/core/string/pathize.md +22 -0
- data/demo/core/string/quote.md +20 -0
- data/demo/core/string/random.md +25 -0
- data/demo/core/string/range.md +19 -0
- data/demo/core/string/remove.md +33 -0
- data/demo/core/string/rewrite.md +9 -0
- data/demo/core/string/shatter.md +9 -0
- data/demo/core/string/similarity.md +12 -0
- data/demo/core/string/snakecase.md +14 -0
- data/demo/core/string/splice.md +28 -0
- data/demo/core/string/squish.md +27 -0
- data/demo/core/string/store.md +10 -0
- data/demo/core/string/subtract.md +8 -0
- data/demo/core/string/titlecase.md +8 -0
- data/demo/core/string/to_re.md +22 -0
- data/demo/core/string/trim.md +92 -0
- data/demo/core/string/unbracket.md +24 -0
- data/demo/core/string/underscore.md +17 -0
- data/demo/core/string/unfold.md +9 -0
- data/demo/core/string/unindent.md +65 -0
- data/demo/core/string/unquote.md +6 -0
- data/demo/core/string/uppercase.md +15 -0
- data/demo/core/string/variablize.md +7 -0
- data/demo/core/string/word_wrap.md +54 -0
- data/demo/core/string/words.md +13 -0
- data/demo/core/string/xor.md +8 -0
- data/demo/standard/02_cloneable.rdoc +46 -0
- data/demo/standard/03_enumargs.rdoc +75 -0
- data/demo/standard/04_equitable.rdoc +35 -0
- data/demo/standard/05_instantiable.rdoc +42 -0
- data/demo/standard/date/comparison.md +33 -0
- data/demo/standard/memoizable.rdoc +134 -0
- data/demo/standard/mulititon.rdoc +156 -0
- data/lib/core/facets/applique/file_helpers.rb +33 -0
- data/lib/core/facets/array/after.rb +1 -0
- data/lib/core/facets/array/arrange.rb +42 -0
- data/lib/core/facets/array/average.rb +15 -0
- data/lib/core/facets/array/before.rb +41 -0
- data/lib/core/facets/array/collapse.rb +18 -0
- data/lib/core/facets/array/collisions.rb +1 -0
- data/lib/core/facets/array/commonality.rb +49 -0
- data/lib/core/facets/array/conjoin.rb +89 -0
- data/lib/core/facets/array/contains.rb +7 -0
- data/lib/core/facets/array/delete.rb +4 -0
- data/lib/core/facets/array/delete_unless.rb +15 -0
- data/lib/core/facets/array/delete_values.rb +50 -0
- data/lib/core/facets/array/delete_values_at.rb +1 -0
- data/lib/core/facets/array/divide.rb +27 -0
- data/lib/core/facets/array/duplicates.rb +24 -0
- data/lib/core/facets/array/each_overlap.rb +25 -0
- data/lib/core/facets/array/each_pair.rb +11 -0
- data/lib/core/facets/array/each_value.rb +6 -0
- data/lib/core/facets/array/entropy.rb +39 -0
- data/lib/core/facets/array/extract_options.rb +31 -0
- data/lib/core/facets/array/first.rb +1 -0
- data/lib/core/facets/array/from.rb +28 -0
- data/lib/core/facets/array/indexable.rb +31 -0
- data/lib/core/facets/array/intersection.rb +25 -0
- data/lib/core/facets/array/last.rb +1 -0
- data/lib/core/facets/array/median.rb +32 -0
- data/lib/core/facets/array/merge.rb +22 -0
- data/lib/core/facets/array/missing.rb +29 -0
- data/lib/core/facets/array/mode.rb +22 -0
- data/lib/core/facets/array/nonuniq.rb +28 -0
- data/lib/core/facets/array/not_empty.rb +13 -0
- data/lib/core/facets/array/occur.rb +38 -0
- data/lib/core/facets/array/occurrence.rb +29 -0
- data/lib/core/facets/array/only.rb +37 -0
- data/lib/core/facets/array/op_pow.rb +12 -0
- data/lib/core/facets/array/pad.rb +41 -0
- data/lib/core/facets/array/peek.rb +1 -0
- data/lib/core/facets/array/poke.rb +1 -0
- data/lib/core/facets/array/probability.rb +39 -0
- data/lib/core/facets/array/pull.rb +30 -0
- data/lib/core/facets/array/recurse.rb +29 -0
- data/lib/core/facets/array/recursively.rb +53 -0
- data/lib/core/facets/array/reject_values.rb +21 -0
- data/lib/core/facets/array/span.rb +24 -0
- data/lib/core/facets/array/splice.rb +31 -0
- data/lib/core/facets/array/split.rb +30 -0
- data/lib/core/facets/array/split_at.rb +25 -0
- data/lib/core/facets/array/squeeze.rb +23 -0
- data/lib/core/facets/array/standard_deviation.rb +23 -0
- data/lib/core/facets/array/step.rb +31 -0
- data/lib/core/facets/array/store.rb +16 -0
- data/lib/core/facets/array/thru.rb +1 -0
- data/lib/core/facets/array/to_h.rb +19 -0
- data/lib/core/facets/array/traverse.rb +50 -0
- data/lib/core/facets/array/uniq_by.rb +24 -0
- data/lib/core/facets/array/unique_permutation.rb +29 -0
- data/lib/core/facets/array/variance.rb +20 -0
- data/lib/core/facets/array/zip.rb +21 -0
- data/lib/core/facets/array.rb +49 -0
- data/lib/core/facets/binding/__callee__.rb +1 -0
- data/lib/core/facets/binding/__method__.rb +1 -0
- data/lib/core/facets/binding/call_stack.rb +1 -0
- data/lib/core/facets/binding/caller.rb +42 -0
- data/lib/core/facets/binding/callstack.rb +1 -0
- data/lib/core/facets/binding/defined.rb +10 -0
- data/lib/core/facets/binding/op.rb +4 -0
- data/lib/core/facets/binding/op_get.rb +25 -0
- data/lib/core/facets/binding/op_set.rb +1 -0
- data/lib/core/facets/binding/self.rb +15 -0
- data/lib/core/facets/binding/with.rb +12 -0
- data/lib/core/facets/binding.rb +12 -0
- data/lib/core/facets/boolean.rb +121 -0
- data/lib/core/facets/cattr.rb +1 -0
- data/lib/core/facets/class/cattr.rb +1 -0
- data/lib/core/facets/class/descendants.rb +36 -0
- data/lib/core/facets/class/hierarchically.rb +12 -0
- data/lib/core/facets/class/methodize.rb +19 -0
- data/lib/core/facets/class/pathize.rb +19 -0
- data/lib/core/facets/class/preallocate.rb +55 -0
- data/lib/core/facets/class/singleton.rb +1 -0
- data/lib/core/facets/class/singleton_class.rb +16 -0
- data/lib/core/facets/class/subclasses.rb +26 -0
- data/lib/core/facets/class/to_proc.rb +25 -0
- data/lib/core/facets/class.rb +9 -0
- data/lib/core/facets/comparable/at_least.rb +1 -0
- data/lib/core/facets/comparable/at_most.rb +1 -0
- data/lib/core/facets/comparable/bound.rb +1 -0
- data/lib/core/facets/comparable/cap.rb +34 -0
- data/lib/core/facets/comparable/clip.rb +38 -0
- data/lib/core/facets/comparable/cmp.rb +41 -0
- data/lib/core/facets/comparable/op_get.rb +45 -0
- data/lib/core/facets/comparable.rb +8 -0
- data/lib/core/facets/denumerable.rb +77 -0
- data/lib/core/facets/dir/ascend.rb +56 -0
- data/lib/core/facets/dir/descend.rb +1 -0
- data/lib/core/facets/dir/each_child.rb +16 -0
- data/lib/core/facets/dir/lookup.rb +20 -0
- data/lib/core/facets/dir/multiglob.rb +78 -0
- data/lib/core/facets/dir/parent.rb +16 -0
- data/lib/core/facets/dir/recurse.rb +35 -0
- data/lib/core/facets/dir.rb +7 -0
- data/lib/core/facets/enumerable/accumulate.rb +67 -0
- data/lib/core/facets/enumerable/apply.rb +20 -0
- data/lib/core/facets/enumerable/associate.rb +6 -0
- data/lib/core/facets/enumerable/cluster.rb +26 -0
- data/lib/core/facets/enumerable/collect_with_index.rb +2 -0
- data/lib/core/facets/enumerable/compact_map.rb +36 -0
- data/lib/core/facets/enumerable/defer.rb +46 -0
- data/lib/core/facets/enumerable/each_by.rb +33 -0
- data/lib/core/facets/enumerable/every.rb +40 -0
- data/lib/core/facets/enumerable/ewise.rb +61 -0
- data/lib/core/facets/enumerable/exclude.rb +16 -0
- data/lib/core/facets/enumerable/expand.rb +15 -0
- data/lib/core/facets/enumerable/filter.rb +33 -0
- data/lib/core/facets/enumerable/find_yield.rb +42 -0
- data/lib/core/facets/enumerable/frequency.rb +24 -0
- data/lib/core/facets/enumerable/graph.rb +34 -0
- data/lib/core/facets/enumerable/hashify.rb +230 -0
- data/lib/core/facets/enumerable/hinge.rb +18 -0
- data/lib/core/facets/enumerable/incase.rb +19 -0
- data/lib/core/facets/enumerable/key_by.rb +27 -0
- data/lib/core/facets/enumerable/map_by.rb +35 -0
- data/lib/core/facets/enumerable/map_detect.rb +1 -0
- data/lib/core/facets/enumerable/map_send.rb +26 -0
- data/lib/core/facets/enumerable/map_to.rb +13 -0
- data/lib/core/facets/enumerable/map_with.rb +21 -0
- data/lib/core/facets/enumerable/map_with_index.rb +23 -0
- data/lib/core/facets/enumerable/mash.rb +34 -0
- data/lib/core/facets/enumerable/modulate.rb +22 -0
- data/lib/core/facets/enumerable/occur.rb +41 -0
- data/lib/core/facets/enumerable/only.rb +56 -0
- data/lib/core/facets/enumerable/organize_by.rb +19 -0
- data/lib/core/facets/enumerable/pair.rb +20 -0
- data/lib/core/facets/enumerable/per.rb +77 -0
- data/lib/core/facets/enumerable/purge.rb +43 -0
- data/lib/core/facets/enumerable/recursively.rb +66 -0
- data/lib/core/facets/enumerable/squeeze.rb +36 -0
- data/lib/core/facets/enumerable/sum.rb +40 -0
- data/lib/core/facets/enumerable/unassociate.rb +23 -0
- data/lib/core/facets/enumerable/uniq_by.rb +13 -0
- data/lib/core/facets/enumerable/value_by.rb +25 -0
- data/lib/core/facets/enumerable/visit.rb +30 -0
- data/lib/core/facets/enumerable/with_position.rb +58 -0
- data/lib/core/facets/enumerable/zip_map.rb +1 -0
- data/lib/core/facets/enumerable.rb +40 -0
- data/lib/core/facets/enumerator/fx.rb +27 -0
- data/lib/core/facets/enumerator/lazy/squeeze.rb +33 -0
- data/lib/core/facets/enumerator.rb +75 -0
- data/lib/core/facets/essentials.rb +65 -0
- data/lib/core/facets/exception/detail.rb +17 -0
- data/lib/core/facets/exception/error_print.rb +80 -0
- data/lib/core/facets/exception/raised.rb +14 -0
- data/lib/core/facets/exception/set_message.rb +10 -0
- data/lib/core/facets/exception/suppress.rb +22 -0
- data/lib/core/facets/exception.rb +4 -0
- data/lib/core/facets/file/append.rb +14 -0
- data/lib/core/facets/file/atomic_id.rb +9 -0
- data/lib/core/facets/file/atomic_open.rb +26 -0
- data/lib/core/facets/file/atomic_write.rb +58 -0
- data/lib/core/facets/file/common_path.rb +17 -0
- data/lib/core/facets/file/create.rb +21 -0
- data/lib/core/facets/file/ext.rb +36 -0
- data/lib/core/facets/file/null.rb +21 -0
- data/lib/core/facets/file/read_binary.rb +18 -0
- data/lib/core/facets/file/read_list.rb +34 -0
- data/lib/core/facets/file/rewrite.rb +90 -0
- data/lib/core/facets/file/rootname.rb +23 -0
- data/lib/core/facets/file/sanitize.rb +18 -0
- data/lib/core/facets/file/split_all.rb +19 -0
- data/lib/core/facets/file/split_root.rb +13 -0
- data/lib/core/facets/file/write.rb +24 -0
- data/lib/core/facets/file/writelines.rb +27 -0
- data/lib/core/facets/file.rb +16 -0
- data/lib/core/facets/filetest/absolute.rb +1 -0
- data/lib/core/facets/filetest/contains.rb +12 -0
- data/lib/core/facets/filetest/relative.rb +38 -0
- data/lib/core/facets/filetest/root.rb +17 -0
- data/lib/core/facets/filetest/safe.rb +24 -0
- data/lib/core/facets/filetest/separator_pattern.rb +19 -0
- data/lib/core/facets/filetest.rb +7 -0
- data/lib/core/facets/float/round_to.rb +1 -0
- data/lib/core/facets/float.rb +2 -0
- data/lib/core/facets/functor.rb +92 -0
- data/lib/core/facets/hash/alias.rb +31 -0
- data/lib/core/facets/hash/argumentize.rb +28 -0
- data/lib/core/facets/hash/at.rb +8 -0
- data/lib/core/facets/hash/autonew.rb +24 -0
- data/lib/core/facets/hash/collate.rb +49 -0
- data/lib/core/facets/hash/count.rb +16 -0
- data/lib/core/facets/hash/data.rb +44 -0
- data/lib/core/facets/hash/dearray_values.rb +46 -0
- data/lib/core/facets/hash/deep_merge.rb +33 -0
- data/lib/core/facets/hash/deep_rekey.rb +54 -0
- data/lib/core/facets/hash/delete.rb +4 -0
- data/lib/core/facets/hash/delete_at.rb +7 -0
- data/lib/core/facets/hash/delete_unless.rb +17 -0
- data/lib/core/facets/hash/delete_values.rb +41 -0
- data/lib/core/facets/hash/diff.rb +17 -0
- data/lib/core/facets/hash/each_with_key.rb +12 -0
- data/lib/core/facets/hash/except.rb +37 -0
- data/lib/core/facets/hash/fetch_nested.rb +20 -0
- data/lib/core/facets/hash/graph.rb +18 -0
- data/lib/core/facets/hash/insert.rb +19 -0
- data/lib/core/facets/hash/inverse.rb +30 -0
- data/lib/core/facets/hash/join.rb +17 -0
- data/lib/core/facets/hash/keys.rb +36 -0
- data/lib/core/facets/hash/mash.rb +1 -0
- data/lib/core/facets/hash/new_with.rb +15 -0
- data/lib/core/facets/hash/only_keys.rb +1 -0
- data/lib/core/facets/hash/op.rb +7 -0
- data/lib/core/facets/hash/op_add.rb +12 -0
- data/lib/core/facets/hash/op_and.rb +33 -0
- data/lib/core/facets/hash/op_mul.rb +18 -0
- data/lib/core/facets/hash/op_or.rb +12 -0
- data/lib/core/facets/hash/op_push.rb +25 -0
- data/lib/core/facets/hash/op_sub.rb +27 -0
- data/lib/core/facets/hash/recurse.rb +29 -0
- data/lib/core/facets/hash/recursively.rb +61 -0
- data/lib/core/facets/hash/rekey.rb +81 -0
- data/lib/core/facets/hash/replace_each.rb +16 -0
- data/lib/core/facets/hash/revalue.rb +61 -0
- data/lib/core/facets/hash/reverse_merge.rb +30 -0
- data/lib/core/facets/hash/slice.rb +49 -0
- data/lib/core/facets/hash/stringify_keys.rb +1 -0
- data/lib/core/facets/hash/subset.rb +27 -0
- data/lib/core/facets/hash/swap.rb +17 -0
- data/lib/core/facets/hash/symbolize_keys.rb +92 -0
- data/lib/core/facets/hash/to_mod.rb +33 -0
- data/lib/core/facets/hash/to_options.rb +1 -0
- data/lib/core/facets/hash/to_proc.rb +39 -0
- data/lib/core/facets/hash/to_struct.rb +17 -0
- data/lib/core/facets/hash/traverse.rb +47 -0
- data/lib/core/facets/hash/update.rb +6 -0
- data/lib/core/facets/hash/update_each.rb +18 -0
- data/lib/core/facets/hash/update_keys.rb +21 -0
- data/lib/core/facets/hash/update_values.rb +20 -0
- data/lib/core/facets/hash/weave.rb +76 -0
- data/lib/core/facets/hash/zip.rb +18 -0
- data/lib/core/facets/hash.rb +53 -0
- data/lib/core/facets/indexable.rb +270 -0
- data/lib/core/facets/integer/bit.rb +1 -0
- data/lib/core/facets/integer/bitmask.rb +99 -0
- data/lib/core/facets/integer/factorial.rb +21 -0
- data/lib/core/facets/integer/multiple.rb +19 -0
- data/lib/core/facets/integer/of.rb +18 -0
- data/lib/core/facets/integer/ordinal.rb +24 -0
- data/lib/core/facets/integer/roman.rb +1 -0
- data/lib/core/facets/integer.rb +8 -0
- data/lib/core/facets/kernel/__class__.rb +9 -0
- data/lib/core/facets/kernel/__dir__.rb +28 -0
- data/lib/core/facets/kernel/__get__.rb +15 -0
- data/lib/core/facets/kernel/__set__.rb +1 -0
- data/lib/core/facets/kernel/as.rb +116 -0
- data/lib/core/facets/kernel/ask.rb +28 -0
- data/lib/core/facets/kernel/assign.rb +74 -0
- data/lib/core/facets/kernel/assign_from.rb +1 -0
- data/lib/core/facets/kernel/attr_singleton.rb +59 -0
- data/lib/core/facets/kernel/blank.rb +84 -0
- data/lib/core/facets/kernel/call_stack.rb +1 -0
- data/lib/core/facets/kernel/callstack.rb +56 -0
- data/lib/core/facets/kernel/case.rb +8 -0
- data/lib/core/facets/kernel/complete.rb +26 -0
- data/lib/core/facets/kernel/d.rb +27 -0
- data/lib/core/facets/kernel/deep_clone.rb +27 -0
- data/lib/core/facets/kernel/deep_copy.rb +14 -0
- data/lib/core/facets/kernel/demo.rb +30 -0
- data/lib/core/facets/kernel/disable_warnings.rb +26 -0
- data/lib/core/facets/kernel/eigen.rb +2 -0
- data/lib/core/facets/kernel/eigenclass.rb +24 -0
- data/lib/core/facets/kernel/enable_warnings.rb +1 -0
- data/lib/core/facets/kernel/ergo.rb +43 -0
- data/lib/core/facets/kernel/extend.rb +28 -0
- data/lib/core/facets/kernel/extension.rb +12 -0
- data/lib/core/facets/kernel/false.rb +2 -0
- data/lib/core/facets/kernel/here.rb +11 -0
- data/lib/core/facets/kernel/hierarchical_send.rb +44 -0
- data/lib/core/facets/kernel/identical.rb +4 -0
- data/lib/core/facets/kernel/in.rb +13 -0
- data/lib/core/facets/kernel/instance_assign.rb +22 -0
- data/lib/core/facets/kernel/instance_class.rb +26 -0
- data/lib/core/facets/kernel/instance_exec.rb +47 -0
- data/lib/core/facets/kernel/instance_extract.rb +22 -0
- data/lib/core/facets/kernel/instance_replace.rb +40 -0
- data/lib/core/facets/kernel/instance_send.rb +7 -0
- data/lib/core/facets/kernel/like.rb +19 -0
- data/lib/core/facets/kernel/load_all.rb +1 -0
- data/lib/core/facets/kernel/load_relative.rb +25 -0
- data/lib/core/facets/kernel/maybe.rb +19 -0
- data/lib/core/facets/kernel/memo.rb +44 -0
- data/lib/core/facets/kernel/meta.rb +35 -0
- data/lib/core/facets/kernel/meta_alias.rb +23 -0
- data/lib/core/facets/kernel/meta_class.rb +17 -0
- data/lib/core/facets/kernel/meta_def.rb +24 -0
- data/lib/core/facets/kernel/meta_eval.rb +20 -0
- data/lib/core/facets/kernel/method.rb +50 -0
- data/lib/core/facets/kernel/no.rb +1 -0
- data/lib/core/facets/kernel/not.rb +37 -0
- data/lib/core/facets/kernel/not_nil.rb +18 -0
- data/lib/core/facets/kernel/object_class.rb +10 -0
- data/lib/core/facets/kernel/object_hexid.rb +33 -0
- data/lib/core/facets/kernel/object_send.rb +30 -0
- data/lib/core/facets/kernel/p.rb +24 -0
- data/lib/core/facets/kernel/presence.rb +1 -0
- data/lib/core/facets/kernel/present.rb +1 -0
- data/lib/core/facets/kernel/qua_class.rb +31 -0
- data/lib/core/facets/kernel/require_all.rb +42 -0
- data/lib/core/facets/kernel/respond.rb +32 -0
- data/lib/core/facets/kernel/returning.rb +27 -0
- data/lib/core/facets/kernel/silence.rb +73 -0
- data/lib/core/facets/kernel/silence_warnings.rb +1 -0
- data/lib/core/facets/kernel/singleton_class.rb +10 -0
- data/lib/core/facets/kernel/super_method.rb +11 -0
- data/lib/core/facets/kernel/tap.rb +36 -0
- data/lib/core/facets/kernel/temporarily.rb +23 -0
- data/lib/core/facets/kernel/trap_chain.rb +28 -0
- data/lib/core/facets/kernel/true.rb +26 -0
- data/lib/core/facets/kernel/try.rb +58 -0
- data/lib/core/facets/kernel/val.rb +19 -0
- data/lib/core/facets/kernel/with.rb +20 -0
- data/lib/core/facets/kernel/writers.rb +91 -0
- data/lib/core/facets/kernel/y.rb +23 -0
- data/lib/core/facets/kernel/yes.rb +25 -0
- data/lib/core/facets/kernel.rb +75 -0
- data/lib/core/facets/lazy.rb +237 -0
- data/lib/core/facets/load_path/search.rb +16 -0
- data/lib/core/facets/load_path.rb +1 -0
- data/lib/core/facets/matchdata/match.rb +15 -0
- data/lib/core/facets/matchdata/matchset.rb +44 -0
- data/lib/core/facets/matchdata/matchtree.rb +2 -0
- data/lib/core/facets/matchdata.rb +3 -0
- data/lib/core/facets/metaid.rb +7 -0
- data/lib/core/facets/method/composition.rb +96 -0
- data/lib/core/facets/method/curry.rb +13 -0
- data/lib/core/facets/method/memoize.rb +17 -0
- data/lib/core/facets/method/op_mul.rb +1 -0
- data/lib/core/facets/method/op_pow.rb +1 -0
- data/lib/core/facets/method/partial.rb +10 -0
- data/lib/core/facets/method/public.rb +33 -0
- data/lib/core/facets/method.rb +5 -0
- data/lib/core/facets/module/abstract.rb +24 -0
- data/lib/core/facets/module/alias_accessor.rb +45 -0
- data/lib/core/facets/module/alias_class_method.rb +11 -0
- data/lib/core/facets/module/alias_method_chain.rb +67 -0
- data/lib/core/facets/module/alias_module_function.rb +30 -0
- data/lib/core/facets/module/all_instance_methods.rb +19 -0
- data/lib/core/facets/module/ancestor.rb +16 -0
- data/lib/core/facets/module/anonymous.rb +25 -0
- data/lib/core/facets/module/attr_class_accessor.rb +51 -0
- data/lib/core/facets/module/attr_setter.rb +52 -0
- data/lib/core/facets/module/attr_tester.rb +56 -0
- data/lib/core/facets/module/attr_validator.rb +46 -0
- data/lib/core/facets/module/basename.rb +1 -0
- data/lib/core/facets/module/can.rb +20 -0
- data/lib/core/facets/module/cattr.rb +1 -0
- data/lib/core/facets/module/class.rb +12 -0
- data/lib/core/facets/module/class_accessor.rb +46 -0
- data/lib/core/facets/module/class_def.rb +2 -0
- data/lib/core/facets/module/class_extend.rb +92 -0
- data/lib/core/facets/module/class_inheritor.rb +80 -0
- data/lib/core/facets/module/class_method_defined.rb +1 -0
- data/lib/core/facets/module/copy_inheritor.rb +45 -0
- data/lib/core/facets/module/enclosure.rb +94 -0
- data/lib/core/facets/module/enclosures.rb +1 -0
- data/lib/core/facets/module/extend.rb +1 -0
- data/lib/core/facets/module/home.rb +90 -0
- data/lib/core/facets/module/homename.rb +1 -0
- data/lib/core/facets/module/housing.rb +1 -0
- data/lib/core/facets/module/include_as.rb +1 -0
- data/lib/core/facets/module/include_function_module.rb +25 -0
- data/lib/core/facets/module/instance_function.rb +94 -0
- data/lib/core/facets/module/instance_method.rb +25 -0
- data/lib/core/facets/module/instance_method_defined.rb +23 -0
- data/lib/core/facets/module/integrate.rb +49 -0
- data/lib/core/facets/module/is.rb +57 -0
- data/lib/core/facets/module/lastname.rb +30 -0
- data/lib/core/facets/module/let.rb +31 -0
- data/lib/core/facets/module/mattr.rb +296 -0
- data/lib/core/facets/module/memoize.rb +16 -0
- data/lib/core/facets/module/method_clash.rb +66 -0
- data/lib/core/facets/module/method_space.rb +107 -0
- data/lib/core/facets/module/methodize.rb +20 -0
- data/lib/core/facets/module/modname.rb +1 -0
- data/lib/core/facets/module/module_def.rb +31 -0
- data/lib/core/facets/module/module_load.rb +83 -0
- data/lib/core/facets/module/nodef.rb +13 -0
- data/lib/core/facets/module/op.rb +107 -0
- data/lib/core/facets/module/op_add.rb +1 -0
- data/lib/core/facets/module/op_mul.rb +1 -0
- data/lib/core/facets/module/op_sub.rb +1 -0
- data/lib/core/facets/module/pathize.rb +20 -0
- data/lib/core/facets/module/preextend.rb +32 -0
- data/lib/core/facets/module/redefine_method.rb +37 -0
- data/lib/core/facets/module/redirect_method.rb +46 -0
- data/lib/core/facets/module/remove.rb +1 -0
- data/lib/core/facets/module/rename_method.rb +30 -0
- data/lib/core/facets/module/revise.rb +41 -0
- data/lib/core/facets/module/set.rb +36 -0
- data/lib/core/facets/module/singleton_method_defined.rb +1 -0
- data/lib/core/facets/module/spacename.rb +25 -0
- data/lib/core/facets/module/to_obj.rb +20 -0
- data/lib/core/facets/module/wrap_method.rb +35 -0
- data/lib/core/facets/module.rb +60 -0
- data/lib/core/facets/na.rb +21 -0
- data/lib/core/facets/nilclass/ergo.rb +1 -0
- data/lib/core/facets/nilclass.rb +2 -0
- data/lib/core/facets/numeric/approx.rb +39 -0
- data/lib/core/facets/numeric/close.rb +1 -0
- data/lib/core/facets/numeric/delimit.rb +20 -0
- data/lib/core/facets/numeric/distance.rb +14 -0
- data/lib/core/facets/numeric/length.rb +10 -0
- data/lib/core/facets/numeric/negative.rb +1 -0
- data/lib/core/facets/numeric/positive.rb +15 -0
- data/lib/core/facets/numeric/range.rb +12 -0
- data/lib/core/facets/numeric/round_to.rb +32 -0
- data/lib/core/facets/numeric/spacing.rb +20 -0
- data/lib/core/facets/numeric.rb +8 -0
- data/lib/core/facets/object/clone.rb +1 -0
- data/lib/core/facets/object/dup.rb +79 -0
- data/lib/core/facets/object/itself.rb +16 -0
- data/lib/core/facets/object/object_state.rb +77 -0
- data/lib/core/facets/object/try_dup.rb +1 -0
- data/lib/core/facets/object.rb +7 -0
- data/lib/core/facets/objectspace/classes.rb +11 -0
- data/lib/core/facets/objectspace/op_fetch.rb +3 -0
- data/lib/core/facets/objectspace.rb +3 -0
- data/lib/core/facets/proc/bind.rb +24 -0
- data/lib/core/facets/proc/bind_to.rb +17 -0
- data/lib/core/facets/proc/compose.rb +42 -0
- data/lib/core/facets/proc/partial.rb +33 -0
- data/lib/core/facets/proc/to_method.rb +38 -0
- data/lib/core/facets/proc/update.rb +9 -0
- data/lib/core/facets/proc/wrap.rb +17 -0
- data/lib/core/facets/proc.rb +7 -0
- data/lib/core/facets/process/daemon.rb +32 -0
- data/lib/core/facets/process.rb +2 -0
- data/lib/core/facets/range/combine.rb +47 -0
- data/lib/core/facets/range/nudge.rb +27 -0
- data/lib/core/facets/range/op_add.rb +15 -0
- data/lib/core/facets/range/op_sub.rb +45 -0
- data/lib/core/facets/range/overlap.rb +12 -0
- data/lib/core/facets/range/quantile.rb +18 -0
- data/lib/core/facets/range/to_rng.rb +26 -0
- data/lib/core/facets/range/umbrella.rb +1 -0
- data/lib/core/facets/range/within.rb +64 -0
- data/lib/core/facets/range.rb +9 -0
- data/lib/core/facets/regexp/arity.rb +17 -0
- data/lib/core/facets/regexp/multiline.rb +13 -0
- data/lib/core/facets/regexp/op_add.rb +18 -0
- data/lib/core/facets/regexp/op_or.rb +15 -0
- data/lib/core/facets/regexp/to_proc.rb +13 -0
- data/lib/core/facets/regexp/to_re.rb +28 -0
- data/lib/core/facets/regexp.rb +6 -0
- data/lib/core/facets/roman.rb +89 -0
- data/lib/core/facets/string/acronym.rb +11 -0
- data/lib/core/facets/string/align.rb +125 -0
- data/lib/core/facets/string/ascii_only.rb +52 -0
- data/lib/core/facets/string/bracket.rb +64 -0
- data/lib/core/facets/string/briefcase.rb +1 -0
- data/lib/core/facets/string/camelcase.rb +73 -0
- data/lib/core/facets/string/capitalized.rb +49 -0
- data/lib/core/facets/string/cleanlines.rb +27 -0
- data/lib/core/facets/string/cleave.rb +36 -0
- data/lib/core/facets/string/cmp.rb +1 -0
- data/lib/core/facets/string/compress_lines.rb +17 -0
- data/lib/core/facets/string/crypt.rb +22 -0
- data/lib/core/facets/string/divide.rb +18 -0
- data/lib/core/facets/string/each_match.rb +1 -0
- data/lib/core/facets/string/each_word.rb +17 -0
- data/lib/core/facets/string/edit_distance.rb +124 -0
- data/lib/core/facets/string/ends_with.rb +1 -0
- data/lib/core/facets/string/exclude.rb +10 -0
- data/lib/core/facets/string/expand_tab.rb +35 -0
- data/lib/core/facets/string/file.rb +21 -0
- data/lib/core/facets/string/fold.rb +39 -0
- data/lib/core/facets/string/indent.rb +76 -0
- data/lib/core/facets/string/index_all.rb +24 -0
- data/lib/core/facets/string/indexable.rb +7 -0
- data/lib/core/facets/string/interpolate.rb +23 -0
- data/lib/core/facets/string/lchomp.rb +33 -0
- data/lib/core/facets/string/line_wrap.rb +18 -0
- data/lib/core/facets/string/linear.rb +19 -0
- data/lib/core/facets/string/lowercase.rb +1 -0
- data/lib/core/facets/string/margin.rb +55 -0
- data/lib/core/facets/string/methodize.rb +26 -0
- data/lib/core/facets/string/modulize.rb +31 -0
- data/lib/core/facets/string/mscan.rb +22 -0
- data/lib/core/facets/string/natcmp.rb +88 -0
- data/lib/core/facets/string/nchar.rb +32 -0
- data/lib/core/facets/string/newlines.rb +32 -0
- data/lib/core/facets/string/number.rb +14 -0
- data/lib/core/facets/string/op_div.rb +14 -0
- data/lib/core/facets/string/op_sub.rb +1 -0
- data/lib/core/facets/string/outdent.rb +1 -0
- data/lib/core/facets/string/pathize.rb +32 -0
- data/lib/core/facets/string/quote.rb +93 -0
- data/lib/core/facets/string/random.rb +44 -0
- data/lib/core/facets/string/range.rb +60 -0
- data/lib/core/facets/string/range_all.rb +1 -0
- data/lib/core/facets/string/range_of_line.rb +1 -0
- data/lib/core/facets/string/remove.rb +30 -0
- data/lib/core/facets/string/rewrite.rb +24 -0
- data/lib/core/facets/string/roman.rb +1 -0
- data/lib/core/facets/string/rotate.rb +24 -0
- data/lib/core/facets/string/shatter.rb +22 -0
- data/lib/core/facets/string/similarity.rb +90 -0
- data/lib/core/facets/string/snakecase.rb +31 -0
- data/lib/core/facets/string/splice.rb +33 -0
- data/lib/core/facets/string/squish.rb +22 -0
- data/lib/core/facets/string/starts_with.rb +5 -0
- data/lib/core/facets/string/store.rb +7 -0
- data/lib/core/facets/string/subtract.rb +4 -0
- data/lib/core/facets/string/titlecase.rb +27 -0
- data/lib/core/facets/string/to_re.rb +26 -0
- data/lib/core/facets/string/to_rx.rb +1 -0
- data/lib/core/facets/string/trim.rb +45 -0
- data/lib/core/facets/string/unbracket.rb +1 -0
- data/lib/core/facets/string/underscore.rb +1 -0
- data/lib/core/facets/string/unfold.rb +32 -0
- data/lib/core/facets/string/unindent.rb +1 -0
- data/lib/core/facets/string/unquote.rb +1 -0
- data/lib/core/facets/string/uppercase.rb +23 -0
- data/lib/core/facets/string/variablize.rb +13 -0
- data/lib/core/facets/string/word_wrap.rb +32 -0
- data/lib/core/facets/string/words.rb +24 -0
- data/lib/core/facets/string/xor.rb +26 -0
- data/lib/core/facets/string.rb +67 -0
- data/lib/core/facets/struct/attributes.rb +15 -0
- data/lib/core/facets/struct/replace.rb +8 -0
- data/lib/core/facets/struct.rb +3 -0
- data/lib/core/facets/symbol/as_s.rb +19 -0
- data/lib/core/facets/symbol/bang.rb +1 -0
- data/lib/core/facets/symbol/call.rb +29 -0
- data/lib/core/facets/symbol/chomp.rb +24 -0
- data/lib/core/facets/symbol/generate.rb +24 -0
- data/lib/core/facets/symbol/not.rb +29 -0
- data/lib/core/facets/symbol/op_div.rb +21 -0
- data/lib/core/facets/symbol/plain.rb +51 -0
- data/lib/core/facets/symbol/query.rb +1 -0
- data/lib/core/facets/symbol/reader.rb +1 -0
- data/lib/core/facets/symbol/setter.rb +1 -0
- data/lib/core/facets/symbol/succ.rb +23 -0
- data/lib/core/facets/symbol/thrown.rb +22 -0
- data/lib/core/facets/symbol/variablize.rb +14 -0
- data/lib/core/facets/symbol/writer.rb +1 -0
- data/lib/core/facets/symbol.rb +14 -0
- data/lib/core/facets/time/ago.rb +1 -0
- data/lib/core/facets/time/change.rb +46 -0
- data/lib/core/facets/time/dst_adjustment.rb +24 -0
- data/lib/core/facets/time/elapse.rb +18 -0
- data/lib/core/facets/time/future.rb +16 -0
- data/lib/core/facets/time/hence.rb +1 -0
- data/lib/core/facets/time/in.rb +1 -0
- data/lib/core/facets/time/less.rb +1 -0
- data/lib/core/facets/time/past.rb +1 -0
- data/lib/core/facets/time/round_to.rb +21 -0
- data/lib/core/facets/time/set.rb +27 -0
- data/lib/core/facets/time/shift.rb +97 -0
- data/lib/core/facets/time/stamp.rb +47 -0
- data/lib/core/facets/time/to_time.rb +21 -0
- data/lib/core/facets/time/trunc.rb +15 -0
- data/lib/core/facets/time.rb +16 -0
- data/lib/core/facets/unboundmethod/arguments.rb +44 -0
- data/lib/core/facets/unboundmethod.rb +2 -0
- data/lib/core/facets/version.rb +18 -0
- data/lib/core/facets.rb +40 -0
- data/lib/core/facets.yml +80 -0
- data/lib/facets-glimmer/ext/kernel.rb +8 -0
- data/lib/facets-glimmer.rb +33 -0
- data/lib/standard/facets/against.rb +53 -0
- data/lib/standard/facets/argvector.rb +343 -0
- data/lib/standard/facets/binding/block_exec.rb +44 -0
- data/lib/standard/facets/cgi/esc.rb +11 -0
- data/lib/standard/facets/cgi/escape_html.rb +63 -0
- data/lib/standard/facets/cgi/marshal.rb +20 -0
- data/lib/standard/facets/cgi.rb +6 -0
- data/lib/standard/facets/cli.rb +54 -0
- data/lib/standard/facets/cloneable.rb +67 -0
- data/lib/standard/facets/continuation.rb +56 -0
- data/lib/standard/facets/date/cmp.rb +32 -0
- data/lib/standard/facets/date.rb +434 -0
- data/lib/standard/facets/digest/base64digest.rb +45 -0
- data/lib/standard/facets/digest/salted_digest.rb +44 -0
- data/lib/standard/facets/digest.rb +2 -0
- data/lib/standard/facets/enumargs.rb +191 -0
- data/lib/standard/facets/equitable.rb +76 -0
- data/lib/standard/facets/erb.rb +66 -0
- data/lib/standard/facets/fileutils/amass.rb +34 -0
- data/lib/standard/facets/fileutils/cp_rx.rb +42 -0
- data/lib/standard/facets/fileutils/head.rb +1 -0
- data/lib/standard/facets/fileutils/ln_r.rb +98 -0
- data/lib/standard/facets/fileutils/outofdate.rb +38 -0
- data/lib/standard/facets/fileutils/safe_ln.rb +27 -0
- data/lib/standard/facets/fileutils/slice.rb +55 -0
- data/lib/standard/facets/fileutils/stage.rb +66 -0
- data/lib/standard/facets/fileutils/tail.rb +1 -0
- data/lib/standard/facets/fileutils/wc.rb +63 -0
- data/lib/standard/facets/fileutils/whereis.rb +66 -0
- data/lib/standard/facets/fileutils/which.rb +60 -0
- data/lib/standard/facets/fileutils.rb +13 -0
- data/lib/standard/facets/find/select.rb +16 -0
- data/lib/standard/facets/find.rb +2 -0
- data/lib/standard/facets/gem/search.rb +18 -0
- data/lib/standard/facets/gem/specification/current_specs.rb +21 -0
- data/lib/standard/facets/gem/specification/find_requireable_file.rb +21 -0
- data/lib/standard/facets/getoptlong.rb +59 -0
- data/lib/standard/facets/hash_builder.rb +46 -0
- data/lib/standard/facets/instantiable.rb +25 -0
- data/lib/standard/facets/interval.rb +277 -0
- data/lib/standard/facets/load_monitor.rb +26 -0
- data/lib/standard/facets/math/abs.rb +8 -0
- data/lib/standard/facets/math/acosec.rb +1 -0
- data/lib/standard/facets/math/acot.rb +8 -0
- data/lib/standard/facets/math/acoth.rb +8 -0
- data/lib/standard/facets/math/acsc.rb +13 -0
- data/lib/standard/facets/math/acsch.rb +8 -0
- data/lib/standard/facets/math/amd.rb +17 -0
- data/lib/standard/facets/math/approx_equal.rb +15 -0
- data/lib/standard/facets/math/asec.rb +8 -0
- data/lib/standard/facets/math/asech.rb +8 -0
- data/lib/standard/facets/math/atkinson_index.rb +16 -0
- data/lib/standard/facets/math/beta.rb +14 -0
- data/lib/standard/facets/math/cdf.rb +10 -0
- data/lib/standard/facets/math/ceil.rb +8 -0
- data/lib/standard/facets/math/cosec.rb +1 -0
- data/lib/standard/facets/math/cosech.rb +1 -0
- data/lib/standard/facets/math/cot.rb +8 -0
- data/lib/standard/facets/math/coth.rb +8 -0
- data/lib/standard/facets/math/csc.rb +13 -0
- data/lib/standard/facets/math/csch.rb +13 -0
- data/lib/standard/facets/math/delta.rb +9 -0
- data/lib/standard/facets/math/distance.rb +19 -0
- data/lib/standard/facets/math/ec.rb +5 -0
- data/lib/standard/facets/math/epsilon.rb +21 -0
- data/lib/standard/facets/math/exp10.rb +8 -0
- data/lib/standard/facets/math/exp2.rb +8 -0
- data/lib/standard/facets/math/factorial.rb +37 -0
- data/lib/standard/facets/math/floor.rb +8 -0
- data/lib/standard/facets/math/gcd.rb +23 -0
- data/lib/standard/facets/math/gini_coefficient.rb +33 -0
- data/lib/standard/facets/math/kldivergence.rb +19 -0
- data/lib/standard/facets/math/lcm.rb +15 -0
- data/lib/standard/facets/math/lgamma.rb +23 -0
- data/lib/standard/facets/math/linsolve.rb +12 -0
- data/lib/standard/facets/math/lngamma.rb +18 -0
- data/lib/standard/facets/math/log2.rb +14 -0
- data/lib/standard/facets/math/max.rb +1 -0
- data/lib/standard/facets/math/mean.rb +16 -0
- data/lib/standard/facets/math/median.rb +30 -0
- data/lib/standard/facets/math/min.rb +35 -0
- data/lib/standard/facets/math/percentile.rb +40 -0
- data/lib/standard/facets/math/pow.rb +13 -0
- data/lib/standard/facets/math/pstd.rb +1 -0
- data/lib/standard/facets/math/pvariance.rb +1 -0
- data/lib/standard/facets/math/rmd.rb +16 -0
- data/lib/standard/facets/math/root.rb +8 -0
- data/lib/standard/facets/math/round.rb +9 -0
- data/lib/standard/facets/math/sec.rb +8 -0
- data/lib/standard/facets/math/sech.rb +8 -0
- data/lib/standard/facets/math/sign.rb +20 -0
- data/lib/standard/facets/math/sinc.rb +8 -0
- data/lib/standard/facets/math/sqr.rb +8 -0
- data/lib/standard/facets/math/sqsolve.rb +55 -0
- data/lib/standard/facets/math/std.rb +27 -0
- data/lib/standard/facets/math/stderr.rb +1 -0
- data/lib/standard/facets/math/sum.rb +16 -0
- data/lib/standard/facets/math/summed_sqdevs.rb +14 -0
- data/lib/standard/facets/math/tau.rb +5 -0
- data/lib/standard/facets/math/tgamma.rb +10 -0
- data/lib/standard/facets/math/theil_index.rb +24 -0
- data/lib/standard/facets/math/variance.rb +31 -0
- data/lib/standard/facets/math.rb +58 -0
- data/lib/standard/facets/memoizable.rb +141 -0
- data/lib/standard/facets/memoizer.rb +63 -0
- data/lib/standard/facets/multipliers.rb +65 -0
- data/lib/standard/facets/multiton.rb +387 -0
- data/lib/standard/facets/net/http.rb +51 -0
- data/lib/standard/facets/nullclass.rb +38 -0
- data/lib/standard/facets/opesc.rb +79 -0
- data/lib/standard/facets/ostruct/each.rb +11 -0
- data/lib/standard/facets/ostruct/initialize.rb +48 -0
- data/lib/standard/facets/ostruct/merge.rb +21 -0
- data/lib/standard/facets/ostruct/op_fetch.rb +29 -0
- data/lib/standard/facets/ostruct/op_store.rb +1 -0
- data/lib/standard/facets/ostruct/to_h.rb +10 -0
- data/lib/standard/facets/ostruct/to_ostruct.rb +65 -0
- data/lib/standard/facets/ostruct.rb +89 -0
- data/lib/standard/facets/pathname/chdir.rb +15 -0
- data/lib/standard/facets/pathname/empty.rb +10 -0
- data/lib/standard/facets/pathname/exists.rb +6 -0
- data/lib/standard/facets/pathname/glob.rb +57 -0
- data/lib/standard/facets/pathname/home.rb +12 -0
- data/lib/standard/facets/pathname/null.rb +20 -0
- data/lib/standard/facets/pathname/op_div.rb +15 -0
- data/lib/standard/facets/pathname/op_fetch.rb +13 -0
- data/lib/standard/facets/pathname/outofdate.rb +13 -0
- data/lib/standard/facets/pathname/readline.rb +13 -0
- data/lib/standard/facets/pathname/root.rb +10 -0
- data/lib/standard/facets/pathname/rootname.rb +10 -0
- data/lib/standard/facets/pathname/safe.rb +15 -0
- data/lib/standard/facets/pathname/split_root.rb +9 -0
- data/lib/standard/facets/pathname/to_path.rb +28 -0
- data/lib/standard/facets/pathname/to_str.rb +8 -0
- data/lib/standard/facets/pathname/uptodate.rb +11 -0
- data/lib/standard/facets/pathname/visit.rb +38 -0
- data/lib/standard/facets/pathname/work.rb +10 -0
- data/lib/standard/facets/pathname.rb +56 -0
- data/lib/standard/facets/platform.rb +377 -0
- data/lib/standard/facets/random.rb +485 -0
- data/lib/standard/facets/rbconfig.rb +78 -0
- data/lib/standard/facets/set.rb +36 -0
- data/lib/standard/facets/shellwords.rb +115 -0
- data/lib/standard/facets/strscan.rb +16 -0
- data/lib/standard/facets/thread.rb +98 -0
- data/lib/standard/facets/timer.rb +217 -0
- data/lib/standard/facets/tuple.rb +280 -0
- data/lib/standard/facets/uri/cgi_escape.rb +46 -0
- data/lib/standard/facets/uri/cgi_parse.rb +1 -0
- data/lib/standard/facets/uri/cgi_unescape.rb +1 -0
- data/lib/standard/facets/uri/decode.rb +32 -0
- data/lib/standard/facets/uri/parameters.rb +63 -0
- data/lib/standard/facets/uri/query.rb +148 -0
- data/lib/standard/facets/uri.rb +40 -0
- data/lib/standard/facets/yaml/file.rb +41 -0
- data/lib/standard/facets/yaml/kernel.rb +29 -0
- data/lib/standard/facets/yaml/read.rb +12 -0
- data/lib/standard/facets/yaml.rb +6 -0
- data/lib/standard/facets/zlib.rb +38 -0
- data/test/core/array/test_arrange.rb +37 -0
- data/test/core/array/test_average.rb +16 -0
- data/test/core/array/test_before.rb +48 -0
- data/test/core/array/test_collapse.rb +23 -0
- data/test/core/array/test_commonality.rb +35 -0
- data/test/core/array/test_conjoin.rb +50 -0
- data/test/core/array/test_contains.rb +14 -0
- data/test/core/array/test_delete.rb +42 -0
- data/test/core/array/test_delete_unless.rb +17 -0
- data/test/core/array/test_delete_values.rb +31 -0
- data/test/core/array/test_divide.rb +24 -0
- data/test/core/array/test_duplicates.rb +29 -0
- data/test/core/array/test_each_overlap.rb +31 -0
- data/test/core/array/test_each_pair.rb +16 -0
- data/test/core/array/test_each_value.rb +16 -0
- data/test/core/array/test_entropy.rb +23 -0
- data/test/core/array/test_extract_options.rb +28 -0
- data/test/core/array/test_first.rb +17 -0
- data/test/core/array/test_from.rb +42 -0
- data/test/core/array/test_intersection.rb +19 -0
- data/test/core/array/test_last.rb +17 -0
- data/test/core/array/test_median.rb +27 -0
- data/test/core/array/test_merge.rb +27 -0
- data/test/core/array/test_missing.rb +12 -0
- data/test/core/array/test_mode.rb +17 -0
- data/test/core/array/test_nonuniq.rb +25 -0
- data/test/core/array/test_not_empty.rb +17 -0
- data/test/core/array/test_occur.rb +52 -0
- data/test/core/array/test_occurrence.rb +20 -0
- data/test/core/array/test_only.rb +17 -0
- data/test/core/array/test_op_pow.rb +13 -0
- data/test/core/array/test_pad.rb +40 -0
- data/test/core/array/test_peek.rb +28 -0
- data/test/core/array/test_poke.rb +21 -0
- data/test/core/array/test_probability.rb +18 -0
- data/test/core/array/test_pull.rb +15 -0
- data/test/core/array/test_recurse.rb +40 -0
- data/test/core/array/test_recursively.rb +33 -0
- data/test/core/array/test_reject_values.rb +17 -0
- data/test/core/array/test_span.rb +18 -0
- data/test/core/array/test_splice.rb +21 -0
- data/test/core/array/test_split.rb +22 -0
- data/test/core/array/test_split_at.rb +26 -0
- data/test/core/array/test_squeeze.rb +22 -0
- data/test/core/array/test_standard_deviation.rb +18 -0
- data/test/core/array/test_step.rb +28 -0
- data/test/core/array/test_store.rb +22 -0
- data/test/core/array/test_to_h.rb +14 -0
- data/test/core/array/test_traverse.rb +26 -0
- data/test/core/array/test_uniq_by.rb +24 -0
- data/test/core/array/test_unique_permutation.rb +23 -0
- data/test/core/array/test_variance.rb +17 -0
- data/test/core/array/test_zip.rb +13 -0
- data/test/core/binding/test_caller.rb +69 -0
- data/test/core/binding/test_defined.rb +18 -0
- data/test/core/binding/test_op.rb +24 -0
- data/test/core/binding/test_self.rb +16 -0
- data/test/core/class/test_descendents.rb +19 -0
- data/test/core/class/test_preallocate.rb +32 -0
- data/test/core/class/test_subclasses.rb +21 -0
- data/test/core/class/test_to_proc.rb +16 -0
- data/test/core/comparable/test_bound.rb +32 -0
- data/test/core/comparable/test_cap.rb +36 -0
- data/test/core/comparable/test_clip.rb +31 -0
- data/test/core/comparable/test_cmp.rb +16 -0
- data/test/core/comparable/test_op_get.rb +61 -0
- data/test/core/denumerable_tc.rb +194 -0
- data/test/core/dir/test_ascend.rb +40 -0
- data/test/core/dir/test_descend.rb +24 -0
- data/test/core/dir/test_each_child.rb +22 -0
- data/test/core/dir/test_multiglob.rb +25 -0
- data/test/core/dir/test_parent.rb +14 -0
- data/test/core/dir/test_recurse.rb +26 -0
- data/test/core/enumerable/test_accumulate.rb +44 -0
- data/test/core/enumerable/test_cluster.rb +36 -0
- data/test/core/enumerable/test_compact_map.rb +32 -0
- data/test/core/enumerable/test_defer.rb +27 -0
- data/test/core/enumerable/test_each_by.rb +49 -0
- data/test/core/enumerable/test_every.rb +33 -0
- data/test/core/enumerable/test_ewise.rb +30 -0
- data/test/core/enumerable/test_exclude.rb +15 -0
- data/test/core/enumerable/test_expand.rb +15 -0
- data/test/core/enumerable/test_filter.rb +19 -0
- data/test/core/enumerable/test_find_yield.rb +96 -0
- data/test/core/enumerable/test_frequency.rb +15 -0
- data/test/core/enumerable/test_graph.rb +42 -0
- data/test/core/enumerable/test_hashify.rb +113 -0
- data/test/core/enumerable/test_key_by.rb +22 -0
- data/test/core/enumerable/test_map_by.rb +27 -0
- data/test/core/enumerable/test_map_send.rb +26 -0
- data/test/core/enumerable/test_map_with_index.rb +23 -0
- data/test/core/enumerable/test_mash.rb +17 -0
- data/test/core/enumerable/test_modulate.rb +17 -0
- data/test/core/enumerable/test_occur.rb +40 -0
- data/test/core/enumerable/test_only.rb +40 -0
- data/test/core/enumerable/test_per.rb +19 -0
- data/test/core/enumerable/test_purge.rb +22 -0
- data/test/core/enumerable/test_recursively.rb +33 -0
- data/test/core/enumerable/test_squeeze.rb +35 -0
- data/test/core/enumerable/test_sum.rb +40 -0
- data/test/core/enumerable/test_uniq_by.rb +25 -0
- data/test/core/enumerable/test_visit.rb +14 -0
- data/test/core/enumerable/test_with_position.rb +42 -0
- data/test/core/enumerator/lazy/test_squeeze.rb +33 -0
- data/test/core/enumerator/test_fx.rb +16 -0
- data/test/core/enumerator/test_new.rb +21 -0
- data/test/core/enumerator_tc.rb +40 -0
- data/test/core/exception/test_detail.rb +15 -0
- data/test/core/exception/test_raised.rb +15 -0
- data/test/core/exception/test_suppress.rb +16 -0
- data/test/core/file/test_append.rb +22 -0
- data/test/core/file/test_create.rb +17 -0
- data/test/core/file/test_ext.rb +31 -0
- data/test/core/file/test_null.rb +14 -0
- data/test/core/file/test_read_binary.rb +19 -0
- data/test/core/file/test_read_list.rb +16 -0
- data/test/core/file/test_rewrite.rb +35 -0
- data/test/core/file/test_rootname.rb +13 -0
- data/test/core/file/test_sanitize.rb +32 -0
- data/test/core/file/test_split_all.rb +14 -0
- data/test/core/file/test_write.rb +22 -0
- data/test/core/file/test_writelines.rb +21 -0
- data/test/core/filetest/test_root.rb +14 -0
- data/test/core/functor_tc.rb +41 -0
- data/test/core/hash/test_alias.rb +25 -0
- data/test/core/hash/test_argumentize.rb +23 -0
- data/test/core/hash/test_at.rb +16 -0
- data/test/core/hash/test_autonew.rb +22 -0
- data/test/core/hash/test_collate.rb +61 -0
- data/test/core/hash/test_count.rb +23 -0
- data/test/core/hash/test_data.rb +35 -0
- data/test/core/hash/test_dearray_values.rb +26 -0
- data/test/core/hash/test_deep_merge.rb +31 -0
- data/test/core/hash/test_deep_rekey.rb +131 -0
- data/test/core/hash/test_delete_at.rb +18 -0
- data/test/core/hash/test_delete_unless.rb +18 -0
- data/test/core/hash/test_delete_values.rb +30 -0
- data/test/core/hash/test_diff.rb +16 -0
- data/test/core/hash/test_each_with_key.rb +16 -0
- data/test/core/hash/test_expect.rb +34 -0
- data/test/core/hash/test_fetch_nested.rb +24 -0
- data/test/core/hash/test_graph.rb +40 -0
- data/test/core/hash/test_insert.rb +20 -0
- data/test/core/hash/test_inverse.rb +20 -0
- data/test/core/hash/test_join.rb +32 -0
- data/test/core/hash/test_keys.rb +41 -0
- data/test/core/hash/test_new_with.rb +17 -0
- data/test/core/hash/test_op_add.rb +17 -0
- data/test/core/hash/test_op_and.rb +31 -0
- data/test/core/hash/test_op_mul.rb +17 -0
- data/test/core/hash/test_op_or.rb +17 -0
- data/test/core/hash/test_op_push.rb +34 -0
- data/test/core/hash/test_op_sub.rb +28 -0
- data/test/core/hash/test_recurse.rb +39 -0
- data/test/core/hash/test_recursively.rb +71 -0
- data/test/core/hash/test_rekey.rb +119 -0
- data/test/core/hash/test_replace_each.rb +17 -0
- data/test/core/hash/test_revalue.rb +98 -0
- data/test/core/hash/test_reverse_merge.rb +39 -0
- data/test/core/hash/test_slice.rb +36 -0
- data/test/core/hash/test_stringify_keys.rb +26 -0
- data/test/core/hash/test_swap.rb +15 -0
- data/test/core/hash/test_symbolize_keys.rb +26 -0
- data/test/core/hash/test_to_mod.rb +24 -0
- data/test/core/hash/test_to_proc.rb +23 -0
- data/test/core/hash/test_to_struct.rb +22 -0
- data/test/core/hash/test_traverse.rb +29 -0
- data/test/core/hash/test_update_each.rb +16 -0
- data/test/core/hash/test_update_keys.rb +21 -0
- data/test/core/hash/test_update_values.rb +15 -0
- data/test/core/hash/test_weave.rb +18 -0
- data/test/core/hash/test_zip.rb +16 -0
- data/test/core/indexable_tc.rb +232 -0
- data/test/core/integer/test_bitmask.rb +73 -0
- data/test/core/integer/test_factorial.rb +30 -0
- data/test/core/integer/test_multiple.rb +16 -0
- data/test/core/integer/test_of.rb +36 -0
- data/test/core/integer/test_ordinal.rb +27 -0
- data/test/core/kernel/test_as.rb +74 -0
- data/test/core/kernel/test_ask.rb +9 -0
- data/test/core/kernel/test_assign.rb +61 -0
- data/test/core/kernel/test_assign_from.rb +48 -0
- data/test/core/kernel/test_attr_singleton.rb +51 -0
- data/test/core/kernel/test_blank.rb +103 -0
- data/test/core/kernel/test_callstack.rb +21 -0
- data/test/core/kernel/test_class.rb +14 -0
- data/test/core/kernel/test_complete.rb +19 -0
- data/test/core/kernel/test_d.rb +10 -0
- data/test/core/kernel/test_deep_clone.rb +31 -0
- data/test/core/kernel/test_deep_copy.rb +15 -0
- data/test/core/kernel/test_dir.rb +24 -0
- data/test/core/kernel/test_disable_warnings.rb +38 -0
- data/test/core/kernel/test_ergo.rb +34 -0
- data/test/core/kernel/test_extension.rb +18 -0
- data/test/core/kernel/test_get.rb +54 -0
- data/test/core/kernel/test_here.rb +13 -0
- data/test/core/kernel/test_hierarchical_send.rb +48 -0
- data/test/core/kernel/test_in.rb +14 -0
- data/test/core/kernel/test_instance_assign.rb +19 -0
- data/test/core/kernel/test_instance_class.rb +15 -0
- data/test/core/kernel/test_instance_extract.rb +28 -0
- data/test/core/kernel/test_instance_replace.rb +47 -0
- data/test/core/kernel/test_instance_send.rb +26 -0
- data/test/core/kernel/test_maybe.rb +13 -0
- data/test/core/kernel/test_meta_alias.rb +18 -0
- data/test/core/kernel/test_meta_class.rb +33 -0
- data/test/core/kernel/test_meta_def.rb +15 -0
- data/test/core/kernel/test_meta_eval.rb +18 -0
- data/test/core/kernel/test_method.rb +20 -0
- data/test/core/kernel/test_not.rb +51 -0
- data/test/core/kernel/test_not_nil.rb +25 -0
- data/test/core/kernel/test_object_class.rb +22 -0
- data/test/core/kernel/test_object_hexid.rb +20 -0
- data/test/core/kernel/test_object_send.rb +25 -0
- data/test/core/kernel/test_presence.rb +37 -0
- data/test/core/kernel/test_qua_class.rb +25 -0
- data/test/core/kernel/test_require_all.rb +11 -0
- data/test/core/kernel/test_respond.rb +38 -0
- data/test/core/kernel/test_returning.rb +17 -0
- data/test/core/kernel/test_silence.rb +24 -0
- data/test/core/kernel/test_singleton_class.rb +15 -0
- data/test/core/kernel/test_super_method.rb +23 -0
- data/test/core/kernel/test_tap.rb +38 -0
- data/test/core/kernel/test_temporarily.rb +25 -0
- data/test/core/kernel/test_true.rb +31 -0
- data/test/core/kernel/test_try.rb +35 -0
- data/test/core/kernel/test_val.rb +30 -0
- data/test/core/kernel/test_with.rb +18 -0
- data/test/core/kernel/test_writers.rb +53 -0
- data/test/core/matchdata/test_match.rb +14 -0
- data/test/core/matchdata/test_matchset.rb +29 -0
- data/test/core/method/test_composition.rb +42 -0
- data/test/core/module/test_abstract.rb +24 -0
- data/test/core/module/test_alias_accessor.rb +27 -0
- data/test/core/module/test_alias_method_chain.rb +34 -0
- data/test/core/module/test_alias_module_function.rb +24 -0
- data/test/core/module/test_all_instance_methods.rb +27 -0
- data/test/core/module/test_ancestor.rb +16 -0
- data/test/core/module/test_anonymous.rb +18 -0
- data/test/core/module/test_attr_setter.rb +28 -0
- data/test/core/module/test_basename.rb +14 -0
- data/test/core/module/test_can.rb +22 -0
- data/test/core/module/test_class.rb +22 -0
- data/test/core/module/test_class_def.rb +22 -0
- data/test/core/module/test_class_extend.rb +73 -0
- data/test/core/module/test_class_inheritor.rb +135 -0
- data/test/core/module/test_copy_inheritor.rb +35 -0
- data/test/core/module/test_enclosure.rb +24 -0
- data/test/core/module/test_instance_function.rb +30 -0
- data/test/core/module/test_instance_method.rb +20 -0
- data/test/core/module/test_instance_method_defined.rb +38 -0
- data/test/core/module/test_integrate.rb +28 -0
- data/test/core/module/test_is.rb +50 -0
- data/test/core/module/test_memoize.rb +33 -0
- data/test/core/module/test_method_clash.rb +59 -0
- data/test/core/module/test_method_space.rb +72 -0
- data/test/core/module/test_methodize.rb +26 -0
- data/test/core/module/test_modname.rb +13 -0
- data/test/core/module/test_module_def.rb +22 -0
- data/test/core/module/test_module_load.rb +23 -0
- data/test/core/module/test_nodef.rb +19 -0
- data/test/core/module/test_op.rb +56 -0
- data/test/core/module/test_pathize.rb +25 -0
- data/test/core/module/test_preextend.rb +26 -0
- data/test/core/module/test_redefine_method.rb +30 -0
- data/test/core/module/test_redirect_method.rb +32 -0
- data/test/core/module/test_remove.rb +18 -0
- data/test/core/module/test_rename_method.rb +34 -0
- data/test/core/module/test_revise.rb +61 -0
- data/test/core/module/test_set.rb +30 -0
- data/test/core/module/test_spacename.rb +15 -0
- data/test/core/module/test_to_obj.rb +20 -0
- data/test/core/module/test_wrap_method.rb +32 -0
- data/test/core/numeric/test_approx.rb +26 -0
- data/test/core/numeric/test_delimit.rb +68 -0
- data/test/core/numeric/test_distance.rb +16 -0
- data/test/core/numeric/test_length.rb +16 -0
- data/test/core/numeric/test_round_to.rb +76 -0
- data/test/core/numeric/test_spacing.rb +17 -0
- data/test/core/object/test_dup.rb +115 -0
- data/test/core/object/test_object_state.rb +75 -0
- data/test/core/object/test_try_dup.rb +59 -0
- data/test/core/proc/test_bind.rb +29 -0
- data/test/core/proc/test_bind_to.rb +17 -0
- data/test/core/proc/test_compose.rb +27 -0
- data/test/core/proc/test_partial.rb +27 -0
- data/test/core/proc/test_to_method.rb +43 -0
- data/test/core/proc/test_update.rb +15 -0
- data/test/core/range/test_combine.rb +32 -0
- data/test/core/range/test_nudge.rb +32 -0
- data/test/core/range/test_op_add.rb +24 -0
- data/test/core/range/test_op_sub.rb +34 -0
- data/test/core/range/test_overlap.rb +15 -0
- data/test/core/range/test_to_rng.rb +20 -0
- data/test/core/range/test_umbrella.rb +32 -0
- data/test/core/range/test_within.rb +25 -0
- data/test/core/regexp/test_arity.rb +30 -0
- data/test/core/regexp/test_multiline.rb +19 -0
- data/test/core/regexp/test_op_add.rb +15 -0
- data/test/core/regexp/test_op_or.rb +16 -0
- data/test/core/regexp/test_to_re.rb +24 -0
- data/test/core/string/test_acronym.rb +14 -0
- data/test/core/string/test_align.rb +32 -0
- data/test/core/string/test_ascii_only.rb +51 -0
- data/test/core/string/test_bracket.rb +37 -0
- data/test/core/string/test_camelcase.rb +59 -0
- data/test/core/string/test_capitalized.rb +36 -0
- data/test/core/string/test_cleanlines.rb +12 -0
- data/test/core/string/test_cleave.rb +27 -0
- data/test/core/string/test_cmp.rb +18 -0
- data/test/core/string/test_compress_lines.rb +27 -0
- data/test/core/string/test_crypt.rb +17 -0
- data/test/core/string/test_divide.rb +17 -0
- data/test/core/string/test_each_word.rb +17 -0
- data/test/core/string/test_edit_distance.rb +20 -0
- data/test/core/string/test_exclude.rb +23 -0
- data/test/core/string/test_expand_tabs.rb +83 -0
- data/test/core/string/test_file.rb +15 -0
- data/test/core/string/test_fold.rb +21 -0
- data/test/core/string/test_indent.rb +90 -0
- data/test/core/string/test_index_all.rb +22 -0
- data/test/core/string/test_interpolate.rb +16 -0
- data/test/core/string/test_lchomp.rb +25 -0
- data/test/core/string/test_line_wrap.rb +15 -0
- data/test/core/string/test_lowercase.rb +18 -0
- data/test/core/string/test_margin.rb +16 -0
- data/test/core/string/test_methodize.rb +28 -0
- data/test/core/string/test_modulize.rb +28 -0
- data/test/core/string/test_mscan.rb +18 -0
- data/test/core/string/test_natcmp.rb +17 -0
- data/test/core/string/test_nchar.rb +17 -0
- data/test/core/string/test_newlines.rb +14 -0
- data/test/core/string/test_number.rb +44 -0
- data/test/core/string/test_op_div.rb +15 -0
- data/test/core/string/test_op_sub.rb +15 -0
- data/test/core/string/test_pathize.rb +31 -0
- data/test/core/string/test_quote.rb +41 -0
- data/test/core/string/test_random.rb +25 -0
- data/test/core/string/test_range.rb +35 -0
- data/test/core/string/test_remove.rb +50 -0
- data/test/core/string/test_rewrite.rb +17 -0
- data/test/core/string/test_rotate.rb +31 -0
- data/test/core/string/test_shatter.rb +17 -0
- data/test/core/string/test_similarity.rb +22 -0
- data/test/core/string/test_snakecase.rb +22 -0
- data/test/core/string/test_splice.rb +37 -0
- data/test/core/string/test_squish.rb +31 -0
- data/test/core/string/test_store.rb +16 -0
- data/test/core/string/test_subtract.rb +16 -0
- data/test/core/string/test_titlecase.rb +16 -0
- data/test/core/string/test_to_re.rb +35 -0
- data/test/core/string/test_trim.rb +116 -0
- data/test/core/string/test_unbracket.rb +38 -0
- data/test/core/string/test_underscore.rb +21 -0
- data/test/core/string/test_unfold.rb +17 -0
- data/test/core/string/test_unindent.rb +105 -0
- data/test/core/string/test_unquote.rb +13 -0
- data/test/core/string/test_uppercase.rb +22 -0
- data/test/core/string/test_variablize.rb +15 -0
- data/test/core/string/test_word_wrap.rb +80 -0
- data/test/core/string/test_words.rb +65 -0
- data/test/core/string/test_xor.rb +16 -0
- data/test/core/struct/test_replace.rb +18 -0
- data/test/core/symbol/test_as_s.rb +15 -0
- data/test/core/symbol/test_bang.rb +15 -0
- data/test/core/symbol/test_chomp.rb +22 -0
- data/test/core/symbol/test_generate.rb +20 -0
- data/test/core/symbol/test_not.rb +19 -0
- data/test/core/symbol/test_op_div.rb +15 -0
- data/test/core/symbol/test_plain.rb +19 -0
- data/test/core/symbol/test_query.rb +19 -0
- data/test/core/symbol/test_setter.rb +17 -0
- data/test/core/symbol/test_succ.rb +16 -0
- data/test/core/symbol/test_thrown.rb +22 -0
- data/test/core/symbol/test_variablize.rb +14 -0
- data/test/core/time/test_ago.rb +18 -0
- data/test/core/time/test_change.rb +17 -0
- data/test/core/time/test_dst_adjustment.rb +19 -0
- data/test/core/time/test_elapse.rb +15 -0
- data/test/core/time/test_future.rb +32 -0
- data/test/core/time/test_hence.rb +18 -0
- data/test/core/time/test_in.rb +18 -0
- data/test/core/time/test_less.rb +139 -0
- data/test/core/time/test_past.rb +32 -0
- data/test/core/time/test_round_to.rb +34 -0
- data/test/core/time/test_set.rb +43 -0
- data/test/core/time/test_shift.rb +135 -0
- data/test/core/time/test_stamp.rb +42 -0
- data/test/core/time/test_to_time.rb +15 -0
- data/test/core/time/test_trunc.rb +34 -0
- data/test/core/unboundmethod/test_arguments.rb +25 -0
- data/test/standard/binding/test_block_exec.rb +21 -0
- data/test/standard/date/test_cmp.rb +38 -0
- data/test/standard/math/test_abs.rb +13 -0
- data/test/standard/math/test_acot.rb +23 -0
- data/test/standard/math/test_acoth.rb +22 -0
- data/test/standard/math/test_beta.rb +19 -0
- data/test/standard/math/test_ceil.rb +22 -0
- data/test/standard/math/test_cosec.rb +19 -0
- data/test/standard/math/test_cosech.rb +19 -0
- data/test/standard/math/test_cot.rb +13 -0
- data/test/standard/math/test_coth.rb +13 -0
- data/test/standard/math/test_distance.rb +16 -0
- data/test/standard/math/test_exp10.rb +14 -0
- data/test/standard/math/test_exp2.rb +14 -0
- data/test/standard/math/test_factorial.rb +13 -0
- data/test/standard/math/test_floor.rb +23 -0
- data/test/standard/math/test_gcd.rb +18 -0
- data/test/standard/math/test_lcm.rb +13 -0
- data/test/standard/math/test_median.rb +17 -0
- data/test/standard/math/test_percentile.rb +13 -0
- data/test/standard/math/test_pow.rb +30 -0
- data/test/standard/math/test_root.rb +15 -0
- data/test/standard/math/test_sec.rb +19 -0
- data/test/standard/math/test_sech.rb +19 -0
- data/test/standard/math/test_sign.rb +20 -0
- data/test/standard/math/test_sinc.rb +15 -0
- data/test/standard/math/test_srq.rb +20 -0
- data/test/standard/pathname/test_chdir.rb +16 -0
- data/test/standard/pathname/test_readline.rb +23 -0
- data/test/standard/test_argvector.rb +64 -0
- data/test/standard/test_cloneable.rb +60 -0
- data/test/standard/test_date.rb +82 -0
- data/test/standard/test_enumargs.rb +105 -0
- data/test/standard/test_equitable.rb +46 -0
- data/test/standard/test_instantiable.rb +40 -0
- data/test/standard/test_math.rb +3 -0
- data/test/standard/test_memoizable.rb +42 -0
- data/test/standard/test_multipliers.rb +141 -0
- data/test/standard/test_ostruct.rb +191 -0
- data/test/standard/test_random.rb +241 -0
- data/test/standard/test_shellwords.rb +74 -0
- data/test/standard/test_thread.rb +24 -0
- data/test/standard/test_timer.rb +62 -0
- data/test/standard/test_tuple.rb +68 -0
- data/test/standard/test_uri.rb +50 -0
- metadata +1932 -0
@@ -0,0 +1,57 @@
|
|
1
|
+
class Module
|
2
|
+
|
3
|
+
# Is a given class or module an ancestor of this
|
4
|
+
# class or module?
|
5
|
+
#
|
6
|
+
# class IsX ; end
|
7
|
+
# class IsY < IsX ; end
|
8
|
+
#
|
9
|
+
# IsY.is?(IsX) #=> true
|
10
|
+
#
|
11
|
+
# CREDIT: Trans
|
12
|
+
|
13
|
+
def is?(base)
|
14
|
+
Module===base && ancestors.slice(1..-1).include?(base)
|
15
|
+
end
|
16
|
+
|
17
|
+
# An alias for #include.
|
18
|
+
#
|
19
|
+
# class IsExample
|
20
|
+
# is Enumerable
|
21
|
+
# end
|
22
|
+
#
|
23
|
+
# CREDIT: Trans
|
24
|
+
|
25
|
+
def is(*mods)
|
26
|
+
mods.each do |mod|
|
27
|
+
if mod.const_defined?(:Self)
|
28
|
+
extend mod::Self
|
29
|
+
# pass it along if module
|
30
|
+
if instance_of?(Module)
|
31
|
+
const_set(:Self, Module.new) unless const_defined?(:Self)
|
32
|
+
const_get(:Self).send(:include, mod::Self)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
include(*mods)
|
37
|
+
end
|
38
|
+
|
39
|
+
#alias_method :is, :include
|
40
|
+
|
41
|
+
# Expirmental idea for #is.
|
42
|
+
#
|
43
|
+
# If the module has #append_feature_function
|
44
|
+
# defined, this will use that instead of #include ...
|
45
|
+
#
|
46
|
+
# def is(*modules)
|
47
|
+
# module.each do { |m|
|
48
|
+
# if m.respond_to?(:append_feature_function)
|
49
|
+
# send(m.append_feature_function,m)
|
50
|
+
# else
|
51
|
+
# include m
|
52
|
+
# end
|
53
|
+
# end
|
54
|
+
# end
|
55
|
+
|
56
|
+
end
|
57
|
+
|
@@ -0,0 +1,30 @@
|
|
1
|
+
class Module
|
2
|
+
|
3
|
+
# Returns the root name of the module/class.
|
4
|
+
#
|
5
|
+
# module ::BaseName
|
6
|
+
# class Example
|
7
|
+
# end
|
8
|
+
# end
|
9
|
+
#
|
10
|
+
# BaseName::Example.name #=> "BaseName::Example"
|
11
|
+
# BaseName::Example.lastname #=> "Example"
|
12
|
+
#
|
13
|
+
# Returns nil when module is anonymous.
|
14
|
+
#
|
15
|
+
# CREDIT: Trans
|
16
|
+
|
17
|
+
def lastname
|
18
|
+
if name and not name.empty?
|
19
|
+
name.gsub(/^.*::/, '')
|
20
|
+
else
|
21
|
+
nil #inspect.gsub('#<','').gsub('>','').sub(':', '_')
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
# Original name, but conflicts with File.basename, so is
|
26
|
+
# mildly deprecated.
|
27
|
+
alias basename lastname
|
28
|
+
|
29
|
+
end
|
30
|
+
|
@@ -0,0 +1,31 @@
|
|
1
|
+
class Module
|
2
|
+
|
3
|
+
# Create a memoized method. This method has been popularized by RSpec.
|
4
|
+
#
|
5
|
+
# class LetExample
|
6
|
+
# let(:seed) { rand }
|
7
|
+
# end
|
8
|
+
#
|
9
|
+
# eg = LetExample.new
|
10
|
+
# eg.seed == eg.seed
|
11
|
+
#
|
12
|
+
# CREDIT: Howard Yeh
|
13
|
+
#
|
14
|
+
# @uncommon
|
15
|
+
# require 'facets/module/let'
|
16
|
+
#
|
17
|
+
def let(var,&block)
|
18
|
+
name = "@#{var}"
|
19
|
+
self.class_eval do
|
20
|
+
define_method(var) do
|
21
|
+
if instance_variable_defined?(name)
|
22
|
+
instance_variable_get(name)
|
23
|
+
else
|
24
|
+
val = self.instance_eval(&block)
|
25
|
+
instance_variable_set(name,val)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
@@ -0,0 +1,296 @@
|
|
1
|
+
class Module
|
2
|
+
|
3
|
+
# Creates a class-variable attribute that can
|
4
|
+
# be accessed both on an instance and class level.
|
5
|
+
#
|
6
|
+
# class CARExample
|
7
|
+
# @@a = 10
|
8
|
+
# cattr :a
|
9
|
+
# end
|
10
|
+
#
|
11
|
+
# CARExample.a #=> 10
|
12
|
+
# CARExample.new.a #=> 10
|
13
|
+
#
|
14
|
+
# NOTE: This method is not a common core extension and is not
|
15
|
+
# loaded automatically when using <code>require 'facets'</code>.
|
16
|
+
#
|
17
|
+
# CREDIT: David Heinemeier Hansson
|
18
|
+
#
|
19
|
+
# @uncommon
|
20
|
+
# require 'facets/module/cattr'
|
21
|
+
#
|
22
|
+
def cattr(*syms)
|
23
|
+
writers, readers = syms.flatten.partition{ |a| a.to_s =~ /=$/ }
|
24
|
+
writers = writers.map{ |e| e.to_s.chomp('=').to_sym }
|
25
|
+
##readers.concat( writers ) # writers also get readers
|
26
|
+
|
27
|
+
cattr_reader(*readers)
|
28
|
+
cattr_writer(*writers)
|
29
|
+
|
30
|
+
return readers + writers
|
31
|
+
end
|
32
|
+
|
33
|
+
# Creates a class-variable attr_reader that can
|
34
|
+
# be accessed both on an instance and class level.
|
35
|
+
#
|
36
|
+
# class CARExample
|
37
|
+
# @@a = 10
|
38
|
+
# cattr_reader :a
|
39
|
+
# end
|
40
|
+
#
|
41
|
+
# CARExample.a #=> 10
|
42
|
+
# CARExample.new.a #=> 10
|
43
|
+
#
|
44
|
+
# NOTE: This method is not a common core extension and is not
|
45
|
+
# loaded automatically when using <code>require 'facets'</code>.
|
46
|
+
#
|
47
|
+
# CREDIT: David Heinemeier Hansson
|
48
|
+
#
|
49
|
+
# @uncommon
|
50
|
+
# require 'facets/module/cattr'
|
51
|
+
#
|
52
|
+
def cattr_reader(*syms)
|
53
|
+
syms.flatten.each do |sym|
|
54
|
+
module_eval(<<-EOS, __FILE__, __LINE__)
|
55
|
+
unless defined? @@#{sym}
|
56
|
+
@@#{sym} = nil
|
57
|
+
end
|
58
|
+
|
59
|
+
def self.#{sym}
|
60
|
+
@@#{sym}
|
61
|
+
end
|
62
|
+
|
63
|
+
def #{sym}
|
64
|
+
@@#{sym}
|
65
|
+
end
|
66
|
+
EOS
|
67
|
+
end
|
68
|
+
return syms
|
69
|
+
end
|
70
|
+
|
71
|
+
# Creates a class-variable attr_writer that can
|
72
|
+
# be accessed both on an instance and class level.
|
73
|
+
#
|
74
|
+
# class CAWExample
|
75
|
+
# cattr_writer :a
|
76
|
+
# def self.a
|
77
|
+
# @@a
|
78
|
+
# end
|
79
|
+
# end
|
80
|
+
#
|
81
|
+
# CAWExample.a = 10
|
82
|
+
# CAWExample.a #=> 10
|
83
|
+
# CAWExample.new.a = 29
|
84
|
+
# CAWExample.a #=> 29
|
85
|
+
#
|
86
|
+
# NOTE: This method is not a common core extension and is not
|
87
|
+
# loaded automatically when using <code>require 'facets'</code>.
|
88
|
+
#
|
89
|
+
# CREDIT: David Heinemeier Hansson
|
90
|
+
#
|
91
|
+
# @uncommon
|
92
|
+
# require 'facets/module/cattr'
|
93
|
+
#
|
94
|
+
def cattr_writer(*syms)
|
95
|
+
syms.flatten.each do |sym|
|
96
|
+
module_eval(<<-EOS, __FILE__, __LINE__)
|
97
|
+
unless defined? @@#{sym}
|
98
|
+
@@#{sym} = nil
|
99
|
+
end
|
100
|
+
|
101
|
+
def self.#{sym}=(obj)
|
102
|
+
@@#{sym} = obj
|
103
|
+
end
|
104
|
+
|
105
|
+
def #{sym}=(obj)
|
106
|
+
@@#{sym}=(obj)
|
107
|
+
end
|
108
|
+
EOS
|
109
|
+
end
|
110
|
+
return syms
|
111
|
+
end
|
112
|
+
|
113
|
+
# Creates a class-variable attr_accessor that can
|
114
|
+
# be accessed both on an instance and class level.
|
115
|
+
#
|
116
|
+
# class CAAExample
|
117
|
+
# cattr_accessor :a
|
118
|
+
# end
|
119
|
+
#
|
120
|
+
# CAAExample.a = 10
|
121
|
+
# CAAExample.a #=> 10
|
122
|
+
# mc = CAAExample.new
|
123
|
+
# mc.a #=> 10
|
124
|
+
#
|
125
|
+
# NOTE: This method is not a common core extension and is not
|
126
|
+
# loaded automatically when using <code>require 'facets'</code>.
|
127
|
+
#
|
128
|
+
# CREDIT: David Heinemeier Hansson
|
129
|
+
#
|
130
|
+
# @uncommon
|
131
|
+
# require 'facets/module/cattr'
|
132
|
+
#
|
133
|
+
def cattr_accessor(*syms)
|
134
|
+
cattr_reader(*syms) + cattr_writer(*syms)
|
135
|
+
end
|
136
|
+
|
137
|
+
# Creates a class-variable attribute that can
|
138
|
+
# be accessed both on an instance and class level.
|
139
|
+
#
|
140
|
+
# c = Class.new do
|
141
|
+
# mattr :a
|
142
|
+
# def initialize
|
143
|
+
# @@a = 10
|
144
|
+
# end
|
145
|
+
# end
|
146
|
+
#
|
147
|
+
# c.new.a #=> 10
|
148
|
+
# c.a #=> 10
|
149
|
+
#
|
150
|
+
# NOTE: The #mattr methods may not be as useful for modules as the #cattr
|
151
|
+
# methods are for classes, becuase class-level methods are not "inherited"
|
152
|
+
# across the metaclass for included modules.
|
153
|
+
#
|
154
|
+
# NOTE: This methiod is not a common core extension and is not
|
155
|
+
# loaded automatically when using <code>require 'facets'</code>.
|
156
|
+
#
|
157
|
+
# CREDIT: David Heinemeier Hansson
|
158
|
+
#
|
159
|
+
# @uncommon
|
160
|
+
# require 'facets/module/mattr'
|
161
|
+
#
|
162
|
+
def mattr(*syms)
|
163
|
+
writers, readers = syms.flatten.partition{ |a| a.to_s =~ /=$/ }
|
164
|
+
writers = writers.collect{ |e| e.to_s.chomp('=').to_sym }
|
165
|
+
##readers.concat( writers ) # writers also get readers
|
166
|
+
|
167
|
+
mattr_writer( *writers )
|
168
|
+
mattr_reader( *readers )
|
169
|
+
|
170
|
+
return readers + writers
|
171
|
+
end
|
172
|
+
|
173
|
+
# Creates a class-variable attr_reader that can
|
174
|
+
# be accessed both on an instance and class level.
|
175
|
+
#
|
176
|
+
# c = Class.new do
|
177
|
+
# @@a = 10
|
178
|
+
# mattr_reader :a
|
179
|
+
# end
|
180
|
+
#
|
181
|
+
# c.a #=> 10
|
182
|
+
# c.new.a #=> 10
|
183
|
+
#
|
184
|
+
# NOTE: This methiod is not a common core extension and is not
|
185
|
+
# loaded automatically when using <code>require 'facets'</code>.
|
186
|
+
#
|
187
|
+
# CREDIT: David Heinemeier Hansson
|
188
|
+
#
|
189
|
+
# @uncommon
|
190
|
+
# require 'facets/module/mattr'
|
191
|
+
#
|
192
|
+
def mattr_reader( *syms )
|
193
|
+
syms.flatten.each do |sym|
|
194
|
+
module_eval(<<-EOS, __FILE__, __LINE__)
|
195
|
+
unless defined? @@#{sym}
|
196
|
+
@@#{sym} = nil
|
197
|
+
end
|
198
|
+
|
199
|
+
def self.#{sym}
|
200
|
+
@@#{sym}
|
201
|
+
end
|
202
|
+
|
203
|
+
def #{sym}
|
204
|
+
@@#{sym}
|
205
|
+
end
|
206
|
+
EOS
|
207
|
+
end
|
208
|
+
return syms
|
209
|
+
end
|
210
|
+
|
211
|
+
# Creates a class-variable attr_writer that can
|
212
|
+
# be accessed both on an instance and class level.
|
213
|
+
#
|
214
|
+
# c = Class.new do
|
215
|
+
# mattr_writer :a
|
216
|
+
# def self.a
|
217
|
+
# @@a
|
218
|
+
# end
|
219
|
+
# end
|
220
|
+
#
|
221
|
+
# c.a = 10
|
222
|
+
# c.a #=> 10
|
223
|
+
#
|
224
|
+
# c.new.a = 29
|
225
|
+
# c.a #=> 29
|
226
|
+
#
|
227
|
+
# NOTE: This methiod is not a common core extension and is not
|
228
|
+
# loaded automatically when using <code>require 'facets'</code>.
|
229
|
+
#
|
230
|
+
# CREDIT: David Heinemeier Hansson
|
231
|
+
#
|
232
|
+
# @uncommon
|
233
|
+
# require 'facets/module/mattr'
|
234
|
+
#
|
235
|
+
def mattr_writer(*syms)
|
236
|
+
syms.flatten.each do |sym|
|
237
|
+
module_eval(<<-EOS, __FILE__, __LINE__)
|
238
|
+
unless defined? @@#{sym}
|
239
|
+
@@#{sym} = nil
|
240
|
+
end
|
241
|
+
|
242
|
+
def self.#{sym}=(obj)
|
243
|
+
@@#{sym} = obj
|
244
|
+
end
|
245
|
+
|
246
|
+
def #{sym}=(obj)
|
247
|
+
@@#{sym}=(obj)
|
248
|
+
end
|
249
|
+
EOS
|
250
|
+
end
|
251
|
+
return syms
|
252
|
+
end
|
253
|
+
|
254
|
+
# Creates a class-variable attr_accessor that can
|
255
|
+
# be accessed both on an instance and class level.
|
256
|
+
#
|
257
|
+
# c = Class.new do
|
258
|
+
# mattr_accessor :a
|
259
|
+
# end
|
260
|
+
#
|
261
|
+
# c.a = 10
|
262
|
+
# c.a #=> 10
|
263
|
+
#
|
264
|
+
# x = c.new
|
265
|
+
# x.a #=> 10
|
266
|
+
#
|
267
|
+
# NOTE: This methiod is not a common core extension and is not
|
268
|
+
# loaded automatically when using <code>require 'facets'</code>.
|
269
|
+
#
|
270
|
+
# CREDIT: David Heinemeier Hansson
|
271
|
+
#
|
272
|
+
# @uncommon
|
273
|
+
# require 'facets/module/mattr'
|
274
|
+
#
|
275
|
+
def mattr_accessor(*syms)
|
276
|
+
mattr_reader(*syms) + mattr_writer(*syms)
|
277
|
+
end
|
278
|
+
|
279
|
+
end
|
280
|
+
|
281
|
+
# Consider the issue where a module's metaclass is not inherited.
|
282
|
+
#
|
283
|
+
# m = Module.new do
|
284
|
+
# @@a = 10
|
285
|
+
# mattr_reader :a
|
286
|
+
# end
|
287
|
+
#
|
288
|
+
# c = Class.new do
|
289
|
+
# include m
|
290
|
+
# end
|
291
|
+
#
|
292
|
+
# expect NoMethodError do
|
293
|
+
# c.a
|
294
|
+
# end
|
295
|
+
#
|
296
|
+
# Ideally this would work.
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'facets/memoizable'
|
2
|
+
|
3
|
+
class Module
|
4
|
+
|
5
|
+
# This is here for backward compatibility.
|
6
|
+
#
|
7
|
+
# @uncommon
|
8
|
+
# require 'facets/module/memoize'
|
9
|
+
#
|
10
|
+
def memoize(*args)
|
11
|
+
include Memoizable
|
12
|
+
Memoizable.instance_method(:memoize).bind(self).call(*args)
|
13
|
+
#super(*args) # TODO: why is super not working here?
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
@@ -0,0 +1,66 @@
|
|
1
|
+
class Module
|
2
|
+
|
3
|
+
# TODO: Should method_clash just be public methods?
|
4
|
+
|
5
|
+
# TODO: Provide an option to select visiblity.
|
6
|
+
|
7
|
+
# Detect method name clash between modules and/or classes, regardless of
|
8
|
+
# method visibility:
|
9
|
+
#
|
10
|
+
# module MethodClashExample
|
11
|
+
#
|
12
|
+
# module A
|
13
|
+
# def c; end
|
14
|
+
# end
|
15
|
+
#
|
16
|
+
# module B
|
17
|
+
# private
|
18
|
+
# def c; end
|
19
|
+
# end
|
20
|
+
#
|
21
|
+
# A.method_clash(B) #=> [:c]
|
22
|
+
#
|
23
|
+
# end
|
24
|
+
#
|
25
|
+
# CREDIT: Thomas Sawyer, Robert Dober
|
26
|
+
#
|
27
|
+
# @uncommon
|
28
|
+
# require 'facets/module/method_clash'
|
29
|
+
#
|
30
|
+
def method_clash(other)
|
31
|
+
common_ancestor = (ancestors & other.ancestors).first
|
32
|
+
|
33
|
+
s = []
|
34
|
+
s += public_instance_methods(true)
|
35
|
+
s += private_instance_methods(true)
|
36
|
+
s += protected_instance_methods(true)
|
37
|
+
|
38
|
+
o = []
|
39
|
+
o += other.public_instance_methods(true)
|
40
|
+
o += other.private_instance_methods(true)
|
41
|
+
o += other.protected_instance_methods(true)
|
42
|
+
|
43
|
+
c = s & o
|
44
|
+
|
45
|
+
if common_ancestor
|
46
|
+
c -= common_ancestor.public_instance_methods(true)
|
47
|
+
c -= common_ancestor.private_instance_methods(true)
|
48
|
+
c -= common_ancestor.protected_instance_methods(true)
|
49
|
+
end
|
50
|
+
|
51
|
+
return c
|
52
|
+
end
|
53
|
+
|
54
|
+
# Uses #method_clash to return +true+ or +false+ if there
|
55
|
+
# are method name clashes.
|
56
|
+
#
|
57
|
+
# @uncommon
|
58
|
+
# require 'facets/module/method_clash'
|
59
|
+
#
|
60
|
+
def method_clash?(other)
|
61
|
+
c = method_clash(other)
|
62
|
+
!c.empty?
|
63
|
+
end
|
64
|
+
|
65
|
+
end
|
66
|
+
|
@@ -0,0 +1,107 @@
|
|
1
|
+
require 'facets/functor'
|
2
|
+
require 'facets/module/basename'
|
3
|
+
|
4
|
+
class Module
|
5
|
+
|
6
|
+
# Create method namespaces, allowing for method
|
7
|
+
# chains but still accessing the object's instance.
|
8
|
+
#
|
9
|
+
# class A
|
10
|
+
# attr_writer :x
|
11
|
+
# method_space :inside do
|
12
|
+
# def x; @x; end
|
13
|
+
# end
|
14
|
+
# end
|
15
|
+
#
|
16
|
+
# a = A.new
|
17
|
+
# a.x = 10
|
18
|
+
# a.inside.x #=> 10
|
19
|
+
#
|
20
|
+
# expect NoMethodError do
|
21
|
+
# a.x
|
22
|
+
# end
|
23
|
+
#
|
24
|
+
# NOTE: This method is not a common core extension and is not
|
25
|
+
# loaded automatically when using <code>require 'facets'</code>.
|
26
|
+
#
|
27
|
+
# CREDIT: Pit Captain
|
28
|
+
#
|
29
|
+
# @uncommon
|
30
|
+
# require 'facets/module/method_space'
|
31
|
+
#
|
32
|
+
def method_space(name, mod=nil, &blk)
|
33
|
+
|
34
|
+
## If block is given then create a module, otherwise
|
35
|
+
## get the name of the module.
|
36
|
+
if block_given?
|
37
|
+
name = name.to_s
|
38
|
+
raise ArgumentError if mod
|
39
|
+
mod = Module.new(&blk)
|
40
|
+
else
|
41
|
+
if Module === name
|
42
|
+
mod = name
|
43
|
+
name = mod.basename.downcase
|
44
|
+
end
|
45
|
+
mod = mod.dup
|
46
|
+
end
|
47
|
+
|
48
|
+
## Include the module. This is neccessary, otherwise
|
49
|
+
## Ruby won't let us bind the instance methods.
|
50
|
+
include mod
|
51
|
+
|
52
|
+
## Save the instance methods of the module and
|
53
|
+
## replace them with a "transparent" version.
|
54
|
+
methods = {}
|
55
|
+
mod.instance_methods(false).each do |m|
|
56
|
+
methods[m.to_sym] = mod.instance_method(m)
|
57
|
+
mod.module_eval %{
|
58
|
+
def #{m}(*a,&b)
|
59
|
+
super(*a,&b)
|
60
|
+
end
|
61
|
+
}
|
62
|
+
##mod.instance_eval do
|
63
|
+
## define_method(m)
|
64
|
+
## super
|
65
|
+
## end
|
66
|
+
##end
|
67
|
+
end
|
68
|
+
|
69
|
+
## Add a method for the namespace that delegates
|
70
|
+
## via the Functor to the saved instance methods.
|
71
|
+
define_method(name) do
|
72
|
+
mtab = methods
|
73
|
+
Functor.new do |op, *args|
|
74
|
+
if meth = mtab[op.to_sym]
|
75
|
+
meth.bind(self).call(*args)
|
76
|
+
else
|
77
|
+
#self.__send__(op, *args)
|
78
|
+
raise NoMethodError, "undefined method `#{m}'"
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
# Include a module via a specified space.
|
85
|
+
#
|
86
|
+
# module T
|
87
|
+
# def t ; "HERE" ; end
|
88
|
+
# end
|
89
|
+
#
|
90
|
+
# class X
|
91
|
+
# include_as :test => T
|
92
|
+
# def t ; test.t ; end
|
93
|
+
# end
|
94
|
+
#
|
95
|
+
# X.new.t #=> "HERE"
|
96
|
+
#
|
97
|
+
# NOTE: This method is not a common core extension and is not
|
98
|
+
# loaded automatically when using <code>require 'facets'</code>.
|
99
|
+
#
|
100
|
+
# @uncommon
|
101
|
+
# require 'facets/module/method_space'
|
102
|
+
#
|
103
|
+
def include_as(h)
|
104
|
+
h.each{ |name, mod| method_space(name, mod) }
|
105
|
+
end
|
106
|
+
|
107
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'facets/string/methodize'
|
2
|
+
|
3
|
+
class Module
|
4
|
+
|
5
|
+
# Translate a module name to a suitable method name.
|
6
|
+
#
|
7
|
+
# module ::EgMethodize
|
8
|
+
# module Eg
|
9
|
+
# end
|
10
|
+
# end
|
11
|
+
#
|
12
|
+
# EgMethodize.methodize #=> "eg_methodize"
|
13
|
+
# EgMethodize::Eg.methodize #=> "eg_methodize__eg"
|
14
|
+
#
|
15
|
+
def methodize
|
16
|
+
name.methodize
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
20
|
+
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'facets/module/homename'
|
@@ -0,0 +1,31 @@
|
|
1
|
+
class Module
|
2
|
+
|
3
|
+
# Defines an instance method within a class/module.
|
4
|
+
#
|
5
|
+
# CREDIT: WhyTheLuckyStiff
|
6
|
+
|
7
|
+
def class_def name, &blk
|
8
|
+
class_eval { define_method name, &blk }
|
9
|
+
end
|
10
|
+
|
11
|
+
# Defines an instance method within a class/module.
|
12
|
+
#
|
13
|
+
# CREDIT: WhyTheLuckyStiff
|
14
|
+
|
15
|
+
def module_def name, &blk
|
16
|
+
module_eval { define_method name, &blk }
|
17
|
+
end
|
18
|
+
|
19
|
+
#--
|
20
|
+
# TODO: Why are we making these protected,
|
21
|
+
# and where should these really go in Facets?
|
22
|
+
#++
|
23
|
+
protected :attr
|
24
|
+
protected :attr_reader
|
25
|
+
protected :attr_writer
|
26
|
+
protected :attr_accessor
|
27
|
+
protected :remove_method
|
28
|
+
protected :undef_method
|
29
|
+
|
30
|
+
end
|
31
|
+
|