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,33 @@
|
|
1
|
+
class Hash
|
2
|
+
|
3
|
+
# Convert a hash into a module.
|
4
|
+
#
|
5
|
+
# {:a=>1, :b=>2}.to_mod
|
6
|
+
#
|
7
|
+
# Can take a block accepting key, value pairs which will be
|
8
|
+
# evaluated in the context of the module.
|
9
|
+
#
|
10
|
+
# h = {:a=>1, :b=>2}
|
11
|
+
# m = h.to_mod{ |k,v| module_function k }
|
12
|
+
# m.a #=> 1
|
13
|
+
# m.b #=> 2
|
14
|
+
#
|
15
|
+
# CREDIT: Jay Fields
|
16
|
+
#--
|
17
|
+
# TODO: Consider #to_obj?
|
18
|
+
#++
|
19
|
+
|
20
|
+
def to_mod(&block)
|
21
|
+
hash = self
|
22
|
+
Module.new do
|
23
|
+
hash.each do |key, value|
|
24
|
+
define_method key do
|
25
|
+
value #.to_object
|
26
|
+
end
|
27
|
+
instance_exec(key, value, &block) if block
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
33
|
+
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'facets/hash/symbolize_keys'
|
@@ -0,0 +1,39 @@
|
|
1
|
+
class Hash
|
2
|
+
|
3
|
+
# Constructs a Proc object from a hash such that the parameter
|
4
|
+
# of the Proc is assigned the hash keys as attributes.
|
5
|
+
#
|
6
|
+
# c = Class.new do
|
7
|
+
# attr_accessor :a
|
8
|
+
# end
|
9
|
+
#
|
10
|
+
# h = {:a => 1}
|
11
|
+
# o = c.new
|
12
|
+
# h.to_proc.call(o)
|
13
|
+
# o.a #=> 1
|
14
|
+
#
|
15
|
+
# If +response+ is set to +true+, then assignment will only occur
|
16
|
+
# if receiver responds_to? the writer method.
|
17
|
+
#
|
18
|
+
# CREDIT: Trans
|
19
|
+
|
20
|
+
def to_proc(response=false)
|
21
|
+
if response
|
22
|
+
lambda do |o|
|
23
|
+
self.each do |k,v|
|
24
|
+
ke = "#{k}="
|
25
|
+
o.__send__(ke, v) if respond_to?(ke)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
else
|
29
|
+
lambda do |o|
|
30
|
+
self.each do |k,v|
|
31
|
+
ke = "#{k}="
|
32
|
+
o.__send__(ke, v)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
39
|
+
|
@@ -0,0 +1,17 @@
|
|
1
|
+
class Hash
|
2
|
+
|
3
|
+
# A method to convert a Hash into a Struct.
|
4
|
+
#
|
5
|
+
# h = {:name=>"Dan","age"=>33,"rank"=>"SrA","grade"=>"E4"}
|
6
|
+
# s = h.to_struct("Foo")
|
7
|
+
#
|
8
|
+
# TODO: Is this robust enough considerd hashes aren't ordered?
|
9
|
+
#
|
10
|
+
# CREDIT: Daniel Berger
|
11
|
+
|
12
|
+
def to_struct(struct_name)
|
13
|
+
Struct.new(struct_name,*keys).new(*values)
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
17
|
+
|
@@ -0,0 +1,47 @@
|
|
1
|
+
class Hash
|
2
|
+
|
3
|
+
# Returns a new hash created by traversing the hash and its subhashes,
|
4
|
+
# executing the given block on the key and value. The block should
|
5
|
+
# return a 2-element array of the form +[key, value]+.
|
6
|
+
#
|
7
|
+
# h = {"A"=>"A", "B"=>"B", "C"=>{"X"=>"X"}}
|
8
|
+
#
|
9
|
+
# g = h.traverse{ |k,v| [k.downcase, v] }
|
10
|
+
#
|
11
|
+
# g #=> {"a"=>"A", "b"=>"B", "c"=>{"x"=>"X"}}
|
12
|
+
#
|
13
|
+
# NOTE: Hash#traverse is the same as `recursive.graph` and
|
14
|
+
# might be deprecated in the future (if it ever works!)
|
15
|
+
#
|
16
|
+
# CREDIT: Trans
|
17
|
+
|
18
|
+
def traverse(&block)
|
19
|
+
inject({}) do |h,(k,v)|
|
20
|
+
if Hash === v
|
21
|
+
v = v.traverse(&block)
|
22
|
+
elsif v.respond_to?(:to_hash)
|
23
|
+
v = v.to_hash.traverse(&block)
|
24
|
+
end
|
25
|
+
nk, nv = block.call(k,v)
|
26
|
+
h[nk] = nv
|
27
|
+
h
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
# In place version of traverse, which traverses the hash and its
|
32
|
+
# subhashes, executing the given block on the key and value.
|
33
|
+
#
|
34
|
+
# h = { "A"=>"A", "B"=>"B" }
|
35
|
+
#
|
36
|
+
# h.traverse!{ |k,v| [k.downcase, v] }
|
37
|
+
#
|
38
|
+
# h #=> { "a"=>"A", "b"=>"B" }
|
39
|
+
#
|
40
|
+
# CREDIT: Trans
|
41
|
+
|
42
|
+
def traverse!(&block)
|
43
|
+
replace(traverse(&block))
|
44
|
+
end
|
45
|
+
|
46
|
+
end
|
47
|
+
|
@@ -0,0 +1,18 @@
|
|
1
|
+
class Hash
|
2
|
+
|
3
|
+
# Iterates through each pair and updates the hash
|
4
|
+
# in place. This is formally equivalent to #mash!
|
5
|
+
# But does not use #mash to accomplish the task.
|
6
|
+
# Hence #update_each is probably a touch faster.
|
7
|
+
#
|
8
|
+
# CREDIT: Trans
|
9
|
+
|
10
|
+
def update_each # :yield:
|
11
|
+
dup.each do |k,v|
|
12
|
+
update(yield(k,v))
|
13
|
+
end
|
14
|
+
self
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
18
|
+
|
@@ -0,0 +1,21 @@
|
|
1
|
+
class Hash
|
2
|
+
|
3
|
+
# Iterate over hash updating just the keys.
|
4
|
+
#
|
5
|
+
# h = {:a=>1, :b=>2}
|
6
|
+
# h.update_keys{ |k| "#{k}!" }
|
7
|
+
# h #=> { "a!"=>1, "b!"=>2 }
|
8
|
+
#
|
9
|
+
# @author Trans
|
10
|
+
# @author Evgeniy Dolzhenko (bug fix)
|
11
|
+
|
12
|
+
def update_keys #:yield:
|
13
|
+
if block_given?
|
14
|
+
keys.each { |old_key| store(yield(old_key), delete(old_key)) }
|
15
|
+
else
|
16
|
+
to_enum(:update_keys)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
|
@@ -0,0 +1,20 @@
|
|
1
|
+
class Hash
|
2
|
+
|
3
|
+
# Iterate over hash updating just the values.
|
4
|
+
#
|
5
|
+
# h = {:a=>1, :b=>2}
|
6
|
+
# h.update_values{ |v| v + 1 }
|
7
|
+
# h #=> { :a=>2, :b=>3 }
|
8
|
+
#
|
9
|
+
# CREDIT: Trans
|
10
|
+
|
11
|
+
def update_values #:yield:
|
12
|
+
if block_given?
|
13
|
+
each{ |k,v| store(k, yield(v)) }
|
14
|
+
else
|
15
|
+
to_enum(:update_values)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
20
|
+
|
@@ -0,0 +1,76 @@
|
|
1
|
+
class Hash
|
2
|
+
|
3
|
+
# Weave is a very unique hash operator. It is designed
|
4
|
+
# to merge to complex hashes in according to sensible,
|
5
|
+
# regular pattern. The effect is akin to inheritance.
|
6
|
+
#
|
7
|
+
# Two hashes are weaved together to produce a new hash.
|
8
|
+
# The two hashes need to be compatible according to the
|
9
|
+
# following rules for each node: ...
|
10
|
+
#
|
11
|
+
# hash, hash => hash (recursive +)
|
12
|
+
# hash, array => error
|
13
|
+
# hash, value => error
|
14
|
+
# array, hash => error
|
15
|
+
# array, array => array + array
|
16
|
+
# array, value => array << value
|
17
|
+
# value, hash => error
|
18
|
+
# value, array => array.unshift(valueB)
|
19
|
+
# value1, value2 => value2
|
20
|
+
#
|
21
|
+
# Here is a basic example:
|
22
|
+
#
|
23
|
+
# h1 = { :a => 1, :b => [ 1 ], :c => { :x => 1 } }
|
24
|
+
# h2 = { :a => 2, :b => [ 2 ], :c => { :x => 2 } }
|
25
|
+
#
|
26
|
+
# h1.weave(h2)
|
27
|
+
# #=> {:b=>[1, 2], :c=>{:x=>2}, :a=>2}
|
28
|
+
#
|
29
|
+
# Weave follows the most expected pattern of unifying two complex
|
30
|
+
# hashes. It is especially useful for implementing overridable
|
31
|
+
# configuration schemes.
|
32
|
+
#
|
33
|
+
# CREDIT: Thomas Sawyer
|
34
|
+
|
35
|
+
def weave(h)
|
36
|
+
raise ArgumentError, "Hash expected" unless h.kind_of?(Hash)
|
37
|
+
s = self.clone
|
38
|
+
h.each { |k,node|
|
39
|
+
node_is_hash = node.kind_of?(Hash)
|
40
|
+
node_is_array = node.kind_of?(Array)
|
41
|
+
if s.has_key?(k)
|
42
|
+
self_node_is_hash = s[k].kind_of?(Hash)
|
43
|
+
self_node_is_array = s[k].kind_of?(Array)
|
44
|
+
if self_node_is_hash
|
45
|
+
if node_is_hash
|
46
|
+
s[k] = s[k].weave(node)
|
47
|
+
elsif node_is_array
|
48
|
+
raise ArgumentError, 'Incompatible hash addition' #self[k] = node
|
49
|
+
else
|
50
|
+
raise ArgumentError, 'Incompatible hash addition' #self[k] = node
|
51
|
+
end
|
52
|
+
elsif self_node_is_array
|
53
|
+
if node_is_hash
|
54
|
+
raise ArgumentError, 'Incompatible hash addition' #self[k] = node
|
55
|
+
elsif node_is_array
|
56
|
+
s[k] += node
|
57
|
+
else
|
58
|
+
s[k] << node
|
59
|
+
end
|
60
|
+
else
|
61
|
+
if node_is_hash
|
62
|
+
raise ArgumentError, 'Incompatible hash addition' #self[k] = node
|
63
|
+
elsif node_is_array
|
64
|
+
s[k].unshift( node )
|
65
|
+
else
|
66
|
+
s[k] = node
|
67
|
+
end
|
68
|
+
end
|
69
|
+
else
|
70
|
+
s[k] = node
|
71
|
+
end
|
72
|
+
}
|
73
|
+
s
|
74
|
+
end
|
75
|
+
|
76
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
class Hash
|
2
|
+
|
3
|
+
# Creates a new hash from two separate arrays, a +keys+ array and
|
4
|
+
# a +values+ array.
|
5
|
+
#
|
6
|
+
# Hash.zip(["a","b","c"], [1,2,3])
|
7
|
+
# # => { "a"=>1, "b"=>2, "c"=>3 }
|
8
|
+
#
|
9
|
+
# CREDIT: Trans, Ara T. Howard
|
10
|
+
|
11
|
+
def self.zip(keys,values) # or some better name
|
12
|
+
h = {}
|
13
|
+
keys.size.times{ |i| h[ keys[i] ] = values[i] }
|
14
|
+
h
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
18
|
+
|
@@ -0,0 +1,53 @@
|
|
1
|
+
require_relative 'hash/alias.rb'
|
2
|
+
require_relative 'hash/argumentize.rb'
|
3
|
+
require_relative 'hash/at.rb'
|
4
|
+
require_relative 'hash/autonew.rb'
|
5
|
+
require_relative 'hash/collate.rb'
|
6
|
+
require_relative 'hash/count.rb'
|
7
|
+
require_relative 'hash/dearray_values.rb'
|
8
|
+
require_relative 'hash/deep_merge.rb'
|
9
|
+
require_relative 'hash/delete.rb'
|
10
|
+
require_relative 'hash/delete_at.rb'
|
11
|
+
require_relative 'hash/delete_unless.rb'
|
12
|
+
require_relative 'hash/delete_values.rb'
|
13
|
+
require_relative 'hash/diff.rb'
|
14
|
+
require_relative 'hash/each_with_key.rb'
|
15
|
+
require_relative 'hash/except.rb'
|
16
|
+
require_relative 'hash/fetch_nested.rb'
|
17
|
+
require_relative 'hash/graph.rb'
|
18
|
+
require_relative 'hash/insert.rb'
|
19
|
+
require_relative 'hash/inverse.rb'
|
20
|
+
require_relative 'hash/join.rb'
|
21
|
+
require_relative 'hash/keys.rb'
|
22
|
+
require_relative 'hash/mash.rb'
|
23
|
+
require_relative 'hash/new_with.rb'
|
24
|
+
require_relative 'hash/op.rb'
|
25
|
+
require_relative 'hash/op_add.rb'
|
26
|
+
require_relative 'hash/op_and.rb'
|
27
|
+
require_relative 'hash/op_mul.rb'
|
28
|
+
require_relative 'hash/op_or.rb'
|
29
|
+
require_relative 'hash/op_push.rb'
|
30
|
+
require_relative 'hash/op_sub.rb'
|
31
|
+
require_relative 'hash/recurse.rb'
|
32
|
+
require_relative 'hash/recursively.rb'
|
33
|
+
require_relative 'hash/rekey.rb'
|
34
|
+
require_relative 'hash/replace_each.rb'
|
35
|
+
require_relative 'hash/reverse_merge.rb'
|
36
|
+
require_relative 'hash/slice.rb'
|
37
|
+
require_relative 'hash/stringify_keys.rb'
|
38
|
+
require_relative 'hash/subset.rb'
|
39
|
+
require_relative 'hash/swap.rb'
|
40
|
+
require_relative 'hash/symbolize_keys.rb'
|
41
|
+
require_relative 'hash/to_mod.rb'
|
42
|
+
require_relative 'hash/to_options.rb'
|
43
|
+
require_relative 'hash/to_proc.rb'
|
44
|
+
require_relative 'hash/to_struct.rb'
|
45
|
+
require_relative 'hash/traverse.rb'
|
46
|
+
require_relative 'hash/update.rb'
|
47
|
+
require_relative 'hash/update_each.rb'
|
48
|
+
require_relative 'hash/update_keys.rb'
|
49
|
+
require_relative 'hash/update_values.rb'
|
50
|
+
#require_relative 'hash/url_params.rb' # uncommon
|
51
|
+
require_relative 'hash/weave.rb'
|
52
|
+
require_relative 'hash/zip.rb'
|
53
|
+
|
@@ -0,0 +1,270 @@
|
|
1
|
+
# Indexable is a mixin that provides index based methods,
|
2
|
+
# working solely with four methods: #index, #slice, #splice
|
3
|
+
# and #size.
|
4
|
+
#
|
5
|
+
# These methods work in harmony. Where #index returns a
|
6
|
+
# position of a given element, #slice returns elements
|
7
|
+
# for given positions. #splice is like #slice but replaces
|
8
|
+
# the given position with new values. This method is not
|
9
|
+
# part of ruby core, but it generally just an alias for #[]=,
|
10
|
+
# just as #slice is an alias of #[]. #size of course simply
|
11
|
+
# returns the total length of the indexable object.
|
12
|
+
#
|
13
|
+
# NOTE: To test the following methods Indexable needs to be
|
14
|
+
# included into Array and array must have #splice defined.
|
15
|
+
#
|
16
|
+
# require 'facets/array/splice'
|
17
|
+
#
|
18
|
+
# class ::Array
|
19
|
+
# include Indexable
|
20
|
+
# end
|
21
|
+
#
|
22
|
+
# CREDIT: Thomas Sawyer
|
23
|
+
|
24
|
+
module Indexable
|
25
|
+
|
26
|
+
# Like #first but returns the first element
|
27
|
+
# in a new array.
|
28
|
+
#
|
29
|
+
# [1,2,3].head #=> [1]
|
30
|
+
#
|
31
|
+
def head
|
32
|
+
slice(0,1)
|
33
|
+
end
|
34
|
+
|
35
|
+
# Returns an array from second element to last element.
|
36
|
+
#
|
37
|
+
# [1,2,3].tail #=> [2,3]
|
38
|
+
#
|
39
|
+
def tail
|
40
|
+
slice(1,length-1)
|
41
|
+
end
|
42
|
+
|
43
|
+
# Like #last, returning the last element
|
44
|
+
# in an array.
|
45
|
+
#
|
46
|
+
# [1,2,3].foot #=> [3]
|
47
|
+
#
|
48
|
+
def foot
|
49
|
+
slice(-1,1)
|
50
|
+
end
|
51
|
+
|
52
|
+
# Returns an array of the first element up to,
|
53
|
+
# but not including, the last element.
|
54
|
+
#
|
55
|
+
# [1,2,3].body #=> [1,2]
|
56
|
+
#
|
57
|
+
#--
|
58
|
+
# Better name for this? (bulk, perhaps?)
|
59
|
+
#++
|
60
|
+
#
|
61
|
+
def body
|
62
|
+
slice(0,size-1)
|
63
|
+
end
|
64
|
+
|
65
|
+
# Returns the middle element of an array, or the element offset
|
66
|
+
# from middle if the parameter is given. Even-sized arrays,
|
67
|
+
# not having an exact middle, return the middle-right element.
|
68
|
+
#
|
69
|
+
# [1,2,3,4,5].mid #=> 3
|
70
|
+
# [1,2,3,4,5,6].mid #=> 4
|
71
|
+
# [1,2,3,4,5,6].mid(-1) #=> 3
|
72
|
+
# [1,2,3,4,5,6].mid(-2) #=> 2
|
73
|
+
# [1,2,3,4,5,6].mid(1) #=> 5
|
74
|
+
#
|
75
|
+
# In other words, If there are an even number of elements the
|
76
|
+
# higher-indexed of the two center elements is indexed as
|
77
|
+
# origin (0).
|
78
|
+
#
|
79
|
+
def mid(offset=0)
|
80
|
+
slice((size / 2) + offset)
|
81
|
+
end
|
82
|
+
|
83
|
+
# Returns an Array of the middle element(s) of an array.
|
84
|
+
# Even-sized arrays, not having an exact middle, return
|
85
|
+
# a two-element array of the two middle elements.
|
86
|
+
#
|
87
|
+
# [1,2,3,4,5].middle #=> [3]
|
88
|
+
# [1,2,3,4,5,6].middle #=> [3,4]
|
89
|
+
#
|
90
|
+
# A +birth+ can be give to widen the middle on either side.
|
91
|
+
#
|
92
|
+
# [1,2,3,4,5].middle(1) #=> [2,3,4]
|
93
|
+
# [1,2,3,4,5,6].middle(1) #=> [2,3,4,5]
|
94
|
+
#
|
95
|
+
# In contrast to #mid which utilizes an offset.
|
96
|
+
#
|
97
|
+
def middle(birth=0)
|
98
|
+
i = size / 2 - birth
|
99
|
+
if size % 2 == 0
|
100
|
+
slice(i - 1, 2 + (2 * birth))
|
101
|
+
else
|
102
|
+
slice(i, 1 + (2 * birth))
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
# Fetch values from a start index through an end index.
|
107
|
+
#
|
108
|
+
# [1,2,3,4,5].thru(0,2) #=> [1,2,3]
|
109
|
+
# [1,2,3,4,5].thru(2,4) #=> [3,4,5]
|
110
|
+
#
|
111
|
+
# [1,2,3,4,5].thru(2) #=> [1,2,3]
|
112
|
+
# [1,2,3,4,5].thru(4) #=> [1,2,3,4,5]
|
113
|
+
#
|
114
|
+
def thru(from, to=nil)
|
115
|
+
from, to = 0, from unless to
|
116
|
+
to = size - 1 if to >= size
|
117
|
+
a = []
|
118
|
+
i = from
|
119
|
+
while i <= to
|
120
|
+
a << slice(i)
|
121
|
+
i += 1
|
122
|
+
end
|
123
|
+
a
|
124
|
+
end
|
125
|
+
|
126
|
+
# Returns last _n_ elements.
|
127
|
+
#
|
128
|
+
# %w{W o r l d}.from(3) #=> %w{l d}
|
129
|
+
#
|
130
|
+
def from(i)
|
131
|
+
return [] if i >= size
|
132
|
+
slice(i, size - i) #slice(-n..-1)
|
133
|
+
end
|
134
|
+
|
135
|
+
## DEPRECATED: use #thru instead
|
136
|
+
## Returns first _n_ elements.
|
137
|
+
##
|
138
|
+
## %w{H e l l o}.upto(3) #=> %w{H e l l}
|
139
|
+
##
|
140
|
+
##def upto(n)
|
141
|
+
## slice(0, n.to_i+1)
|
142
|
+
##end
|
143
|
+
|
144
|
+
# Returns first _n_ elements.
|
145
|
+
#
|
146
|
+
# %w{H e l l o}.first(3) #=> %w{H e l}
|
147
|
+
#
|
148
|
+
def first(n=1)
|
149
|
+
slice(0, n.to_i)
|
150
|
+
end
|
151
|
+
|
152
|
+
# Returns last _n_ elements.
|
153
|
+
#
|
154
|
+
# %w{H e l l o}.last(3) #=> %w{l l o}
|
155
|
+
#
|
156
|
+
def last(n=1)
|
157
|
+
n = n.to_i
|
158
|
+
return self if n > size
|
159
|
+
slice(-n, n) #slice(-n..-1)
|
160
|
+
end
|
161
|
+
|
162
|
+
# Change the first element.
|
163
|
+
#
|
164
|
+
# a = ["a","y","z"]
|
165
|
+
# a.first = "x"
|
166
|
+
# a #=> ["x","y","z"]
|
167
|
+
#
|
168
|
+
def first=(x)
|
169
|
+
splice(0,x)
|
170
|
+
end
|
171
|
+
|
172
|
+
# Change the last element.
|
173
|
+
#
|
174
|
+
# a = [1,2,5]
|
175
|
+
# a.last = 3
|
176
|
+
# a #=> [1,2,3]
|
177
|
+
|
178
|
+
def last=(x)
|
179
|
+
splice(-1,x)
|
180
|
+
end
|
181
|
+
|
182
|
+
# Remove and return the first element.
|
183
|
+
#
|
184
|
+
# a = [1,2,3]
|
185
|
+
# a.first! #=> 1
|
186
|
+
# a #=> [2,3]
|
187
|
+
#
|
188
|
+
def first!
|
189
|
+
splice(0)
|
190
|
+
end
|
191
|
+
|
192
|
+
# Remove and return the last element.
|
193
|
+
#
|
194
|
+
# a = [1,2,3]
|
195
|
+
# a.last! #=> 3
|
196
|
+
# a #=> [1,2]
|
197
|
+
#
|
198
|
+
def last!
|
199
|
+
splice(-1)
|
200
|
+
end
|
201
|
+
|
202
|
+
# A shortening of "ends at". Returns the
|
203
|
+
# last index of the indexable object,
|
204
|
+
# or nil if there are no elements.
|
205
|
+
#
|
206
|
+
# [1,2,3,4,5].ends #=> 4
|
207
|
+
#
|
208
|
+
# This is nearly equivalent to +size - 1+.
|
209
|
+
#
|
210
|
+
def ends
|
211
|
+
return nil if size == 0
|
212
|
+
size - 1
|
213
|
+
end
|
214
|
+
|
215
|
+
alias_method :last_index, :ends
|
216
|
+
|
217
|
+
# Returns the positive ordinal index given
|
218
|
+
# a cardinal position, 1 to n or -n to -1.
|
219
|
+
#
|
220
|
+
# [1,2,3,4,5].pos(1) #=> 0
|
221
|
+
# [1,2,3,4,5].pos(-1) #=> 4
|
222
|
+
#
|
223
|
+
def pos(i)
|
224
|
+
if i > 0
|
225
|
+
return i - 1
|
226
|
+
else
|
227
|
+
size + i
|
228
|
+
end
|
229
|
+
end
|
230
|
+
|
231
|
+
# Returns the index of the first element equal to the
|
232
|
+
# given object or satisfying the block condition.
|
233
|
+
#
|
234
|
+
# [1,2,3,4].index{ |e| e == 3 } #=> 2
|
235
|
+
# [1,2,3,4].index{ |e| e > 3 } #=> 3
|
236
|
+
#
|
237
|
+
def index(obj=nil, &block)
|
238
|
+
if block_given?
|
239
|
+
size.times do |i|
|
240
|
+
return i if yield(slice(i))
|
241
|
+
end
|
242
|
+
else
|
243
|
+
size.times do |i|
|
244
|
+
return i if obj == slice(i)
|
245
|
+
end
|
246
|
+
end
|
247
|
+
nil
|
248
|
+
end
|
249
|
+
|
250
|
+
# to be deprecated
|
251
|
+
alias_method :index_of, :index
|
252
|
+
|
253
|
+
# TODO Maybe #range could use a little error catch code (todo).
|
254
|
+
|
255
|
+
# Returns the index range between two elements. If no elements are
|
256
|
+
# given, returns the range from first to last.
|
257
|
+
#
|
258
|
+
# ['a','b','c','d'].range #=> (0..3)
|
259
|
+
# ['a','b','c','d'].range('b','d') #=> (1..3)
|
260
|
+
#
|
261
|
+
def range(a=nil,z=-1)
|
262
|
+
if a
|
263
|
+
index(a)..index(z)
|
264
|
+
else
|
265
|
+
(0..(size-1))
|
266
|
+
end
|
267
|
+
end
|
268
|
+
|
269
|
+
end
|
270
|
+
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'facets/integer/bitmask'
|