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,54 @@
|
|
1
|
+
module Kernel
|
2
|
+
private
|
3
|
+
#
|
4
|
+
# CLI is based on Clap library
|
5
|
+
# Copyright (c) 2010 Michel Martens
|
6
|
+
#
|
7
|
+
def cli(*args)
|
8
|
+
opts = args.pop
|
9
|
+
argv = (args.first || ARGV).dup
|
10
|
+
args = []
|
11
|
+
|
12
|
+
# Split option aliases.
|
13
|
+
opts = opts.inject({}) do |h,(k,v)|
|
14
|
+
k.to_s.split(/\s+/).each{|o| h[o]=v}; h
|
15
|
+
end
|
16
|
+
|
17
|
+
# Convert single dash flags into multiple flags.
|
18
|
+
argv = argv.inject([]) do |a, v|
|
19
|
+
if v[0,1] == '-' && v[1,1] != '-'
|
20
|
+
a.concat(v[1..-1].chars.map{|c| "-#{c}"})
|
21
|
+
else
|
22
|
+
a << v
|
23
|
+
end
|
24
|
+
a
|
25
|
+
end
|
26
|
+
|
27
|
+
while argv.any?
|
28
|
+
item = argv.shift
|
29
|
+
flag = opts[item]
|
30
|
+
|
31
|
+
if flag
|
32
|
+
# Work around lambda semantics in 1.8.7.
|
33
|
+
arity = [flag.arity, 0].max
|
34
|
+
|
35
|
+
# Raise if there are not enough parameters
|
36
|
+
# available for the flag.
|
37
|
+
if argv.size < arity
|
38
|
+
raise ArgumentError
|
39
|
+
end
|
40
|
+
|
41
|
+
# Call the lambda with N items from argv,
|
42
|
+
# where N is the lambda's arity.
|
43
|
+
flag.call(*argv.shift(arity))
|
44
|
+
else
|
45
|
+
|
46
|
+
# Collect the items that don't correspond to
|
47
|
+
# flags.
|
48
|
+
args << item
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
args
|
53
|
+
end
|
54
|
+
end
|
@@ -0,0 +1,67 @@
|
|
1
|
+
# Clonable provides a standard basis for adding deep cloneablity to a class
|
2
|
+
# via the standard #dup and #clone methods.
|
3
|
+
#
|
4
|
+
# Cloneable was originally ported from Jim Weirich's Rake.
|
5
|
+
# The current version is the work of Ken Bloom.
|
6
|
+
#
|
7
|
+
# DEPRECATED: A better approach is to provide a #deep_dup and and a #deep_clone,
|
8
|
+
# then if a class needs these for #dup and #clone they can just alias them.
|
9
|
+
#
|
10
|
+
# CREDIT: Ken Bloom
|
11
|
+
|
12
|
+
module Cloneable
|
13
|
+
|
14
|
+
def initialize_copy(sibling)
|
15
|
+
# First duplicate my superclass' state. Note that if it's duplicating
|
16
|
+
# instance variables, this will be overwritten, but this is important
|
17
|
+
# because we could be dealing with a C extension with state hidden from
|
18
|
+
# the Ruby interpreter.
|
19
|
+
super
|
20
|
+
|
21
|
+
# We want to know if we're being dup'ed or clone'd, because we want to
|
22
|
+
# preserve the state of our internals the same way our state is being
|
23
|
+
# preserved. (If we can't figure it out, we'll just use #dup.)
|
24
|
+
operation = (
|
25
|
+
copy_call = caller.find{|x| x !~ /'initialize_copy'/}
|
26
|
+
copy_match = copy_call.match(/`(dup|clone)'/)
|
27
|
+
copy_match ? copy_match[1] : :dup
|
28
|
+
)
|
29
|
+
|
30
|
+
sibling.instance_variables.each do |ivar|
|
31
|
+
value = sibling.instance_variable_get(ivar)
|
32
|
+
|
33
|
+
# Set my instance variable to be a #dup or #clone
|
34
|
+
# or my sibling, depending on what's happening to me right now.
|
35
|
+
instance_variable_set(ivar, value.send(operation))
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
# TODO: Is there a more robust means of determining if clone or dup is used?
|
40
|
+
#def clone
|
41
|
+
# @_copy_operation = :clone
|
42
|
+
# super
|
43
|
+
#end
|
44
|
+
#
|
45
|
+
#def dup
|
46
|
+
# @_copy_operation = :dup
|
47
|
+
# super
|
48
|
+
#end
|
49
|
+
|
50
|
+
end
|
51
|
+
|
52
|
+
|
53
|
+
|
54
|
+
# OLD VERSION
|
55
|
+
|
56
|
+
#module Cloneable
|
57
|
+
# def clone
|
58
|
+
# sibling = self.class.new
|
59
|
+
# instance_variables.each do |ivar|
|
60
|
+
# value = self.instance_variable_get(ivar)
|
61
|
+
# sibling.instance_variable_set(ivar, value.dup) #rake_dup)
|
62
|
+
# end
|
63
|
+
# sibling
|
64
|
+
# end
|
65
|
+
# alias_method :dup, :clone
|
66
|
+
#end
|
67
|
+
|
@@ -0,0 +1,56 @@
|
|
1
|
+
if defined?(Continuation)
|
2
|
+
|
3
|
+
# = Continuation Extension
|
4
|
+
#
|
5
|
+
# Creates a continuation in a way that is easier to use than callcc.
|
6
|
+
# On the initial call this will return the created Continuation and
|
7
|
+
# the arguments you gave to Continuation.create in an Array. If you
|
8
|
+
# then issue .call() on the Continuation execution will jump back to
|
9
|
+
# the point of time where you initially invoked Continuation.create,
|
10
|
+
# but this time it will return the Continuation and the arguments
|
11
|
+
# you supplied in an Array.
|
12
|
+
#
|
13
|
+
# You can supply a block instead of default arguments which will
|
14
|
+
# cause that block to be executed once and its result to be returned
|
15
|
+
# along side the created Continuation, but this form is confusing
|
16
|
+
# and does only rarely make sense.
|
17
|
+
#
|
18
|
+
# # Count from 0 to 10
|
19
|
+
# cc, counter = Continuation.create(0)
|
20
|
+
# counter #~> 0..10
|
21
|
+
# cc.call(counter + 1) if counter < 10
|
22
|
+
#
|
23
|
+
# # Implement something similar to Array#inject using Continuations.
|
24
|
+
# # For simplicity's sake, this is not fully compatible with the real
|
25
|
+
# # inject. Make sure that you understand Array#inject before you try
|
26
|
+
# # to understand this.
|
27
|
+
# class ::Array
|
28
|
+
# def cc_inject(value = nil)
|
29
|
+
# copy = self.clone
|
30
|
+
# cc, result, item = Continuation.create(value, nil)
|
31
|
+
# next_item = copy.shift
|
32
|
+
# if result and item
|
33
|
+
# # Aggregate the result using the block.
|
34
|
+
# cc.call(yield(result, item), next_item)
|
35
|
+
# elsif next_item
|
36
|
+
# # item not yet set and Array is not empty:
|
37
|
+
# # This means we did not get a value and thus need to use the
|
38
|
+
# # first item from the Array before we can start using the
|
39
|
+
# # block to aggregate the result.
|
40
|
+
# cc.call(next_item, result)
|
41
|
+
# end
|
42
|
+
#
|
43
|
+
# return result
|
44
|
+
# end
|
45
|
+
# end
|
46
|
+
# [1,2,3,4,5].cc_inject { |acc, n| acc + n } # => 15
|
47
|
+
#
|
48
|
+
def Continuation.create(*args, &block)
|
49
|
+
args = [args] if not args.nil? and not args.is_a? Array # 1.6.8 compatibility
|
50
|
+
cc = nil; result = callcc {|c| cc = c; block.call(cc) if block and args.empty?}
|
51
|
+
result ||= args
|
52
|
+
return *[cc, *result]
|
53
|
+
end
|
54
|
+
|
55
|
+
end
|
56
|
+
|
@@ -0,0 +1,32 @@
|
|
1
|
+
|
2
|
+
require 'date'
|
3
|
+
|
4
|
+
class Time
|
5
|
+
alias_method :old_compare, :<=>
|
6
|
+
private :old_compare
|
7
|
+
|
8
|
+
# Allow for Date <=> DateTime <=> Time, to work as expected.
|
9
|
+
|
10
|
+
def <=>(other)
|
11
|
+
if Date === other or DateTime === other
|
12
|
+
self.to_datetime <=> other
|
13
|
+
else
|
14
|
+
old_compare(other)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
class Date
|
20
|
+
alias_method :old_compare, :<=>
|
21
|
+
private :old_compare
|
22
|
+
|
23
|
+
# Allow for Date <=> DateTime <=> Time, to work as expected.
|
24
|
+
|
25
|
+
def <=>(other)
|
26
|
+
if Time === other
|
27
|
+
self.to_datetime <=> other.to_datetime
|
28
|
+
else
|
29
|
+
old_compare(other)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,434 @@
|
|
1
|
+
require 'date'
|
2
|
+
require 'facets/time/stamp'
|
3
|
+
require 'facets/date/cmp'
|
4
|
+
|
5
|
+
# = Date
|
6
|
+
#
|
7
|
+
# This new version of Date extension has been largely improved by
|
8
|
+
# porting some of the methods used by ActiveSupport. The old version
|
9
|
+
# already had much in common with the Active Support library, so it
|
10
|
+
# was decided to take it a step further in that direction for the
|
11
|
+
# sake of interoparability.
|
12
|
+
#
|
13
|
+
# Hopefully most of these methods will find there way into Ruby's
|
14
|
+
# own standard library eventually.
|
15
|
+
#
|
16
|
+
# The biggest difference with ActiveSupport is the lack of many
|
17
|
+
# of the "English-esque" methods, and that we use #stamp with
|
18
|
+
# Date::FORMAT, instead of #to_formmated_s with Date::DATE_FORMATS.
|
19
|
+
# We do not override the standard #to_s method like ActiveSupport does.
|
20
|
+
|
21
|
+
class Date
|
22
|
+
|
23
|
+
FORMAT = {
|
24
|
+
:short => "%e %b",
|
25
|
+
:long => "%B %e, %Y",
|
26
|
+
:db => "%Y-%m-%d",
|
27
|
+
:number => "%Y%m%d",
|
28
|
+
:rfc822 => "%e %b %Y",
|
29
|
+
:default => "%Y-%m-%d",
|
30
|
+
nil => "%Y-%m-%d"
|
31
|
+
}
|
32
|
+
|
33
|
+
# Returns a new Date representing the date 1 day ago (i.e. yesterday's date).
|
34
|
+
def self.yesterday
|
35
|
+
::Date.today.yesterday
|
36
|
+
end
|
37
|
+
|
38
|
+
# Returns a new Date representing the date 1 day after today (i.e. tomorrow's date).
|
39
|
+
def self.tomorrow
|
40
|
+
::Date.today.tomorrow
|
41
|
+
end
|
42
|
+
|
43
|
+
# Returns Time.zone.today when config.time_zone is set, otherwise just returns Date.today.
|
44
|
+
def self.current
|
45
|
+
::Time.zone_default ? ::Time.zone.today : ::Date.today
|
46
|
+
end
|
47
|
+
|
48
|
+
# A method to keep Time, Date and DateTime instances interchangeable
|
49
|
+
# on conversions. In this case, it simply returns +self+.
|
50
|
+
def to_date
|
51
|
+
self
|
52
|
+
end unless method_defined?(:to_date) # 1.9+ ?
|
53
|
+
|
54
|
+
# Converts a Date instance to a DateTime, where the time is set to the beginning of the day
|
55
|
+
# and UTC offset is set to 0.
|
56
|
+
#
|
57
|
+
# date = Date.new(2007, 11, 10) # Sat, 10 Nov 2007
|
58
|
+
# date.to_datetime # Sat, 10 Nov 2007 00:00:00 0000
|
59
|
+
#
|
60
|
+
def to_datetime
|
61
|
+
::DateTime.civil(year, month, day, 0, 0, 0, 0)
|
62
|
+
end unless method_defined?(:to_datetime) # 1.9+ ?
|
63
|
+
|
64
|
+
# Converts a Date instance to a Time, where the time is set to the beginning of the day.
|
65
|
+
# The timezone can be either :local or :utc (default :local).
|
66
|
+
#
|
67
|
+
# date = Date.new(2007, 11, 10) # Sat, 10 Nov 2007
|
68
|
+
#
|
69
|
+
# date.to_time # Sat Nov 10 00:00:00 0800 2007
|
70
|
+
# date.to_time(:local) # Sat Nov 10 00:00:00 0800 2007
|
71
|
+
#
|
72
|
+
# date.to_time(:utc) # Sat Nov 10 00:00:00 UTC 2007
|
73
|
+
#
|
74
|
+
def to_time(form=:local)
|
75
|
+
::Time.send(form, year, month, day)
|
76
|
+
##::Time.send("#{form}_time", year, month, day)
|
77
|
+
end
|
78
|
+
|
79
|
+
#
|
80
|
+
def xmlschema
|
81
|
+
to_time.xmlschema
|
82
|
+
end
|
83
|
+
|
84
|
+
# Returns the number of days in the date's month.
|
85
|
+
#
|
86
|
+
# Date.new(2004,2).days_in_month #=> 29
|
87
|
+
#
|
88
|
+
# CREDIT: Ken Kunz.
|
89
|
+
def days_in_month
|
90
|
+
Date.civil(year, month, -1).day
|
91
|
+
end
|
92
|
+
|
93
|
+
def days_of_month
|
94
|
+
(1..days_in_month).to_a
|
95
|
+
end
|
96
|
+
|
97
|
+
# Get the month name for this date object
|
98
|
+
#
|
99
|
+
# CREDIT: Benjamin Oakes
|
100
|
+
def month_name
|
101
|
+
MONTHNAMES[self.month]
|
102
|
+
end
|
103
|
+
|
104
|
+
# Convert to a formatted string. See DATE_FORMATS for predefined formats.
|
105
|
+
#
|
106
|
+
# This method is aliased to <tt>to_s</tt>.
|
107
|
+
#
|
108
|
+
# date = Date.new(2007, 11, 10) # Sat, 10 Nov 2007
|
109
|
+
#
|
110
|
+
# date.stamp(:db) # => "2007-11-10"
|
111
|
+
# date.stamp(:short) # => "10 Nov"
|
112
|
+
# date.stamp(:long) # => "November 10, 2007"
|
113
|
+
# date.stamp(:rfc822) # => "10 Nov 2007"
|
114
|
+
#
|
115
|
+
# == Adding your own formats to stamp
|
116
|
+
# You can add your own formats to the Date::FORMAT hash.
|
117
|
+
# Use the format name as the hash key and a strftime string
|
118
|
+
# as the value. Eg.
|
119
|
+
#
|
120
|
+
# Date::FORMAT[:month_and_year] = "%B %Y"
|
121
|
+
#
|
122
|
+
def stamp(format=:default)
|
123
|
+
if formatter = FORMAT[format]
|
124
|
+
strftime(formatter)
|
125
|
+
else
|
126
|
+
to_s
|
127
|
+
end
|
128
|
+
end
|
129
|
+
|
130
|
+
## Overrides the default inspect method with a human readable one, e.g., "Mon, 21 Feb 2005"
|
131
|
+
##def inspect
|
132
|
+
## strftime("%a, %d %b %Y")
|
133
|
+
##end
|
134
|
+
|
135
|
+
# Provides precise Date calculations for years, months, and days.
|
136
|
+
# The +options+ parameter takes a hash with any of these keys:
|
137
|
+
# <tt>:years</tt>, <tt>:months</tt>, <tt>:weeks</tt>, <tt>:days</tt>.
|
138
|
+
def advance(options)
|
139
|
+
d = self
|
140
|
+
d = d >> options.delete(:years) * 12 if options[:years]
|
141
|
+
d = d >> options.delete(:months) if options[:months]
|
142
|
+
d = d + options.delete(:weeks) * 7 if options[:weeks]
|
143
|
+
d = d + options.delete(:days) if options[:days]
|
144
|
+
d
|
145
|
+
end
|
146
|
+
|
147
|
+
# Returns a new Date where one or more of the elements have been changed
|
148
|
+
# according to the +options+ parameter.
|
149
|
+
#
|
150
|
+
# Date.new(2007, 5, 12).change(:day=>1) # Date.new(2007, 5, 1)
|
151
|
+
# Date.new(2007, 5, 12).change(:year=>2005, :month=>1) # Date.new(2005, 1, 12)
|
152
|
+
#
|
153
|
+
def change(options)
|
154
|
+
::Date.new(
|
155
|
+
options[:year] || self.year,
|
156
|
+
options[:month] || self.month,
|
157
|
+
options[:day] || self.day
|
158
|
+
)
|
159
|
+
end
|
160
|
+
|
161
|
+
# Converts Date to a Time (or DateTime if necessary) with the time portion
|
162
|
+
# set to the beginning of the day (0:00) and then subtracts the specified
|
163
|
+
# number of seconds
|
164
|
+
def ago(seconds)
|
165
|
+
to_time.since(-seconds)
|
166
|
+
end
|
167
|
+
|
168
|
+
# Converts Date to a Time (or DateTime if necessary) with the time portion
|
169
|
+
# set to the beginning of the day (0:00) and then adds the specified number
|
170
|
+
# of seconds.
|
171
|
+
def since(seconds)
|
172
|
+
to_time.since(seconds)
|
173
|
+
end
|
174
|
+
alias :in :since
|
175
|
+
|
176
|
+
# Converts Date to a Time (or DateTime if necessary) with the time portion
|
177
|
+
# set to the beginning of the day (0:00).
|
178
|
+
def beginning_of_day
|
179
|
+
to_time
|
180
|
+
end
|
181
|
+
alias :midnight :beginning_of_day
|
182
|
+
|
183
|
+
# Convenience method which returns a new Date/DateTime representing the
|
184
|
+
# time 1 day ago.
|
185
|
+
def yesterday
|
186
|
+
self - 1
|
187
|
+
end
|
188
|
+
|
189
|
+
# Convenience method which returns a new Date/DateTime representing
|
190
|
+
# the time 1 day since the instance time.
|
191
|
+
def tomorrow
|
192
|
+
self + 1
|
193
|
+
end
|
194
|
+
|
195
|
+
end
|
196
|
+
|
197
|
+
|
198
|
+
class DateTime
|
199
|
+
|
200
|
+
#
|
201
|
+
def self.local_offset
|
202
|
+
::Time.local(2007).utc_offset.to_r / 86400
|
203
|
+
end
|
204
|
+
|
205
|
+
def future?
|
206
|
+
self > ::DateTime.current
|
207
|
+
end
|
208
|
+
|
209
|
+
def past?
|
210
|
+
self < ::DateTime.current
|
211
|
+
end
|
212
|
+
|
213
|
+
# Converts self to a Ruby Date object; time portion is discarded
|
214
|
+
def to_date
|
215
|
+
::Date.new(year, month, day)
|
216
|
+
end
|
217
|
+
|
218
|
+
# Attempts to convert self to a Ruby Time object; returns self if
|
219
|
+
# out of range of Ruby Time class. If self has an offset other than 0,
|
220
|
+
# self will just be returned unaltered, since there's no clean way
|
221
|
+
# to map it to a Time.
|
222
|
+
def to_time
|
223
|
+
self.offset == 0 ? ::Time.utc_time(year, month, day, hour, min, sec) : self
|
224
|
+
end
|
225
|
+
|
226
|
+
# To be able to keep Times, Dates and DateTimes interchangeable on conversions
|
227
|
+
def to_datetime
|
228
|
+
self
|
229
|
+
end
|
230
|
+
|
231
|
+
# Convert to a formatted string. See Time::FORMAT for predefined formats.
|
232
|
+
#
|
233
|
+
# This method is aliased to <tt>to_s</tt>.
|
234
|
+
#
|
235
|
+
# datetime = DateTime.civil(2007,12,4,0,0,0,0) # Tue, 04 Dec 2007 00:00:00 +0000
|
236
|
+
#
|
237
|
+
# datetime.stamp(:db) # => "2007-12-04 00:00:00"
|
238
|
+
# datetime.stamp(:db) # => "2007-12-04 00:00:00"
|
239
|
+
# datetime.stamp(:number) # => "20071204000000"
|
240
|
+
# datetime.stamp(:short) # => "04 Dec 00:00"
|
241
|
+
# datetime.stamp(:long) # => "December 04, 2007 00:00"
|
242
|
+
# datetime.stamp(:rfc822) # => "Tue, 04 Dec 2007 00:00:00 +0000"
|
243
|
+
#
|
244
|
+
# == Adding your own datetime formats to stamp
|
245
|
+
#
|
246
|
+
# DateTime formats are shared with Time. You can add your own to the
|
247
|
+
# Time::FORMAT hash. Use the format name as the hash key and
|
248
|
+
# a strftime string as the value. Eg.
|
249
|
+
#
|
250
|
+
# Time::FORMAT[:month_and_year] = "%B %Y"
|
251
|
+
#
|
252
|
+
def stamp(format=:default)
|
253
|
+
if formatter = ::Time::FORMAT[format]
|
254
|
+
strftime(formatter)
|
255
|
+
else
|
256
|
+
to_s
|
257
|
+
end
|
258
|
+
end
|
259
|
+
|
260
|
+
# Seconds since midnight: DateTime.now.seconds_since_midnight
|
261
|
+
def seconds_since_midnight
|
262
|
+
self.sec + (self.min * 60) + (self.hour * 3600)
|
263
|
+
end
|
264
|
+
|
265
|
+
# Returns a new DateTime where one or more of the elements have been
|
266
|
+
# changed according to the +options+ parameter. The time options
|
267
|
+
# (hour, minute, sec) reset cascadingly, so if only the hour is
|
268
|
+
# passed, then minute and sec is set to 0. If the hour and
|
269
|
+
# minute is passed, then sec is set to 0.
|
270
|
+
def change(options)
|
271
|
+
::DateTime.civil(
|
272
|
+
options[:year] || self.year,
|
273
|
+
options[:month] || self.month,
|
274
|
+
options[:day] || self.day,
|
275
|
+
options[:hour] || self.hour,
|
276
|
+
options[:min] || (options[:hour] ? 0 : self.min),
|
277
|
+
options[:sec] || ((options[:hour] || options[:min]) ? 0 : self.sec),
|
278
|
+
options[:offset] || self.offset,
|
279
|
+
options[:start] || self.start
|
280
|
+
)
|
281
|
+
end
|
282
|
+
|
283
|
+
# Uses Date to provide precise Time calculations for years, months, and days.
|
284
|
+
# The +options+ parameter takes a hash with any of these keys: <tt>:years</tt>,
|
285
|
+
# <tt>:months</tt>, <tt>:weeks</tt>, <tt>:days</tt>, <tt>:hours</tt>,
|
286
|
+
# <tt>:minutes</tt>, <tt>:seconds</tt>.
|
287
|
+
def advance(options)
|
288
|
+
d = to_date.advance(options)
|
289
|
+
datetime_advanced_by_date = change(:year => d.year, :month => d.month, :day => d.day)
|
290
|
+
seconds_to_advance = (options[:seconds] || 0) + (options[:minutes] || 0) * 60 + (options[:hours] || 0) * 3600
|
291
|
+
seconds_to_advance == 0 ? datetime_advanced_by_date : datetime_advanced_by_date.since(seconds_to_advance)
|
292
|
+
end
|
293
|
+
|
294
|
+
# Returns a new DateTime representing the time a number of seconds ago
|
295
|
+
# Do not use this method in combination with x.months, use months_ago instead!
|
296
|
+
def ago(seconds)
|
297
|
+
self.since(-seconds)
|
298
|
+
end
|
299
|
+
|
300
|
+
# Returns a new DateTime representing the time a number of seconds since the instance time
|
301
|
+
# Do not use this method in combination with x.months, use months_since instead!
|
302
|
+
def since(seconds)
|
303
|
+
self + Rational(seconds.round, 86400)
|
304
|
+
end
|
305
|
+
alias :in :since
|
306
|
+
|
307
|
+
# Returns a new DateTime representing the start of the day (0:00)
|
308
|
+
def beginning_of_day
|
309
|
+
change(:hour => 0)
|
310
|
+
end
|
311
|
+
alias :midnight :beginning_of_day
|
312
|
+
|
313
|
+
# Returns a new DateTime representing the end of the day (23:59:59)
|
314
|
+
def end_of_day
|
315
|
+
change(:hour => 23, :min => 59, :sec => 59)
|
316
|
+
end
|
317
|
+
|
318
|
+
# Adjusts DateTime to UTC by adding its offset value; offset is set to 0
|
319
|
+
#
|
320
|
+
# Example:
|
321
|
+
#
|
322
|
+
# DateTime.civil(2005,2,21,10,11,12,Rational(-6, 24)) # Mon, 21 Feb 2005 10:11:12 -0600
|
323
|
+
# DateTime.civil(2005,2,21,10,11,12,Rational(-6, 24)).utc # Mon, 21 Feb 2005 16:11:12 +0000
|
324
|
+
#
|
325
|
+
def utc
|
326
|
+
new_offset(0)
|
327
|
+
end
|
328
|
+
alias_method :getutc, :utc
|
329
|
+
|
330
|
+
# Returns true if offset == 0
|
331
|
+
def utc?
|
332
|
+
offset == 0
|
333
|
+
end
|
334
|
+
|
335
|
+
# Returns the offset value in seconds
|
336
|
+
def utc_offset
|
337
|
+
(offset * 86400).to_i
|
338
|
+
end
|
339
|
+
|
340
|
+
# Converts datetime to an appropriate format for use in XML
|
341
|
+
def xmlschema
|
342
|
+
strftime("%Y-%m-%dT%H:%M:%S%Z")
|
343
|
+
end unless method_defined?(:xmlschema) # 1.9+ ?
|
344
|
+
|
345
|
+
# Converts self to a floating-point number of seconds since the Unix epoch
|
346
|
+
def to_f
|
347
|
+
days_since_unix_epoch = self - ::DateTime.civil(1970)
|
348
|
+
(days_since_unix_epoch * 86_400).to_f
|
349
|
+
end
|
350
|
+
|
351
|
+
end
|
352
|
+
|
353
|
+
|
354
|
+
class Time
|
355
|
+
|
356
|
+
#
|
357
|
+
def self.local_time(*args)
|
358
|
+
time_with_datetime_fallback(:local, *args)
|
359
|
+
end
|
360
|
+
|
361
|
+
#
|
362
|
+
def self.utc_time(*args)
|
363
|
+
time_with_datetime_fallback(:utc, *args)
|
364
|
+
end
|
365
|
+
|
366
|
+
#
|
367
|
+
def self.time_with_datetime_fallback(utc_or_local, year, month=1, day=1, hour=0, min=0, sec=0, usec=0)
|
368
|
+
::Time.send(utc_or_local, year, month, day, hour, min, sec, usec)
|
369
|
+
rescue
|
370
|
+
offset = utc_or_local.to_sym == :local ? ::DateTime.local_offset : 0
|
371
|
+
::DateTime.civil(year, month, day, hour, min, sec, offset)
|
372
|
+
end
|
373
|
+
|
374
|
+
public :to_date
|
375
|
+
public :to_datetime
|
376
|
+
|
377
|
+
# Converts a Time object to a Date, dropping hour, minute, and second precision.
|
378
|
+
#
|
379
|
+
# my_time = Time.now # Mon Nov 12 22:59:51 -0500 2007
|
380
|
+
# my_time.to_date # Mon, 12 Nov 2007
|
381
|
+
#
|
382
|
+
# your_time = Time.parse("1/13/2009 1:13:03 P.M.") # Tue Jan 13 13:13:03 -0500 2009
|
383
|
+
# your_time.to_date # Tue, 13 Jan 2009
|
384
|
+
#
|
385
|
+
def to_date
|
386
|
+
::Date.new(year, month, day)
|
387
|
+
end
|
388
|
+
|
389
|
+
## # Convert a Time to a Date. Time is a superset of Date.
|
390
|
+
## # It is the year, month and day that are carried over.
|
391
|
+
##
|
392
|
+
## def to_date
|
393
|
+
## require 'date' # just in case
|
394
|
+
## jd = Date.__send__(:civil_to_jd, year, mon, mday, Date::ITALY)
|
395
|
+
## Date.new!(Date.__send__(:jd_to_ajd, jd, 0, 0), 0, Date::ITALY)
|
396
|
+
## end
|
397
|
+
|
398
|
+
|
399
|
+
# Converts a Time instance to a Ruby DateTime instance, preserving UTC offset.
|
400
|
+
#
|
401
|
+
# my_time = Time.now # Mon Nov 12 23:04:21 -0500 2007
|
402
|
+
# my_time.to_datetime # Mon, 12 Nov 2007 23:04:21 -0500
|
403
|
+
#
|
404
|
+
# your_time = Time.parse("1/13/2009 1:13:03 P.M.") # Tue Jan 13 13:13:03 -0500 2009
|
405
|
+
# your_time.to_datetime # Tue, 13 Jan 2009 13:13:03 -0500
|
406
|
+
#
|
407
|
+
def to_datetime
|
408
|
+
::DateTime.civil(year, month, day, hour, min, sec, Rational(utc_offset, 86400))
|
409
|
+
end
|
410
|
+
|
411
|
+
end
|
412
|
+
|
413
|
+
|
414
|
+
class String
|
415
|
+
|
416
|
+
#
|
417
|
+
def to_time(form = :utc)
|
418
|
+
::Time.__send__("#{form}_time", *::Date._parse(self, false).values_at(:year, :mon, :mday, :hour, :min, :sec).map{|arg| arg || 0 })
|
419
|
+
end
|
420
|
+
|
421
|
+
# Convert string to DateTime.
|
422
|
+
def to_datetime
|
423
|
+
date = ::Date._parse(self, false).values_at(:year, :mon, :mday, :hour, :min, :sec).map { |arg| arg || 0 }
|
424
|
+
::DateTime.civil(*date)
|
425
|
+
end
|
426
|
+
|
427
|
+
# Parse data from string.
|
428
|
+
def to_date
|
429
|
+
#::Date::civil(*ParseDate.parsedate(self)[0..2])
|
430
|
+
::Date.new(*::Date._parse(self, false).values_at(:year, :mon, :mday))
|
431
|
+
end
|
432
|
+
|
433
|
+
end
|
434
|
+
|
@@ -0,0 +1,45 @@
|
|
1
|
+
require 'digest'
|
2
|
+
|
3
|
+
module Digest
|
4
|
+
|
5
|
+
module Instance
|
6
|
+
|
7
|
+
# For Ruby < 1.9.2
|
8
|
+
|
9
|
+
unless instance_methods.include? :base64digest
|
10
|
+
|
11
|
+
# From Ruby 1.9.2 source
|
12
|
+
def base64digest(str = nil)
|
13
|
+
[str ? digest(str) : digest].pack('m0')
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
17
|
+
|
18
|
+
unless instance_methods.include? :base64digest!
|
19
|
+
|
20
|
+
# From Ruby 1.9.2 source
|
21
|
+
def base64digest!
|
22
|
+
[digest!].pack('m0')
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
28
|
+
|
29
|
+
class Class
|
30
|
+
|
31
|
+
# For Ruby < 1.9.2
|
32
|
+
|
33
|
+
unless methods.include? :base64digest
|
34
|
+
|
35
|
+
# From Ruby 1.9.2 source
|
36
|
+
def self.base64digest(str, *args)
|
37
|
+
[self.digest(str, *args)].pack('m0')
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
41
|
+
|
42
|
+
end
|
43
|
+
|
44
|
+
end
|
45
|
+
|