facets 1.3.3 → 1.4.0
Sign up to get free protection for your applications and to get access to all the features.
- data/{doc/AUTHORS → AUTHORS} +12 -3
- data/README +35 -29
- data/WARNING +56 -0
- data/demo/annotation/demo_annotation.rb +22 -0
- data/demo/ansicolor/cdiff.rb +20 -0
- data/demo/ansicolor/example.rb +82 -0
- data/demo/io-reactor/chatserver.rb +347 -0
- data/demo/lisp/game.rb +47 -0
- data/lib/facet/all.rb +1 -0
- data/lib/facet/annattr.rb +1 -0
- data/lib/facet/class/to_proc.rb +1 -0
- data/lib/facet/cookie.rb +1 -0
- data/lib/facet/dir/self/descend.rb +1 -0
- data/lib/facet/enumerable/count.rb +1 -0
- data/lib/facet/hash/to_proc.rb +1 -0
- data/lib/facet/hashbuilder.rb +1 -0
- data/lib/facet/http.rb +1 -0
- data/lib/facet/httpaccess.rb +1 -0
- data/lib/facet/kernel/__get__.rb +1 -0
- data/lib/facet/kernel/__set__.rb +1 -0
- data/lib/facet/kernel/cache.rb +1 -0
- data/lib/facet/kernel/respond.rb +1 -0
- data/lib/facet/lazy.rb +1 -0
- data/lib/facet/module/class.rb +1 -0
- data/lib/facet/module/nodef.rb +1 -0
- data/lib/facet/opencascade.rb +1 -0
- data/lib/facet/pqueue.rb +1 -0
- data/lib/facet/taskable.rb +1 -0
- data/lib/facets.rb +98 -37
- data/lib/facets/core/all.rb +5 -0
- data/lib/facets/core/class/to_proc.rb +25 -0
- data/lib/facets/core/dir/self/ascend.rb +2 -1
- data/lib/facets/core/dir/self/descend.rb +11 -0
- data/lib/facets/core/enumerable/accumulate.rb +2 -2
- data/lib/facets/core/enumerable/count.rb +54 -0
- data/lib/facets/core/enumerable/cross.rb +3 -0
- data/lib/facets/core/enumerable/graph.rb +8 -4
- data/lib/facets/core/enumerable/self/cross.rb +11 -5
- data/lib/facets/core/hash/to_proc.rb +34 -0
- data/lib/facets/core/hash/traverse.rb +10 -5
- data/lib/facets/core/kernel/__class__.rb +1 -1
- data/lib/facets/core/kernel/__get__.rb +5 -0
- data/lib/facets/core/kernel/__set__.rb +2 -0
- data/lib/facets/core/kernel/assign_from.rb +1 -1
- data/lib/facets/core/kernel/assign_with.rb +11 -3
- data/lib/facets/core/kernel/bool.rb +1 -1
- data/lib/facets/core/kernel/cache.rb +31 -0
- data/lib/facets/core/kernel/demo.rb +4 -0
- data/lib/facets/core/kernel/get_by_id.rb +1 -0
- data/lib/facets/core/kernel/in.rb +1 -1
- data/lib/facets/core/kernel/instance_assign.rb +2 -3
- data/lib/facets/core/kernel/method.rb +25 -7
- data/lib/facets/core/kernel/methods.rb +1 -1
- data/lib/facets/core/kernel/new.rb +1 -1
- data/lib/facets/core/kernel/object_class.rb +1 -1
- data/lib/facets/core/kernel/object_hexid.rb +1 -1
- data/lib/facets/core/kernel/own.rb +1 -1
- data/lib/facets/core/kernel/require_all.rb +1 -0
- data/lib/facets/core/kernel/require_esc.rb +4 -2
- data/lib/facets/core/kernel/require_facet.rb +2 -0
- data/lib/facets/core/kernel/require_local.rb +1 -0
- data/lib/facets/core/kernel/respond.rb +14 -0
- data/lib/facets/core/kernel/send_as.rb +1 -1
- data/lib/facets/core/kernel/silence_warnings.rb +1 -1
- data/lib/facets/core/kernel/singleton.rb +3 -1
- data/lib/facets/core/matchdata/matchtree.rb +13 -3
- data/lib/facets/core/module/class.rb +3 -0
- data/lib/facets/core/module/integrate.rb +31 -4
- data/lib/facets/core/module/{undef.rb → nodef.rb} +8 -3
- data/lib/facets/core/module/revisal.rb +5 -5
- data/lib/facets/more/annattr.rb +147 -0
- data/lib/facets/more/annotation.rb +32 -136
- data/lib/facets/more/ansicode.rb +89 -100
- data/lib/facets/more/aspects.rb +28 -0
- data/lib/facets/more/association.rb +88 -47
- data/lib/facets/more/basicobject.rb +51 -33
- data/lib/facets/more/bbcode.rb +21 -34
- data/lib/facets/more/binaryreader.rb +62 -33
- data/lib/facets/more/bitmask.rb +24 -24
- data/lib/facets/more/blankslate.rb +4 -0
- data/lib/facets/more/builderobject.rb +16 -20
- data/lib/facets/more/bytes.rb +43 -24
- data/lib/facets/more/classinherit.rb +15 -31
- data/lib/facets/more/classmethods.rb +19 -29
- data/lib/facets/more/cloneable.rb +42 -30
- data/lib/facets/more/consoleapp.rb +42 -22
- data/lib/facets/more/cookie.rb +565 -0
- data/lib/facets/more/coroutine.rb +17 -21
- data/lib/facets/more/crypt.rb +33 -12
- data/lib/facets/more/dictionary.rb +27 -36
- data/lib/facets/more/downloader.rb +21 -17
- data/lib/facets/more/elementor.rb +22 -0
- data/lib/facets/more/enumerablepass.rb +19 -27
- data/lib/facets/more/expirable.rb +18 -28
- data/lib/facets/more/filelist.rb +33 -32
- data/lib/facets/more/floatstring.rb +31 -40
- data/lib/facets/more/functor.rb +15 -25
- data/lib/facets/more/hashbuilder.rb +76 -0
- data/lib/facets/more/heap.rb +29 -36
- data/lib/facets/more/htmlbuilder.rb +22 -24
- data/lib/facets/more/htmlhelper.rb +89 -0
- data/lib/facets/more/http.rb +570 -0
- data/lib/facets/more/httpaccess.rb +1608 -0
- data/lib/facets/more/inheritor.rb +29 -21
- data/lib/facets/more/interval.rb +21 -25
- data/lib/facets/more/ioredirect.rb +21 -25
- data/lib/facets/more/json.rb +27 -17
- data/lib/facets/more/lazy.rb +238 -0
- data/lib/facets/more/lisp.rb +24 -27
- data/lib/facets/more/lisp_format.rb +93 -85
- data/lib/facets/more/lrucache.rb +17 -27
- data/lib/facets/more/mathconstants.rb +22 -40
- data/lib/facets/more/methodprobe.rb +56 -61
- data/lib/facets/more/mock.rb +24 -17
- data/lib/facets/more/multipliers.rb +21 -17
- data/lib/facets/more/multiton.rb +18 -24
- data/lib/facets/more/nackclass.rb +17 -21
- data/lib/facets/more/nilcomparable.rb +28 -30
- data/lib/facets/more/nullclass.rb +16 -15
- data/lib/facets/more/one.rb +94 -58
- data/lib/facets/more/opencascade.rb +187 -0
- data/lib/facets/more/openobject.rb +89 -66
- data/lib/facets/more/orderedhash.rb +4 -0
- data/lib/facets/more/ormsupport.rb +18 -29
- data/lib/facets/more/overload.rb +39 -3
- data/lib/facets/more/paramix.rb +16 -24
- data/lib/facets/more/pathlist.rb +17 -23
- data/lib/facets/more/pool.rb +21 -29
- data/lib/facets/more/pqueue.rb +190 -0
- data/lib/facets/more/preinitialize.rb +17 -18
- data/lib/facets/more/progressbar.rb +19 -15
- data/lib/facets/more/promoteself.rb +17 -21
- data/lib/facets/more/quaternion.rb +379 -346
- data/lib/facets/more/recorder.rb +15 -20
- data/lib/facets/more/reference.rb +25 -22
- data/lib/facets/more/rexmlbuilder.rb +21 -6
- data/lib/facets/more/rtals.rb +27 -24
- data/lib/facets/more/semaphore.rb +15 -28
- data/lib/facets/more/snapshot.rb +45 -41
- data/lib/facets/more/stateparser.rb +25 -35
- data/lib/facets/more/statichash.rb +37 -29
- data/lib/facets/more/syncarray.rb +18 -26
- data/lib/facets/more/synchash.rb +17 -26
- data/lib/facets/more/system.rb +25 -17
- data/lib/facets/more/tagiterator.rb +15 -39
- data/lib/facets/more/taskable.rb +417 -0
- data/lib/facets/more/timer.rb +22 -26
- data/lib/facets/more/times.rb +23 -23
- data/lib/facets/more/tracepoint.rb +25 -24
- data/lib/facets/more/tuple.rb +25 -42
- data/lib/facets/more/typecast.rb +27 -29
- data/lib/facets/more/uninheritable.rb +15 -22
- data/lib/facets/more/units.rb +23 -29
- data/lib/facets/more/xmlbuilder.rb +20 -22
- data/lib/facets/more/xmlhelper.rb +18 -21
- data/lib/facets/more/xoxo.rb +23 -11
- data/lib/facets/more/yamlstruct.rb +25 -22
- data/test/lib/facets/core/array/test_at_rand.rb +1 -1
- data/test/lib/facets/core/array/test_delete_unless.rb +1 -1
- data/test/lib/facets/core/array/test_delete_values.rb +1 -1
- data/test/lib/facets/core/array/test_delete_values_at.rb +1 -1
- data/test/lib/facets/core/array/test_first.rb +1 -1
- data/test/lib/facets/core/array/test_head.rb +1 -1
- data/test/lib/facets/core/array/test_last_index.rb +1 -1
- data/test/lib/facets/core/array/test_merge.rb +1 -1
- data/test/lib/facets/core/array/test_mid.rb +1 -1
- data/test/lib/facets/core/array/test_middle.rb +1 -1
- data/test/lib/facets/core/array/test_op_fetch.rb +1 -1
- data/test/lib/facets/core/array/test_op_store.rb +1 -1
- data/test/lib/facets/core/array/test_pick.rb +1 -1
- data/test/lib/facets/core/array/test_pos.rb +1 -1
- data/test/lib/facets/core/array/test_pot.rb +1 -1
- data/test/lib/facets/core/array/test_pull.rb +1 -1
- data/test/lib/facets/core/array/test_rand_index.rb +1 -1
- data/test/lib/facets/core/array/test_rand_subset.rb +1 -1
- data/test/lib/facets/core/array/test_range.rb +1 -1
- data/test/lib/facets/core/array/test_rotate.rb +1 -1
- data/test/lib/facets/core/array/test_select.rb +1 -1
- data/test/lib/facets/core/array/test_shuffle.rb +1 -1
- data/test/lib/facets/core/array/test_thru.rb +1 -1
- data/test/lib/facets/core/array/test_to_b.rb +1 -1
- data/test/lib/facets/core/array/test_to_h.rb +1 -1
- data/test/lib/facets/core/array/test_to_hash.rb +1 -1
- data/test/lib/facets/core/binding/self/test_of_caller.rb +1 -1
- data/test/lib/facets/core/binding/test___LINE__.rb +1 -1
- data/test/lib/facets/core/binding/test_call_stack.rb +1 -1
- data/test/lib/facets/core/binding/test_called.rb +1 -1
- data/test/lib/facets/core/binding/test_caller.rb +1 -1
- data/test/lib/facets/core/binding/test_defined.rb +1 -1
- data/test/lib/facets/core/binding/test_eval.rb +1 -1
- data/test/lib/facets/core/binding/test_local_variables.rb +1 -1
- data/test/lib/facets/core/binding/test_method_name.rb +1 -1
- data/test/lib/facets/core/binding/test_op_fetch.rb +1 -1
- data/test/lib/facets/core/binding/test_op_store.rb +1 -1
- data/test/lib/facets/core/binding/test_self.rb +1 -1
- data/test/lib/facets/core/class/test_cattr.rb +1 -1
- data/test/lib/facets/core/class/test_descendents.rb +1 -1
- data/test/lib/facets/core/class/test_method_name.rb +1 -1
- data/test/lib/facets/core/class/test_remove_descendents.rb +1 -1
- data/test/lib/facets/core/class/test_unix_path.rb +1 -1
- data/test/lib/facets/core/comparable/test_at_least.rb +1 -1
- data/test/lib/facets/core/comparable/test_clip.rb +1 -1
- data/test/lib/facets/core/comparable/test_cmp.rb +1 -1
- data/test/lib/facets/core/continuation/self/test_create.rb +1 -1
- data/test/lib/facets/core/date/test_days_in_month.rb +1 -1
- data/test/lib/facets/core/date/test_days_of_month.rb +1 -1
- data/test/lib/facets/core/date/test_stamp.rb +1 -1
- data/test/lib/facets/core/date/test_to_date.rb +1 -1
- data/test/lib/facets/core/date/test_to_s.rb +1 -1
- data/test/lib/facets/core/date/test_to_time.rb +1 -1
- data/test/lib/facets/core/dir/self/test_ancestor.rb +1 -1
- data/test/lib/facets/core/dir/self/test_ascend.rb +1 -1
- data/test/lib/facets/core/enumerable/self/test_combinations.rb +1 -1
- data/test/lib/facets/core/enumerable/self/test_cross.rb +1 -1
- data/test/lib/facets/core/enumerable/test_collect_with_index.rb +1 -1
- data/test/lib/facets/core/enumerable/test_commonality.rb +1 -1
- data/test/lib/facets/core/enumerable/test_compact_collect.rb +1 -1
- data/test/lib/facets/core/enumerable/test_count.rb +38 -0
- data/test/lib/facets/core/enumerable/test_cross.rb +1 -1
- data/test/lib/facets/core/enumerable/test_each_combination.rb +1 -1
- data/test/lib/facets/core/enumerable/test_each_pair.rb +1 -1
- data/test/lib/facets/core/enumerable/test_each_slice.rb +1 -1
- data/test/lib/facets/core/enumerable/test_each_unique_pair.rb +1 -1
- data/test/lib/facets/core/enumerable/test_entropy.rb +1 -1
- data/test/lib/facets/core/enumerable/test_every.rb +1 -1
- data/test/lib/facets/core/enumerable/test_ew.rb +1 -1
- data/test/lib/facets/core/enumerable/test_filter_collect.rb +1 -1
- data/test/lib/facets/core/enumerable/test_find_collisions.rb +1 -1
- data/test/lib/facets/core/enumerable/test_frequency.rb +1 -1
- data/test/lib/facets/core/enumerable/test_graph.rb +1 -1
- data/test/lib/facets/core/enumerable/test_ideal_entropy.rb +1 -1
- data/test/lib/facets/core/enumerable/test_none.rb +1 -1
- data/test/lib/facets/core/enumerable/test_occur.rb +1 -1
- data/test/lib/facets/core/enumerable/test_one.rb +1 -1
- data/test/lib/facets/core/enumerable/test_op_pow.rb +1 -1
- data/test/lib/facets/core/enumerable/test_partition_by.rb +1 -1
- data/test/lib/facets/core/enumerable/test_permute.rb +1 -1
- data/test/lib/facets/core/enumerable/test_probability.rb +1 -1
- data/test/lib/facets/core/enumerable/test_to_h.rb +1 -1
- data/test/lib/facets/core/enumerable/test_uniq_by.rb +1 -1
- data/test/lib/facets/core/file/self/test_create.rb +1 -1
- data/test/lib/facets/core/file/self/test_open_as_string.rb +1 -1
- data/test/lib/facets/core/file/self/test_read_list.rb +1 -1
- data/test/lib/facets/core/file/self/test_sanitize.rb +1 -1
- data/test/lib/facets/core/file/self/test_split_all.rb +1 -1
- data/test/lib/facets/core/float/test_round_at.rb +1 -1
- data/test/lib/facets/core/float/test_round_to.rb +1 -1
- data/test/lib/facets/core/hash/self/test_zipnew.rb +1 -1
- data/test/lib/facets/core/hash/test_alias.rb +1 -1
- data/test/lib/facets/core/hash/test_assert_has_keys.rb +1 -1
- data/test/lib/facets/core/hash/test_assert_has_only_keys.rb +1 -1
- data/test/lib/facets/core/hash/test_at.rb +1 -1
- data/test/lib/facets/core/hash/test_collate.rb +1 -1
- data/test/lib/facets/core/hash/test_each.rb +1 -1
- data/test/lib/facets/core/hash/test_each_with_index.rb +1 -1
- data/test/lib/facets/core/hash/test_each_with_key.rb +1 -1
- data/test/lib/facets/core/hash/test_graph.rb +1 -1
- data/test/lib/facets/core/hash/test_has_keys.rb +1 -1
- data/test/lib/facets/core/hash/test_has_only_keys.rb +1 -1
- data/test/lib/facets/core/hash/test_inverse.rb +1 -1
- data/test/lib/facets/core/hash/test_keys_to_s.rb +1 -1
- data/test/lib/facets/core/hash/test_keys_to_sym.rb +1 -1
- data/test/lib/facets/core/hash/test_op_fetch.rb +1 -1
- data/test/lib/facets/core/hash/test_op_lshift.rb +1 -1
- data/test/lib/facets/core/hash/test_rand_key.rb +1 -1
- data/test/lib/facets/core/hash/test_rand_pair.rb +1 -1
- data/test/lib/facets/core/hash/test_rand_value.rb +1 -1
- data/test/lib/facets/core/hash/test_replace_each.rb +1 -1
- data/test/lib/facets/core/hash/test_shuffle.rb +1 -1
- data/test/lib/facets/core/hash/test_slice.rb +1 -1
- data/test/lib/facets/core/hash/test_swap.rb +1 -1
- data/test/lib/facets/core/hash/test_swapkey.rb +1 -1
- data/test/lib/facets/core/hash/test_to_h.rb +1 -1
- data/test/lib/facets/core/hash/test_to_ostruct.rb +1 -1
- data/test/lib/facets/core/hash/test_to_ostruct_recurse.rb +1 -1
- data/test/lib/facets/core/hash/test_traverse.rb +1 -1
- data/test/lib/facets/core/hash/test_update_each.rb +1 -1
- data/test/lib/facets/core/hash/test_update_keys.rb +1 -1
- data/test/lib/facets/core/hash/test_update_values.rb +1 -1
- data/test/lib/facets/core/hash/test_weave.rb +1 -1
- data/test/lib/facets/core/integer/test_factorial.rb +1 -1
- data/test/lib/facets/core/integer/test_multiple.rb +1 -1
- data/test/lib/facets/core/integer/test_ordinal.rb +1 -1
- data/test/lib/facets/core/integer/test_times_collect.rb +1 -1
- data/test/lib/facets/core/kernel/test___class__.rb +1 -1
- data/test/lib/facets/core/kernel/test_as.rb +1 -1
- data/test/lib/facets/core/kernel/test_assign_from.rb +1 -1
- data/test/lib/facets/core/kernel/test_assign_with.rb +1 -1
- data/test/lib/facets/core/kernel/test_bool.rb +1 -1
- data/test/lib/facets/core/kernel/test_bug.rb +1 -1
- data/test/lib/facets/core/kernel/test_call_stack.rb +1 -1
- data/test/lib/facets/core/kernel/test_called.rb +1 -1
- data/test/lib/facets/core/kernel/test_constant.rb +1 -1
- data/test/lib/facets/core/kernel/test_copy.rb +1 -1
- data/test/lib/facets/core/kernel/test_deep_copy.rb +1 -1
- data/test/lib/facets/core/kernel/test_demo.rb +1 -1
- data/test/lib/facets/core/kernel/test_fn.rb +1 -1
- data/test/lib/facets/core/kernel/test_generate_method_name.rb +1 -1
- data/test/lib/facets/core/kernel/test_get_by_id.rb +1 -1
- data/test/lib/facets/core/kernel/test_here.rb +1 -1
- data/test/lib/facets/core/kernel/test_in.rb +1 -1
- data/test/lib/facets/core/kernel/test_maybe.rb +1 -1
- data/test/lib/facets/core/kernel/test_metaclass.rb +1 -1
- data/test/lib/facets/core/kernel/test_method.rb +1 -1
- data/test/lib/facets/core/kernel/test_methodname.rb +1 -1
- data/test/lib/facets/core/kernel/test_methods.rb +1 -1
- data/test/lib/facets/core/kernel/test_new.rb +1 -1
- data/test/lib/facets/core/kernel/test_object_class.rb +1 -1
- data/test/lib/facets/core/kernel/test_object_hexid.rb +1 -1
- data/test/lib/facets/core/kernel/test_require_all.rb +1 -1
- data/test/lib/facets/core/kernel/test_require_esc.rb +1 -1
- data/test/lib/facets/core/kernel/test_require_facet.rb +1 -1
- data/test/lib/facets/core/kernel/test_resc.rb +1 -1
- data/test/lib/facets/core/kernel/test_returning.rb +1 -1
- data/test/lib/facets/core/kernel/test_send_as.rb +1 -1
- data/test/lib/facets/core/kernel/test_set_from.rb +1 -1
- data/test/lib/facets/core/kernel/test_set_with.rb +1 -1
- data/test/lib/facets/core/kernel/test_silently.rb +1 -1
- data/test/lib/facets/core/kernel/test_singleton.rb +1 -1
- data/test/lib/facets/core/kernel/test_superior.rb +1 -1
- data/test/lib/facets/core/kernel/test_supermethod.rb +1 -1
- data/test/lib/facets/core/kernel/test_this.rb +1 -1
- data/test/lib/facets/core/kernel/test_to_b.rb +1 -1
- data/test/lib/facets/core/kernel/test_to_bool.rb +1 -1
- data/test/lib/facets/core/kernel/test_uri.rb +1 -1
- data/test/lib/facets/core/kernel/test_val.rb +1 -1
- data/test/lib/facets/core/kernel/test_with_accessor.rb +1 -1
- data/test/lib/facets/core/matchdata/test_match.rb +1 -1
- data/test/lib/facets/core/matchdata/test_matchtree.rb +7 -2
- data/test/lib/facets/core/module/test_abstract.rb +1 -1
- data/test/lib/facets/core/module/test_alias_module_function.rb +1 -1
- data/test/lib/facets/core/module/test_ancestor.rb +1 -1
- data/test/lib/facets/core/module/test_basename.rb +1 -1
- data/test/lib/facets/core/module/test_by_name.rb +1 -1
- data/test/lib/facets/core/module/test_clone_using.rb +1 -1
- data/test/lib/facets/core/module/test_dirname.rb +1 -1
- data/test/lib/facets/core/module/test_equate_on.rb +1 -1
- data/test/lib/facets/core/module/test_generate_instance_method_name.rb +1 -1
- data/test/lib/facets/core/module/test_include_as.rb +1 -1
- data/test/lib/facets/core/module/test_inherit.rb +1 -1
- data/test/lib/facets/core/module/test_initializer.rb +1 -1
- data/test/lib/facets/core/module/test_instance_methods.rb +1 -1
- data/test/lib/facets/core/module/test_integrate.rb +1 -1
- data/test/lib/facets/core/module/test_memoize.rb +1 -1
- data/test/lib/facets/core/module/test_modspace.rb +1 -1
- data/test/lib/facets/core/module/test_namespace.rb +1 -1
- data/test/lib/facets/core/module/test_nesting.rb +1 -1
- data/test/lib/facets/core/module/{test_undef.rb → test_nodef.rb} +5 -5
- data/test/lib/facets/core/module/test_on_included.rb +1 -1
- data/test/lib/facets/core/module/test_redef.rb +1 -1
- data/test/lib/facets/core/module/test_redefine_method.rb +1 -1
- data/test/lib/facets/core/module/test_redirect.rb +1 -1
- data/test/lib/facets/core/module/test_redirect_method.rb +1 -1
- data/test/lib/facets/core/module/test_remove.rb +1 -1
- data/test/lib/facets/core/module/test_rename.rb +1 -1
- data/test/lib/facets/core/module/test_rename_method.rb +1 -1
- data/test/lib/facets/core/module/test_revisal.rb +1 -1
- data/test/lib/facets/core/module/test_shadow_method.rb +1 -1
- data/test/lib/facets/core/module/test_sort_on.rb +1 -1
- data/test/lib/facets/core/module/test_this.rb +1 -1
- data/test/lib/facets/core/module/test_wrap.rb +1 -1
- data/test/lib/facets/core/module/test_wrap_method.rb +1 -1
- data/test/lib/facets/core/nilclass/test_blank.rb +1 -1
- data/test/lib/facets/core/nilclass/test_empty.rb +1 -1
- data/test/lib/facets/core/nilclass/test_include.rb +1 -1
- data/test/lib/facets/core/nilclass/test_op_fetch.rb +1 -1
- data/test/lib/facets/core/nilclass/test_size.rb +1 -1
- data/test/lib/facets/core/nilclass/test_to_h.rb +1 -1
- data/test/lib/facets/core/numeric/test_approx.rb +1 -1
- data/test/lib/facets/core/numeric/test_ceil_multiple.rb +1 -1
- data/test/lib/facets/core/numeric/test_succ.rb +1 -1
- data/test/lib/facets/core/numeric/test_to_b.rb +1 -1
- data/test/lib/facets/core/ostruct/test___merge__.rb +1 -1
- data/test/lib/facets/core/ostruct/test___update__.rb +1 -1
- data/test/lib/facets/core/ostruct/test_op_fetch.rb +1 -1
- data/test/lib/facets/core/ostruct/test_op_store.rb +1 -1
- data/test/lib/facets/core/proc/test_compose.rb +1 -1
- data/test/lib/facets/core/proc/test_to_method.rb +1 -1
- data/test/lib/facets/core/range/test_to_r.rb +1 -1
- data/test/lib/facets/core/range/test_to_range.rb +1 -1
- data/test/lib/facets/core/range/test_umbrella.rb +1 -1
- data/test/lib/facets/core/range/test_within.rb +1 -1
- data/test/lib/facets/core/regexp/test_arity.rb +1 -1
- data/test/lib/facets/core/regexp/test_to_re.rb +1 -1
- data/test/lib/facets/core/regexp/test_to_regexp.rb +1 -1
- data/test/lib/facets/core/string/self/test_interpolate.rb +1 -1
- data/test/lib/facets/core/string/self/test_patterns.rb +1 -1
- data/test/lib/facets/core/string/self/test_rand_letter.rb +1 -1
- data/test/lib/facets/core/string/test_align_center.rb +1 -1
- data/test/lib/facets/core/string/test_at_rand.rb +1 -1
- data/test/lib/facets/core/string/test_basename.rb +1 -1
- data/test/lib/facets/core/string/test_blank.rb +1 -1
- data/test/lib/facets/core/string/test_bracket.rb +1 -1
- data/test/lib/facets/core/string/test_camelcase.rb +1 -1
- data/test/lib/facets/core/string/test_camelize.rb +1 -1
- data/test/lib/facets/core/string/test_capitalized.rb +1 -1
- data/test/lib/facets/core/string/test_chars.rb +1 -1
- data/test/lib/facets/core/string/test_cmp.rb +1 -1
- data/test/lib/facets/core/string/test_demodulize.rb +1 -1
- data/test/lib/facets/core/string/test_downcase.rb +1 -1
- data/test/lib/facets/core/string/test_dresner.rb +1 -1
- data/test/lib/facets/core/string/test_each_char.rb +1 -1
- data/test/lib/facets/core/string/test_each_word.rb +1 -1
- data/test/lib/facets/core/string/test_first.rb +1 -1
- data/test/lib/facets/core/string/test_fold.rb +1 -1
- data/test/lib/facets/core/string/test_frequency.rb +1 -1
- data/test/lib/facets/core/string/test_humanize.rb +1 -1
- data/test/lib/facets/core/string/test_indent.rb +1 -1
- data/test/lib/facets/core/string/test_index_all.rb +1 -1
- data/test/lib/facets/core/string/test_last.rb +1 -1
- data/test/lib/facets/core/string/test_line_wrap.rb +1 -1
- data/test/lib/facets/core/string/test_lines.rb +1 -1
- data/test/lib/facets/core/string/test_lowercase.rb +1 -1
- data/test/lib/facets/core/string/test_margin.rb +1 -1
- data/test/lib/facets/core/string/test_methodize.rb +1 -1
- data/test/lib/facets/core/string/test_modulize.rb +1 -1
- data/test/lib/facets/core/string/test_mscan.rb +1 -1
- data/test/lib/facets/core/string/test_natcmp.rb +1 -1
- data/test/lib/facets/core/string/test_nchar.rb +1 -1
- data/test/lib/facets/core/string/test_pathize.rb +1 -1
- data/test/lib/facets/core/string/test_pop.rb +1 -1
- data/test/lib/facets/core/string/test_pot.rb +1 -1
- data/test/lib/facets/core/string/test_probability.rb +1 -1
- data/test/lib/facets/core/string/test_push.rb +1 -1
- data/test/lib/facets/core/string/test_quote.rb +1 -1
- data/test/lib/facets/core/string/test_rand_byte.rb +1 -1
- data/test/lib/facets/core/string/test_rand_index.rb +1 -1
- data/test/lib/facets/core/string/test_range.rb +1 -1
- data/test/lib/facets/core/string/test_range_all.rb +1 -1
- data/test/lib/facets/core/string/test_range_of_line.rb +1 -1
- data/test/lib/facets/core/string/test_regesc.rb +1 -1
- data/test/lib/facets/core/string/test_shatter.rb +1 -1
- data/test/lib/facets/core/string/test_shift.rb +1 -1
- data/test/lib/facets/core/string/test_shuffle.rb +1 -1
- data/test/lib/facets/core/string/test_similarity.rb +1 -1
- data/test/lib/facets/core/string/test_singular.rb +1 -1
- data/test/lib/facets/core/string/test_soundex.rb +1 -1
- data/test/lib/facets/core/string/test_succ.rb +1 -1
- data/test/lib/facets/core/string/test_to_a.rb +1 -1
- data/test/lib/facets/core/string/test_to_b.rb +1 -1
- data/test/lib/facets/core/string/test_to_const.rb +1 -1
- data/test/lib/facets/core/string/test_to_date.rb +1 -1
- data/test/lib/facets/core/string/test_to_proc.rb +1 -1
- data/test/lib/facets/core/string/test_to_re.rb +1 -1
- data/test/lib/facets/core/string/test_to_time.rb +1 -1
- data/test/lib/facets/core/string/test_unix_crypt.rb +1 -1
- data/test/lib/facets/core/string/test_unpack.rb +1 -1
- data/test/lib/facets/core/string/test_unshift.rb +1 -1
- data/test/lib/facets/core/string/test_upcase.rb +1 -1
- data/test/lib/facets/core/string/test_whitespace.rb +1 -1
- data/test/lib/facets/core/string/test_word_filter.rb +1 -1
- data/test/lib/facets/core/string/test_word_wrap.rb +1 -1
- data/test/lib/facets/core/string/test_words.rb +1 -1
- data/test/lib/facets/core/symbol/test_camelcase.rb +1 -1
- data/test/lib/facets/core/symbol/test_camelize.rb +1 -1
- data/test/lib/facets/core/symbol/test_capitalize.rb +1 -1
- data/test/lib/facets/core/symbol/test_capitalized.rb +1 -1
- data/test/lib/facets/core/symbol/test_downcase.rb +1 -1
- data/test/lib/facets/core/symbol/test_not.rb +1 -1
- data/test/lib/facets/core/symbol/test_pad.rb +1 -1
- data/test/lib/facets/core/symbol/test_succ.rb +1 -1
- data/test/lib/facets/core/symbol/test_to_const.rb +1 -1
- data/test/lib/facets/core/symbol/test_to_proc.rb +1 -1
- data/test/lib/facets/core/symbol/test_to_str.rb +1 -1
- data/test/lib/facets/core/symbol/test_underscore.rb +1 -1
- data/test/lib/facets/core/symbol/test_upcase.rb +1 -1
- data/test/lib/facets/core/time/test_change.rb +1 -1
- data/test/lib/facets/core/time/test_elapse.rb +1 -1
- data/test/lib/facets/core/time/test_stamp.rb +1 -1
- data/test/lib/facets/core/time/test_to_date.rb +1 -1
- data/test/lib/facets/core/time/test_to_s.rb +1 -1
- data/test/lib/facets/core/time/test_to_time.rb +1 -1
- data/test/lib/facets/more/test_annattr.rb +39 -0
- data/test/lib/facets/more/test_annotatedattr.rb +39 -0
- data/test/lib/facets/more/test_annotation.rb +1 -22
- data/test/lib/facets/more/test_ansicode.rb +1 -1
- data/test/lib/facets/more/test_association.rb +6 -1
- data/test/lib/facets/more/test_basicobject.rb +1 -1
- data/test/lib/facets/more/test_bbcode.rb +1 -1
- data/test/lib/facets/more/test_binaryreader.rb +64 -0
- data/test/lib/facets/more/test_bitmask.rb +1 -1
- data/test/lib/facets/more/test_bytes.rb +1 -1
- data/test/lib/facets/more/test_classinherit.rb +1 -1
- data/test/lib/facets/more/test_classmethods.rb +1 -1
- data/test/lib/facets/more/test_coroutine.rb +1 -1
- data/test/lib/facets/more/test_crypt.rb +1 -1
- data/test/lib/facets/more/test_dictionary.rb +1 -1
- data/test/lib/facets/more/test_elementor.rb +1 -1
- data/test/lib/facets/more/test_enumerablepass.rb +1 -1
- data/test/lib/facets/more/test_floatstring.rb +1 -1
- data/test/lib/facets/more/test_functor.rb +1 -1
- data/test/lib/facets/more/test_htmlbuilder.rb +1 -1
- data/test/lib/facets/more/test_inheritor.rb +1 -1
- data/test/lib/facets/more/test_interval.rb +1 -1
- data/test/lib/facets/more/test_json.rb +1 -1
- data/test/lib/facets/more/test_lisp.rb +1 -1
- data/test/lib/facets/more/test_lisp_format.rb +1 -1
- data/test/lib/facets/more/test_lrucache.rb +1 -1
- data/test/lib/facets/more/test_mathconstants.rb +1 -1
- data/test/lib/facets/more/test_methodprobe.rb +1 -1
- data/test/lib/facets/more/test_multipliers.rb +1 -1
- data/test/lib/facets/more/test_multiton.rb +1 -1
- data/test/lib/facets/more/test_nackclass.rb +1 -1
- data/test/lib/facets/more/test_nilcomparable.rb +1 -1
- data/test/lib/facets/more/test_opencascade.rb +66 -0
- data/test/lib/facets/more/test_openobject.rb +14 -2
- data/test/lib/facets/more/test_overload.rb +1 -1
- data/test/lib/facets/more/test_paramix.rb +1 -1
- data/test/lib/facets/more/test_pqueue.rb +39 -0
- data/test/lib/facets/more/test_preinitialize.rb +1 -1
- data/test/lib/facets/more/test_promoteself.rb +1 -1
- data/test/lib/facets/more/test_recorder.rb +1 -1
- data/test/lib/facets/more/test_snapshot.rb +1 -1
- data/test/lib/facets/more/test_statichash.rb +11 -11
- data/test/lib/facets/more/test_syncarray.rb +1 -1
- data/test/lib/facets/more/test_synchash.rb +1 -1
- data/test/lib/facets/more/test_tagiterator.rb +1 -1
- data/test/lib/facets/more/test_taskable.rb +151 -0
- data/test/lib/facets/more/test_timer.rb +1 -1
- data/test/lib/facets/more/test_times.rb +1 -1
- data/test/lib/facets/more/test_tuple.rb +1 -1
- data/test/lib/facets/more/test_typecast.rb +1 -1
- data/test/lib/facets/more/test_uninheritable.rb +1 -1
- data/test/lib/facets/more/test_units.rb +1 -1
- data/test/lib/facets/more/test_xmlbuilder.rb +1 -1
- data/test/lib/facets/more/test_xmlhelper.rb +1 -1
- data/test/lib/facets/more/test_xoxo.rb +1 -1
- data/test/lib/facets/more/test_yamlstruct.rb +1 -1
- metadata +1243 -1247
- data/ProjectInfo +0 -89
- data/Rakefile +0 -181
- data/doc/CHANGELOG +0 -284
- data/doc/TODO +0 -73
- data/doc/noauto +0 -63
- data/lib/facet/array.rb +0 -1
- data/lib/facet/class.rb +0 -1
- data/lib/facet/comparable.rb +0 -1
- data/lib/facet/continuation.rb +0 -1
- data/lib/facet/date.rb +0 -1
- data/lib/facet/dir.rb +0 -1
- data/lib/facet/enumerable.rb +0 -1
- data/lib/facet/file.rb +0 -1
- data/lib/facet/fileutils.rb +0 -1
- data/lib/facet/float.rb +0 -1
- data/lib/facet/gem.rb +0 -1
- data/lib/facet/hash.rb +0 -1
- data/lib/facet/integer.rb +0 -1
- data/lib/facet/kernel.rb +0 -1
- data/lib/facet/logger.rb +0 -1
- data/lib/facet/matchdata.rb +0 -1
- data/lib/facet/module.rb +0 -1
- data/lib/facet/module/undef.rb +0 -1
- data/lib/facet/nilclass.rb +0 -1
- data/lib/facet/numeric.rb +0 -1
- data/lib/facet/pathname.rb +0 -1
- data/lib/facet/proc.rb +0 -1
- data/lib/facet/range.rb +0 -1
- data/lib/facet/regexp.rb +0 -1
- data/lib/facet/string.rb +0 -1
- data/lib/facet/symbol.rb +0 -1
- data/lib/facet/time.rb +0 -1
- data/lib/facet/unboundmethod.rb +0 -1
- data/lib/facets/core/array.rb +0 -35
- data/lib/facets/core/class.rb +0 -11
- data/lib/facets/core/comparable.rb +0 -5
- data/lib/facets/core/continuation.rb +0 -1
- data/lib/facets/core/date.rb +0 -6
- data/lib/facets/core/dir.rb +0 -4
- data/lib/facets/core/enumerable.rb +0 -42
- data/lib/facets/core/file.rb +0 -8
- data/lib/facets/core/fileutils.rb +0 -8
- data/lib/facets/core/float.rb +0 -4
- data/lib/facets/core/gem.rb +0 -4
- data/lib/facets/core/hash.rb +0 -40
- data/lib/facets/core/integer.rb +0 -9
- data/lib/facets/core/kernel.rb +0 -69
- data/lib/facets/core/logger.rb +0 -2
- data/lib/facets/core/matchdata.rb +0 -3
- data/lib/facets/core/module.rb +0 -43
- data/lib/facets/core/nilclass.rb +0 -9
- data/lib/facets/core/numeric.rb +0 -6
- data/lib/facets/core/pathname.rb +0 -2
- data/lib/facets/core/proc.rb +0 -3
- data/lib/facets/core/range.rb +0 -4
- data/lib/facets/core/regexp.rb +0 -3
- data/lib/facets/core/string.rb +0 -91
- data/lib/facets/core/symbol.rb +0 -13
- data/lib/facets/core/time.rb +0 -8
- data/lib/facets/core/unboundmethod.rb +0 -1
data/lib/facets/more/lisp.rb
CHANGED
@@ -1,31 +1,33 @@
|
|
1
|
-
|
2
|
-
# Lisp Mixin
|
1
|
+
# = lisp.rb
|
3
2
|
#
|
4
|
-
# Copyright (C) 2003
|
3
|
+
# == Copyright (C) 2003 Florian Frank
|
5
4
|
#
|
6
|
-
#
|
5
|
+
# Ruby License
|
7
6
|
#
|
8
|
-
#
|
9
|
-
#
|
7
|
+
# This module is free software. You may use, modify, and/or redistribute this
|
8
|
+
# software under the same terms as Ruby.
|
10
9
|
#
|
11
|
-
#
|
12
|
-
#
|
13
|
-
#
|
10
|
+
# This program is distributed in the hope that it will be useful, but WITHOUT
|
11
|
+
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
12
|
+
# FOR A PARTICULAR PURPOSE.
|
14
13
|
#
|
14
|
+
# == Author(s)
|
15
|
+
#
|
16
|
+
# * Florian Frank
|
15
17
|
#
|
16
|
-
#
|
17
|
-
#
|
18
|
-
#
|
19
|
-
#
|
20
|
-
#
|
21
|
-
#
|
22
|
-
#
|
23
|
-
|
24
|
-
#
|
25
|
-
#
|
26
|
-
|
27
|
-
|
28
|
-
|
18
|
+
# == Developers Notes
|
19
|
+
#
|
20
|
+
# TODO Changed the name of Pair class to DottedPair (good change?)
|
21
|
+
# and then added a new method #pair! which converts an array
|
22
|
+
# to a DottedPair. This is then used in #car and
|
23
|
+
# #cdr to automatically convert arrays passed to 'em.
|
24
|
+
# There may be other places that #pair! conversion is needed.
|
25
|
+
|
26
|
+
# Author:: Florian Frank
|
27
|
+
# Copyright:: Copyright (c) 2003 Florian Frank
|
28
|
+
# License:: Ruby License
|
29
|
+
|
30
|
+
# = Lisp Mixin
|
29
31
|
#
|
30
32
|
# This module provides Lisp-like functional notation.
|
31
33
|
# With this module it almost possible to write real
|
@@ -44,11 +46,6 @@
|
|
44
46
|
# end)
|
45
47
|
#
|
46
48
|
# A real programmer can write LISP in any language ;)
|
47
|
-
#
|
48
|
-
# == Author(s)
|
49
|
-
#
|
50
|
-
# * Florian Frank
|
51
|
-
#
|
52
49
|
|
53
50
|
module Lisp
|
54
51
|
|
@@ -1,79 +1,92 @@
|
|
1
|
-
|
2
|
-
#--
|
3
|
-
# Lisp Format
|
4
|
-
# v 0.3
|
1
|
+
# = lisp_format.rb
|
5
2
|
#
|
6
|
-
# Copyright (C) 2003 Nikolai Weibull
|
3
|
+
# == Copyright (C) 2003 Nikolai Weibull
|
7
4
|
#
|
8
|
-
#
|
9
|
-
# modify it under the terms of the GNU Lesser General Public
|
10
|
-
# License as published by the Free Software Foundation; either
|
11
|
-
# version 2.1 of the License, or (at your option) any later version.
|
5
|
+
# GNU Lesser General Public License (LGPL)
|
12
6
|
#
|
13
|
-
#
|
14
|
-
#
|
15
|
-
#
|
16
|
-
#
|
7
|
+
# This library is free software; you can redistribute it and/or
|
8
|
+
# modify it under the terms of the GNU Lesser General Public
|
9
|
+
# License as published by the Free Software Foundation; either
|
10
|
+
# version 2.1 of the License, or (at your option) any later version.
|
17
11
|
#
|
18
|
-
#
|
19
|
-
#
|
20
|
-
#
|
12
|
+
# This library is distributed in the hope that it will be useful,
|
13
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
15
|
+
# Lesser General Public License for more details.
|
21
16
|
#
|
22
|
-
#
|
23
|
-
#
|
24
|
-
#
|
25
|
-
# 2004-11-16 0.3 TO * Ported en-masse as a "sub-space" of Lisp.
|
26
|
-
# 2003-12-08 0.2 NW * Releasing version 0.2.
|
27
|
-
# ==========================================================================
|
28
|
-
# To Do ::
|
29
|
-
# * the floating point functions are rather horendous
|
30
|
-
# ==========================================================================
|
31
|
-
#++
|
32
|
-
|
33
|
-
# = Description
|
17
|
+
# You should have received a copy of the GNU Lesser General Public
|
18
|
+
# License along with this library; if not, write to the Free Software
|
19
|
+
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
34
20
|
#
|
35
|
-
#
|
36
|
-
# Lisp features for use in Ruby. Currently the only sub-module that exists is
|
37
|
-
# Lisp::Format, which implements Lisp's (format) function and its formatting
|
38
|
-
# language. For people not familiar with this language, it is a very expressive
|
39
|
-
# string formatting language, much like sprintf()'s, but much more powerful. It
|
40
|
-
# allows for iteration, case conversion, conditionals, and much more. If you
|
41
|
-
# have ever felt stupid while creating a string iteratively, to print an array or
|
42
|
-
# some such, this is definitely for you!
|
21
|
+
# == Developer Notes
|
43
22
|
#
|
44
|
-
#
|
45
|
-
# Lisp's rich string formatting language is implemented in the Format module.
|
46
|
-
# More modules may be added later.
|
23
|
+
# TODO The floating point functions are rather horendous.
|
47
24
|
#
|
48
|
-
#
|
25
|
+
# TODO More modules may be added later.
|
49
26
|
#
|
50
27
|
# == Author(s)
|
51
28
|
#
|
52
|
-
# * Nikolai Weibull
|
29
|
+
# * Nikolai Weibull
|
53
30
|
#
|
54
|
-
# ==
|
31
|
+
# == Additional Information
|
55
32
|
#
|
56
33
|
# The project website for ruby-lisp is currently located at
|
57
34
|
# http://ned.rubyforge.org/.
|
58
|
-
#
|
59
35
|
|
60
|
-
|
61
|
-
#
|
62
|
-
#
|
63
|
-
|
64
|
-
#
|
65
|
-
# TODO: the floating point functions are rather horendous.
|
66
|
-
#++
|
36
|
+
# Author:: Nikolai Weibull
|
37
|
+
# Copyright:: Copyright (c) 2003 Nikolai Weibull <source@pcppopper.org>
|
38
|
+
# License:: General Public License (GPL)
|
39
|
+
|
40
|
+
# Lisp namespace.
|
67
41
|
|
68
42
|
module Lisp
|
69
43
|
|
44
|
+
# Apply lisp format.
|
45
|
+
|
46
|
+
def self.format(format, *args)
|
47
|
+
begin
|
48
|
+
state = Format::State.new(args, Format::Output.new)
|
49
|
+
formatter = Format::Formatter.new(format, state)
|
50
|
+
formatter.run
|
51
|
+
rescue => e
|
52
|
+
puts 'Format error: ' + e.message
|
53
|
+
puts format
|
54
|
+
puts ' ' * (e.pos - 1) + '^' if e.respond_to? :pos
|
55
|
+
raise
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
# See Lisp::format.
|
60
|
+
|
61
|
+
def format(format, *args)
|
62
|
+
Lisp.format(format, *args)
|
63
|
+
end
|
64
|
+
|
65
|
+
# = Lisp::Format
|
66
|
+
#
|
67
|
+
# "So what is *ruby-lisp*?", you ask. Well, it is a module for implementing nice
|
68
|
+
# Lisp features for use in Ruby. Currently the only sub-module that exists is
|
69
|
+
# Lisp::Format, which implements Lisp's (format) function and its formatting
|
70
|
+
# language. For people not familiar with this language, it is a very expressive
|
71
|
+
# string formatting language, much like sprintf()'s, but much more powerful. It
|
72
|
+
# allows for iteration, case conversion, conditionals, and much more. If you
|
73
|
+
# have ever felt stupid while creating a string iteratively, to print an array or
|
74
|
+
# some such, this is definitely for you!
|
75
|
+
#
|
76
|
+
# This module contains various Lisp facilities that are of general usefulness.
|
77
|
+
# Lisp's rich string formatting language is implemented in the Format module.
|
78
|
+
# More modules may be added later.
|
79
|
+
#
|
80
|
+
# This has been (very simply) integrated into the namespace of Lisp from lisp.rb.
|
81
|
+
#
|
70
82
|
# This module implements the Common Lisp (format) function and it's language.
|
83
|
+
|
71
84
|
module Format
|
72
85
|
|
73
86
|
# An error, positioned somewhere in the input format. This is used to be
|
74
87
|
# able to show the user exactly where something failed in the input format
|
75
88
|
# string.
|
76
|
-
module Positioned
|
89
|
+
module Positioned #:nodoc:
|
77
90
|
# Create at a given position.
|
78
91
|
def initialize(pos = -1)
|
79
92
|
@pos = pos
|
@@ -83,32 +96,44 @@ module Lisp
|
|
83
96
|
attr :pos, true
|
84
97
|
end
|
85
98
|
|
86
|
-
# An argument was of the wrong type, or there aren't enough arguments.
|
87
|
-
class ArgumentError < ArgumentError
|
99
|
+
# An argument was of the wrong type, or there aren't enough arguments.
|
100
|
+
class ArgumentError < ArgumentError #:nodoc:
|
101
|
+
include Positioned
|
102
|
+
end
|
88
103
|
|
89
104
|
# An index was not valid. Used for argument jumping errors.
|
90
|
-
class IndexError < IndexError
|
105
|
+
class IndexError < IndexError #:nodoc:
|
106
|
+
include Positioned
|
107
|
+
end
|
91
108
|
|
92
109
|
# A parameter was wrong in some sense.
|
93
|
-
class ParameterError < ArgumentError
|
110
|
+
class ParameterError < ArgumentError #:nodoc:
|
111
|
+
include Positioned
|
112
|
+
end
|
94
113
|
|
95
114
|
# The format string contained a syntax error.
|
96
|
-
class SyntaxError < SyntaxError
|
115
|
+
class SyntaxError < SyntaxError #:nodoc:
|
116
|
+
include Positioned
|
117
|
+
end
|
97
118
|
|
98
119
|
# The format string was ended before a parameter could be read.
|
99
|
-
class MissingParameterError < SyntaxError
|
120
|
+
class MissingParameterError < SyntaxError #:nodoc:
|
121
|
+
end
|
100
122
|
|
101
123
|
# The format string was ended before a parameter could be completed.
|
102
|
-
class IncompleteParameterError < SyntaxError
|
124
|
+
class IncompleteParameterError < SyntaxError #:nodoc:
|
125
|
+
end
|
103
126
|
|
104
127
|
# The format string was malformed somehow.
|
105
|
-
class MalformedError < SyntaxError
|
128
|
+
class MalformedError < SyntaxError #:nodoc:
|
129
|
+
end
|
106
130
|
|
107
131
|
# A modifier was wrongly given, or there were too many of the same.
|
108
|
-
class ModifierError < SyntaxError
|
132
|
+
class ModifierError < SyntaxError #:nodoc:
|
133
|
+
end
|
109
134
|
|
110
135
|
# Represents output for a State object.
|
111
|
-
class Output
|
136
|
+
class Output #:nodoc:
|
112
137
|
# Create a new Output object.
|
113
138
|
def initialize(str = '', col = 0)
|
114
139
|
@output, @col = str, col
|
@@ -141,7 +166,7 @@ module Lisp
|
|
141
166
|
|
142
167
|
# This class represents the state of a given Formatter. It keeps track of
|
143
168
|
# output gathered and arguments left to be processed.
|
144
|
-
class State
|
169
|
+
class State #:nodoc:
|
145
170
|
# Create a state from arguments and a destination output
|
146
171
|
def initialize(args, output)
|
147
172
|
@args = args
|
@@ -212,12 +237,12 @@ module Lisp
|
|
212
237
|
end
|
213
238
|
|
214
239
|
# Given a format string, this class lexes it and returns directives it
|
215
|
-
# finds.
|
240
|
+
# finds. This includes gathering parameters and modifiers for the coming
|
216
241
|
# directives. The necessary information to create a directive is gathered
|
217
242
|
# and then passed to Directives::Factory#build. Error checking
|
218
243
|
# is performed, so that incomplete parameters are caught and malformed
|
219
244
|
# modifiers are supressed.
|
220
|
-
class Lexer
|
245
|
+
class Lexer #:nodoc:
|
221
246
|
@@errorstates = {
|
222
247
|
:START => [MissingParameterError,
|
223
248
|
'format string ended before parameter was found'],
|
@@ -374,7 +399,7 @@ module Lisp
|
|
374
399
|
# directives/tokens are added to the current stack level. When a directive
|
375
400
|
# removes a level of nesting the previous level's last directive gets
|
376
401
|
# connected, using Directive#connect.
|
377
|
-
class Parser
|
402
|
+
class Parser #:nodoc:
|
378
403
|
# Create a Parser, given a Lexer, +lexer+.
|
379
404
|
def initialize(lexer)
|
380
405
|
@lexer = lexer
|
@@ -410,7 +435,7 @@ module Lisp
|
|
410
435
|
# Engine for the format Lexer and Parser. Given an input format string and
|
411
436
|
# an initial State, it lets the Parser create the directives and then
|
412
437
|
# simply iterates over them, Directive#execute:ing them each.
|
413
|
-
class Formatter
|
438
|
+
class Formatter #:nodoc:
|
414
439
|
# Create a Formatter from a String +format+ and a State +state+.
|
415
440
|
def initialize(format, state)
|
416
441
|
@parser, @state = Parser.new(Lexer.new(format)), state
|
@@ -425,7 +450,7 @@ module Lisp
|
|
425
450
|
|
426
451
|
# This module includes format parameter representation classes. These are
|
427
452
|
# passed to directives when they are created.
|
428
|
-
module Parameters
|
453
|
+
module Parameters #:nodoc: all
|
429
454
|
# Base class from which the sub-classes get their behavior. Every
|
430
455
|
# parameter should sub-class from this class.
|
431
456
|
class Parameter
|
@@ -494,7 +519,7 @@ module Lisp
|
|
494
519
|
# the Lisp formatting embedded language. The base class for all directives
|
495
520
|
# is aptly named Directive, and all directive classes should sub-class from
|
496
521
|
# it.
|
497
|
-
module Directives
|
522
|
+
module Directives #:nodoc: all
|
498
523
|
# An unknown directive was found in the format string.
|
499
524
|
class UnknownDirectiveError < SyntaxError; end
|
500
525
|
|
@@ -1789,23 +1814,6 @@ module Lisp
|
|
1789
1814
|
|
1790
1815
|
end #module Format
|
1791
1816
|
|
1792
|
-
def Lisp.format(format, *args)
|
1793
|
-
begin
|
1794
|
-
state = Format::State.new(args, Format::Output.new)
|
1795
|
-
formatter = Format::Formatter.new(format, state)
|
1796
|
-
formatter.run
|
1797
|
-
rescue => e
|
1798
|
-
puts 'Format error: ' + e.message
|
1799
|
-
puts format
|
1800
|
-
puts ' ' * (e.pos - 1) + '^' if e.respond_to? :pos
|
1801
|
-
raise
|
1802
|
-
end
|
1803
|
-
end
|
1804
|
-
|
1805
|
-
def format(format, *args)
|
1806
|
-
Lisp.format(format, *args)
|
1807
|
-
end
|
1808
|
-
|
1809
1817
|
end #module Lisp
|
1810
1818
|
|
1811
1819
|
|
data/lib/facets/more/lrucache.rb
CHANGED
@@ -1,25 +1,25 @@
|
|
1
|
-
|
2
|
-
# LRUCache
|
1
|
+
# = lrucache.rb
|
3
2
|
#
|
4
|
-
# Copyright (c) 2004
|
3
|
+
# == Copyright (c) 2004 Navel
|
5
4
|
#
|
6
|
-
#
|
5
|
+
# Ruby License
|
7
6
|
#
|
8
|
-
#
|
9
|
-
#
|
7
|
+
# This module is free software. You may use, modify, and/or redistribute this
|
8
|
+
# software under the same terms as Ruby.
|
10
9
|
#
|
11
|
-
#
|
12
|
-
#
|
13
|
-
#
|
10
|
+
# This program is distributed in the hope that it will be useful, but WITHOUT
|
11
|
+
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
12
|
+
# FOR A PARTICULAR PURPOSE.
|
14
13
|
#
|
15
|
-
#
|
16
|
-
#
|
17
|
-
#
|
18
|
-
|
19
|
-
#
|
20
|
-
|
21
|
-
|
22
|
-
|
14
|
+
# == Author(s)
|
15
|
+
#
|
16
|
+
# * George Moschovitis
|
17
|
+
|
18
|
+
# Author:: George Moschovitis, Anastasios Koutoumanos
|
19
|
+
# Copyright:: Copyright (c) 2005 Navel
|
20
|
+
# License:: Ruby License
|
21
|
+
|
22
|
+
# = LRUCache
|
23
23
|
#
|
24
24
|
# A cache utilizing a simple LRU (Least Recently Used) policy.
|
25
25
|
# The items managed by this cache must respond to the #key method.
|
@@ -28,16 +28,6 @@
|
|
28
28
|
# LRU semantics are enforced by inserting the items in a queue.
|
29
29
|
# The lru item is always at the tail. Two special sentinels
|
30
30
|
# (head, tail) are used to simplify (?) the code.
|
31
|
-
#
|
32
|
-
# == Usage
|
33
|
-
#
|
34
|
-
# TODO: If you have an example of using this, please submit. -T
|
35
|
-
#
|
36
|
-
# == Author(s)
|
37
|
-
#
|
38
|
-
# * George Moschovitis <gm@navel.gr>
|
39
|
-
# * Anastasios Koutoumanos <ak@navel.gr>
|
40
|
-
#
|
41
31
|
|
42
32
|
class LRUCache < Hash
|
43
33
|
|
@@ -1,44 +1,33 @@
|
|
1
|
-
|
2
|
-
# Math Constants
|
1
|
+
# = mathconstants.rb
|
3
2
|
#
|
4
|
-
# Copyright (C)
|
5
|
-
# Copyright (C) 2003 Daniel Carrera
|
3
|
+
# == Copyright (C) 2003 Daniel Carrera, Brian Gough
|
6
4
|
#
|
7
|
-
#
|
5
|
+
# GNU General Public License
|
8
6
|
#
|
9
|
-
#
|
10
|
-
#
|
11
|
-
#
|
12
|
-
#
|
7
|
+
# This program is free software; you can redistribute it and/or modify
|
8
|
+
# it under the terms of the GNU General Public License as published by
|
9
|
+
# the Free Software Foundation; either version 2 of the License, or (at
|
10
|
+
# your option) any later version.
|
13
11
|
#
|
14
|
-
#
|
15
|
-
#
|
16
|
-
#
|
17
|
-
#
|
12
|
+
# This program is distributed in the hope that it will be useful, but
|
13
|
+
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
14
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
15
|
+
# General Public License for more details.
|
18
16
|
#
|
19
|
-
#
|
20
|
-
#
|
21
|
-
#
|
17
|
+
# You should have received a copy of the GNU General Public License
|
18
|
+
# along with this program; if not, write to the Free Software
|
19
|
+
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
22
20
|
#
|
23
|
-
#
|
24
|
-
# Revision History
|
25
|
-
# --------------------------------------------------------------------------
|
26
|
-
# 2004.12.01 Trans
|
27
|
-
# - Ported to Ruby Calibre.
|
28
|
-
#
|
29
|
-
# 2003.01.01 Daniel
|
30
|
-
# - Made the installation script a bit nicer.
|
31
|
-
# - Reorganized the documentation.
|
32
|
-
# - Added a few aliases (e.g. ATOMIC_MASS == UNIFIED_ATOMIC_MASS)
|
33
|
-
# - Changed a few constant names.
|
21
|
+
# == Author(s)
|
34
22
|
#
|
35
|
-
#
|
36
|
-
#
|
37
|
-
|
38
|
-
#
|
39
|
-
|
23
|
+
# * Daniel Carrera
|
24
|
+
# * Brian Gough
|
25
|
+
|
26
|
+
# Author:: Daniel Carrera, Brian Gough
|
27
|
+
# Copyright:: Copyright (c) 2003 Daniel Carrera, Brian Gough
|
28
|
+
# License:: GNU General Public License (GPL)
|
40
29
|
|
41
|
-
|
30
|
+
# = Math Constants
|
42
31
|
#
|
43
32
|
# Large assortment of real world contants. The constants are stored in
|
44
33
|
# the Math::Constants module, but this is included in Math for direct
|
@@ -47,18 +36,11 @@
|
|
47
36
|
#
|
48
37
|
# == Synopsis
|
49
38
|
#
|
50
|
-
# require 'facet/mathconstants'
|
51
|
-
#
|
52
39
|
# Math::SPEED_OF_LIGHT #=> 2.99792458e8
|
53
40
|
# Math::CGS::SPEED_OF_LIGHT #=> 2.99792458e10
|
54
41
|
# Math::Constants::SPEED_OF_LIGHT #=> 2.99792458e8
|
55
42
|
# Math::Constants::CGS::SPEED_OF_LIGHT #=> 2.99792458e10
|
56
43
|
#
|
57
|
-
# == Author(s)
|
58
|
-
#
|
59
|
-
# * Brian Gough
|
60
|
-
# * Daniel Carrera
|
61
|
-
#
|
62
44
|
|
63
45
|
module Math
|
64
46
|
|