facets 1.3.3 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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
|
@@ -1,40 +1,27 @@
|
|
|
1
|
-
|
|
2
|
-
# StateParser
|
|
1
|
+
# = stateparser.rb
|
|
3
2
|
#
|
|
4
|
-
# Copyright (c) 2005 Thomas Sawyer
|
|
3
|
+
# == Copyright (c) 2005 Thomas Sawyer
|
|
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
|
-
# Revision History
|
|
17
|
-
# ==========================================================================
|
|
18
|
-
#
|
|
19
|
-
# 5.6.05 v3.0 trans
|
|
20
|
-
# * Third major rewrite. This improves the system substantially.
|
|
21
|
-
#
|
|
22
|
-
# 5.2.06 v2.0 trans
|
|
23
|
-
# - Removed raw tokens. Raw text is now available to every regular
|
|
24
|
-
# token, so the end application can decided how to treat it.
|
|
25
|
-
#
|
|
26
|
-
# 5.1.27 v1.0 trans
|
|
27
|
-
# - Removed priority. Order of tokens when parser is initialized
|
|
28
|
-
# now determines precedence.
|
|
29
|
-
# - If first argument to Parser.new is not a kind of AbstractToken
|
|
30
|
-
# it is assumed to be the reentrant parser, otherwise the parser
|
|
31
|
-
# itself is considered the reentrant parser. Having this allows raw
|
|
32
|
-
# tokens to parse embedded content (among other things).
|
|
14
|
+
# == Author(s)
|
|
33
15
|
#
|
|
34
|
-
#
|
|
35
|
-
|
|
16
|
+
# * Thomas Sawyer
|
|
17
|
+
|
|
18
|
+
# Author:: Thomas Sawyer
|
|
19
|
+
# Copyright:: Copyright (c) 2005 Thomas Sawyer
|
|
20
|
+
# License:: Ruby License
|
|
36
21
|
|
|
37
|
-
|
|
22
|
+
require 'ostruct'
|
|
23
|
+
|
|
24
|
+
# = StateParser
|
|
38
25
|
#
|
|
39
26
|
# Gerenal purpose stack-based parser. Define custom tokens
|
|
40
27
|
# and the parser will build a parse tree from them.
|
|
@@ -111,12 +98,16 @@
|
|
|
111
98
|
# [Note: There are a few other subtilties to go over that I haven't yet
|
|
112
99
|
# documented, primarily related to creating more elaborate custom tokens. TODO!]
|
|
113
100
|
#
|
|
114
|
-
#
|
|
101
|
+
# Removed raw tokens. Raw text is now available to every regular
|
|
102
|
+
# token, so the end application can decided how to treat it.
|
|
115
103
|
#
|
|
116
|
-
#
|
|
104
|
+
# Removed priority. Order of tokens when parser is initialized
|
|
105
|
+
# now determines precedence.
|
|
117
106
|
#
|
|
118
|
-
|
|
119
|
-
|
|
107
|
+
# If first argument to Parser.new is not a kind of AbstractToken
|
|
108
|
+
# it is assumed to be the reentrant parser, otherwise the parser
|
|
109
|
+
# itself is considered the reentrant parser. Having this allows raw
|
|
110
|
+
# tokens to parse embedded content (among other things).
|
|
120
111
|
|
|
121
112
|
class StateParser ; end
|
|
122
113
|
|
|
@@ -127,7 +118,6 @@ module StateParser::Constants
|
|
|
127
118
|
ENDCALLBACK = "end_callback"
|
|
128
119
|
end
|
|
129
120
|
|
|
130
|
-
|
|
131
121
|
# StateMachine Class
|
|
132
122
|
|
|
133
123
|
class StateMachine
|
|
@@ -1,29 +1,41 @@
|
|
|
1
|
-
|
|
2
|
-
# StaticHash
|
|
1
|
+
# = statichash
|
|
3
2
|
#
|
|
4
|
-
# Copyright (c) 2005 Thomas Sawyer
|
|
3
|
+
# == Copyright (c) 2005 Thomas Sawyer, Gavin Kistner
|
|
5
4
|
#
|
|
6
|
-
#
|
|
7
|
-
# Copyright (c) 2004 Gavin Kistner
|
|
5
|
+
# Ruby License
|
|
8
6
|
#
|
|
9
|
-
#
|
|
7
|
+
# This module is free software. You may use, modify, and/or redistribute this
|
|
8
|
+
# software under the same terms as Ruby.
|
|
9
|
+
#
|
|
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.
|
|
13
|
+
#
|
|
14
|
+
# == SPECIAL THANKS
|
|
15
|
+
#
|
|
16
|
+
# Special thanks go to Gavin Kistner.
|
|
17
|
+
#
|
|
18
|
+
# StaticHash is based on WriteOnceHash in basiclibrary.rb,
|
|
19
|
+
# Copyright (c) 2004 by Gavin Kistner.
|
|
10
20
|
#
|
|
11
21
|
# It is covered under the license viewable at
|
|
22
|
+
#
|
|
12
23
|
# http://phrogz.net/JS/_ReuseLicense.txt
|
|
24
|
+
#
|
|
13
25
|
# Reuse or modification is free provided you abide by the terms of that
|
|
14
|
-
# license. (Including the first two lines above in your source code
|
|
26
|
+
# license. (Including the first two lines above in your source code
|
|
15
27
|
# usually satisfies the conditions.)
|
|
16
28
|
#
|
|
17
|
-
#
|
|
18
|
-
# Revision History
|
|
19
|
-
# ==========================================================================
|
|
20
|
-
#
|
|
21
|
-
# 2004-06-01 Trans * Ported to Calibre
|
|
29
|
+
# == Author(s)
|
|
22
30
|
#
|
|
23
|
-
#
|
|
24
|
-
|
|
31
|
+
# * Thomas Sawyer
|
|
32
|
+
# * Gavin Kistner
|
|
33
|
+
|
|
34
|
+
# Author:: Thomas Sawyer, Gavin Kistner
|
|
35
|
+
# Copyright:: Copyright (c) 2005 Thomas Sawyer, Gavin Kistner
|
|
36
|
+
# License:: Ruby License
|
|
25
37
|
|
|
26
|
-
|
|
38
|
+
# = StaticHash
|
|
27
39
|
#
|
|
28
40
|
# A Hash object which raises an error if any
|
|
29
41
|
# previously-defined key attempts to be set again.
|
|
@@ -40,10 +52,6 @@
|
|
|
40
52
|
# Error: StaticHash has value for key 'name' in object:
|
|
41
53
|
# {"name"=>"Tom", "age"=>30} (RuntimeError)
|
|
42
54
|
#
|
|
43
|
-
# == Author(s)
|
|
44
|
-
#
|
|
45
|
-
# * Gavin Kistner
|
|
46
|
-
#
|
|
47
55
|
|
|
48
56
|
class StaticHash < Hash
|
|
49
57
|
|
|
@@ -69,19 +77,19 @@ end
|
|
|
69
77
|
|
|
70
78
|
=begin testing
|
|
71
79
|
|
|
72
|
-
require 'test/unit'
|
|
80
|
+
require 'test/unit'
|
|
73
81
|
|
|
74
|
-
class TC_StaticHash < Test::Unit::TestCase
|
|
82
|
+
class TC_StaticHash < Test::Unit::TestCase
|
|
75
83
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
84
|
+
def setup
|
|
85
|
+
@sh1 = StaticHash.new
|
|
86
|
+
end
|
|
79
87
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
88
|
+
def test_assign
|
|
89
|
+
@sh1["x"] = 1
|
|
90
|
+
assert_raises( ArgumentError ){ @sh1["x"] = 2 }
|
|
91
|
+
end
|
|
84
92
|
|
|
85
|
-
end
|
|
93
|
+
end
|
|
86
94
|
|
|
87
95
|
=end
|
|
@@ -1,39 +1,31 @@
|
|
|
1
|
-
|
|
2
|
-
# SyncArray
|
|
1
|
+
# = syncarray.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
|
-
|
|
14
|
+
# == Author(s)
|
|
15
|
+
#
|
|
16
|
+
# * George Moschovitis
|
|
17
|
+
|
|
18
|
+
# Author:: George Moschovitis <gm@navel.gr>
|
|
19
|
+
# Copyright:: Copyright (c) 2005 Navel
|
|
20
|
+
# License:: Ruby License
|
|
21
|
+
|
|
22
|
+
require 'sync'
|
|
21
23
|
|
|
22
|
-
|
|
24
|
+
# = SyncArray
|
|
23
25
|
#
|
|
24
26
|
# A thread-safe array. We use a sync object instead of a
|
|
25
27
|
# mutex, because it is re-entrant. An exclusive lock is
|
|
26
28
|
# needed when writing, a shared lock IS NEEDED when reading.
|
|
27
|
-
#
|
|
28
|
-
# == Usage
|
|
29
|
-
#
|
|
30
|
-
# TODO
|
|
31
|
-
#
|
|
32
|
-
# == Author(s)
|
|
33
|
-
#
|
|
34
|
-
# * George Moschovitis <gm@navel.gr>
|
|
35
|
-
|
|
36
|
-
require 'sync'
|
|
37
29
|
|
|
38
30
|
class Array
|
|
39
31
|
|
data/lib/facets/more/synchash.rb
CHANGED
|
@@ -1,29 +1,25 @@
|
|
|
1
|
-
|
|
2
|
-
# SyncHash
|
|
3
|
-
#
|
|
4
|
-
# Copyright (c) 2004-2005 Navel, all rights reserved.
|
|
5
|
-
#
|
|
6
|
-
# Ruby License
|
|
1
|
+
# = synchash.rb
|
|
7
2
|
#
|
|
8
|
-
#
|
|
9
|
-
# software under the same terms as Ruby.
|
|
3
|
+
# == Copyright (c) 2004 Navel
|
|
10
4
|
#
|
|
11
|
-
#
|
|
12
|
-
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
|
13
|
-
# FOR A PARTICULAR PURPOSE.
|
|
5
|
+
# Ruby License
|
|
14
6
|
#
|
|
15
|
-
#
|
|
16
|
-
#
|
|
17
|
-
# ==========================================================================
|
|
7
|
+
# This module is free software. You may use, modify, and/or redistribute this
|
|
8
|
+
# software under the same terms as Ruby.
|
|
18
9
|
#
|
|
19
|
-
#
|
|
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.
|
|
20
13
|
#
|
|
21
|
-
#
|
|
14
|
+
# == Author(s)
|
|
22
15
|
#
|
|
23
|
-
#
|
|
24
|
-
#++
|
|
16
|
+
# * George Moschovitis
|
|
25
17
|
|
|
26
|
-
|
|
18
|
+
# Author:: George Moschovitis <gm@navel.gr>
|
|
19
|
+
# Copyright:: Copyright (c) 2005 Navel
|
|
20
|
+
# License:: Ruby License
|
|
21
|
+
|
|
22
|
+
# = SyncHash
|
|
27
23
|
#
|
|
28
24
|
# A thread-safe hash. We use a sync object instead of a mutex,
|
|
29
25
|
# because it is re-entrant. An exclusive lock is needed when
|
|
@@ -41,13 +37,8 @@
|
|
|
41
37
|
#
|
|
42
38
|
# == Usage
|
|
43
39
|
#
|
|
44
|
-
#
|
|
45
|
-
#
|
|
46
|
-
#
|
|
47
|
-
# ==Author(s)
|
|
48
|
-
#
|
|
49
|
-
# * George Moschovitis
|
|
50
|
-
# * Thomas Sawyer
|
|
40
|
+
# hash = SyncHash.new
|
|
41
|
+
# hash = SyncHash.new(Hash.new) # Delegates
|
|
51
42
|
#
|
|
52
43
|
|
|
53
44
|
require 'sync'
|
data/lib/facets/more/system.rb
CHANGED
|
@@ -1,30 +1,38 @@
|
|
|
1
|
-
|
|
2
|
-
# System
|
|
1
|
+
# = system.rb
|
|
3
2
|
#
|
|
4
|
-
# Copyright (c) 2005 Thomas Sawyer
|
|
3
|
+
# == Copyright (c) 2005 Thomas Sawyer, Minero Aoki
|
|
4
|
+
#
|
|
5
|
+
# Ruby License
|
|
6
|
+
#
|
|
7
|
+
# This module is free software. You may use, modify, and/or redistribute this
|
|
8
|
+
# software under the same terms as Ruby.
|
|
9
|
+
#
|
|
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.
|
|
13
|
+
#
|
|
14
|
+
# == Special Thanks
|
|
5
15
|
#
|
|
6
16
|
# Adapted from RubyParams module by Minero Aoki
|
|
7
17
|
# Copyright (c) 1999-2002 Minero Aoki <aamine@loveruby.net>
|
|
8
18
|
#
|
|
9
|
-
#
|
|
10
|
-
#
|
|
11
|
-
#
|
|
12
|
-
#
|
|
13
|
-
|
|
14
|
-
#
|
|
15
|
-
#
|
|
16
|
-
#
|
|
17
|
-
# =============================================================
|
|
18
|
-
#++
|
|
19
|
+
# == Author(s)
|
|
20
|
+
#
|
|
21
|
+
# * Thomas Sawyer
|
|
22
|
+
# * Minero Aoki
|
|
23
|
+
|
|
24
|
+
# Author:: Thomas Sawyer, Minero Aoki
|
|
25
|
+
# Copyright:: Copyright (c) 2005 Thomas Sawyer, Minero Aoki
|
|
26
|
+
# License:: Ruby License
|
|
19
27
|
|
|
20
28
|
require 'rbconfig'
|
|
21
29
|
|
|
22
|
-
#
|
|
30
|
+
# = System
|
|
23
31
|
#
|
|
24
|
-
# The System module provides Platform and Ruby system
|
|
32
|
+
# The System module provides Platform and Ruby system information.
|
|
33
|
+
# The module should also be able to stand in for rbconfig.
|
|
25
34
|
# It is intended for use as a service module although it
|
|
26
|
-
# can be mixed too.
|
|
27
|
-
#
|
|
35
|
+
# can be mixed-in too.
|
|
28
36
|
|
|
29
37
|
module System
|
|
30
38
|
|
|
@@ -1,45 +1,25 @@
|
|
|
1
|
-
|
|
2
|
-
# TagIterator (aka Tagiter)
|
|
1
|
+
# = tagiterator.rb
|
|
3
2
|
#
|
|
4
|
-
# Copyright (c) 2000 Ⴗnyasu <nyasu@osk.3web.ne.jp>
|
|
3
|
+
# == Copyright (c) 2000 Ⴗnyasu <nyasu@osk.3web.ne.jp>
|
|
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
|
-
# Revision History
|
|
17
|
-
# ==========================================================================
|
|
18
|
-
#
|
|
19
|
-
# 04.11.30 trans Added to Calibre and renamed TagIterator.
|
|
20
|
-
#
|
|
21
|
-
# 03.09.18 nyasu Made attribute name case-ignored.
|
|
22
|
-
#
|
|
23
|
-
# 03.06.06 nyasu Added a new method : nth_trailer(tag,n).
|
|
24
|
-
# Fixed regexp of tagnext method.
|
|
25
|
-
#
|
|
26
|
-
# 03.06.05 nyasu Added new methods for information, #tagexist?(tag) and
|
|
27
|
-
# tagnext. Fixed bugs on return values of each_block
|
|
28
|
-
#
|
|
29
|
-
# 03.06.01 nyasu Fixed nth method which sometimes crashes at the
|
|
30
|
-
# end-of-file. (reported by Matsui-san)
|
|
31
|
-
#
|
|
32
|
-
# 03.05.08 nyasu Fixed enumtag which yields only half of texts in
|
|
33
|
-
# some conditions.
|
|
34
|
-
#
|
|
35
|
-
# 02.04.27 nyasu Regexp debugged in parse_attribute
|
|
36
|
-
#
|
|
37
|
-
# 02.03.12 nyasu Started
|
|
14
|
+
# == Author(s)
|
|
38
15
|
#
|
|
39
|
-
#
|
|
40
|
-
|
|
16
|
+
# * Ⴗnyasu
|
|
17
|
+
|
|
18
|
+
# Author:: Ⴗnyasu <nyasu@osk.3web.ne.jp>
|
|
19
|
+
# Copyright:: Copyright (c) 2000 Ⴗnyasu
|
|
20
|
+
# License:: Ruby License
|
|
41
21
|
|
|
42
|
-
|
|
22
|
+
# = TagIterator (aka Tagiter)
|
|
43
23
|
#
|
|
44
24
|
# Simple but very useful HTML/XHTML cascading parser.
|
|
45
25
|
#
|
|
@@ -124,10 +104,6 @@
|
|
|
124
104
|
# S1
|
|
125
105
|
# S2
|
|
126
106
|
#
|
|
127
|
-
# == Author(s)
|
|
128
|
-
#
|
|
129
|
-
# *ɂႷ nyasu <nyasu[at]osk.3web.ne.jp>
|
|
130
|
-
#
|
|
131
107
|
|
|
132
108
|
class TagIterator
|
|
133
109
|
|
|
@@ -0,0 +1,417 @@
|
|
|
1
|
+
# = taskable.rb
|
|
2
|
+
#
|
|
3
|
+
# == Copyright (c) 2006 Thomas Sawyer
|
|
4
|
+
#
|
|
5
|
+
# Ruby License
|
|
6
|
+
#
|
|
7
|
+
# This module is free software. You may use, modify, and/or redistribute this
|
|
8
|
+
# software under the same terms as Ruby.
|
|
9
|
+
#
|
|
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.
|
|
13
|
+
#
|
|
14
|
+
# == Auhtor(s)
|
|
15
|
+
#
|
|
16
|
+
# * Thomas Sawyer
|
|
17
|
+
|
|
18
|
+
# Author:: Thomas Sawyer
|
|
19
|
+
# Copyright:: Copyright (c) 2006 Thomas Sawyer
|
|
20
|
+
# License:: Ruby License
|
|
21
|
+
|
|
22
|
+
require 'tsort'
|
|
23
|
+
require 'facets/core/kernel/cache.rb'
|
|
24
|
+
require 'facets/core/kernel/method.rb'
|
|
25
|
+
require 'facets/more/inheritor.rb'
|
|
26
|
+
|
|
27
|
+
# = TSort
|
|
28
|
+
#
|
|
29
|
+
# TSort is used to determine which prerequisites to run
|
|
30
|
+
# for a task.
|
|
31
|
+
#
|
|
32
|
+
# Here we add a convenience method --if such a long method
|
|
33
|
+
# name can be said to be convenient ;) Although we ended
|
|
34
|
+
# not using it after all --it still may proved useful and
|
|
35
|
+
# may eventually be added to Facets or submitted as a patch.
|
|
36
|
+
|
|
37
|
+
module TSort
|
|
38
|
+
def strongly_connected_components_from(node)
|
|
39
|
+
result = []
|
|
40
|
+
each_strongly_connected_component_from(node) do |component|
|
|
41
|
+
result << component
|
|
42
|
+
end
|
|
43
|
+
result
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
# = Task
|
|
48
|
+
#
|
|
49
|
+
# A Task is a Method with prerequisite dependencies.
|
|
50
|
+
#
|
|
51
|
+
# NOTE Can't subclass Method b/c Method has no initiator.
|
|
52
|
+
# Not sure that would be a good idea anyway.
|
|
53
|
+
|
|
54
|
+
class Task
|
|
55
|
+
attr_accessor :description
|
|
56
|
+
|
|
57
|
+
def initialize( name, container, preq, desc=nil, &action )
|
|
58
|
+
@name = name
|
|
59
|
+
@container = container
|
|
60
|
+
@prerequisite = preq || []
|
|
61
|
+
@description = desc
|
|
62
|
+
@action = action
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
def prerequisite
|
|
66
|
+
@prerequisite ||= []
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
# #--
|
|
70
|
+
# # TODO Problem is 'a' can't take any parameters,
|
|
71
|
+
# # and there's no way to sort the tasks
|
|
72
|
+
# # from here. FIX if possible.
|
|
73
|
+
# #++
|
|
74
|
+
# def to_proc
|
|
75
|
+
# r = @prerequisite
|
|
76
|
+
# n = @name
|
|
77
|
+
# a = @action
|
|
78
|
+
# lambda {
|
|
79
|
+
# r.each{ |d| send(d) unless n == d }
|
|
80
|
+
# instance_eval &a if a
|
|
81
|
+
# }
|
|
82
|
+
# end
|
|
83
|
+
|
|
84
|
+
def complete
|
|
85
|
+
# ensure no cycles in the graph and extract call graph
|
|
86
|
+
#own = (class << self; self; end) # in case there are singletons?
|
|
87
|
+
t = Graph.new( container, name )
|
|
88
|
+
t.each_strongly_connected_component_from( name ) { |c|
|
|
89
|
+
#@container.instance_task(c).call
|
|
90
|
+
@container.send("->#{d}")
|
|
91
|
+
}
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
def call
|
|
95
|
+
@action.call
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
def each(&blk)
|
|
99
|
+
@prerequisite.each(&blk)
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
# Task::Graph is a Tarjan-sorted hash.
|
|
103
|
+
# It is used to generate the proper dependency chains.
|
|
104
|
+
# TODO Make Multiton off of base.
|
|
105
|
+
|
|
106
|
+
class Graph < Hash
|
|
107
|
+
include TSort
|
|
108
|
+
|
|
109
|
+
def initialize( base, name )
|
|
110
|
+
@base = base.class
|
|
111
|
+
@name = name
|
|
112
|
+
instance_map( name )
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
def instance_map( name )
|
|
116
|
+
t = @base.instance_task(name)
|
|
117
|
+
raise "prerequired task does not exist -- #{name} in #{@base}" unless t
|
|
118
|
+
self[name] = t.prerequisite || []
|
|
119
|
+
self[name].each { |r| instance_map( r ) }
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
alias_method :tsort_each_node, :each_key
|
|
123
|
+
|
|
124
|
+
def tsort_each_child(node, &block)
|
|
125
|
+
fetch(node).each(&block)
|
|
126
|
+
end
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
end
|
|
130
|
+
|
|
131
|
+
# = Taskable
|
|
132
|
+
#
|
|
133
|
+
# The Taskable module provides a generic task system
|
|
134
|
+
# patterned after Rake, but useable in any
|
|
135
|
+
# code context --not just with the Rake tool. In other
|
|
136
|
+
# words one can create methods with dependencies.
|
|
137
|
+
#
|
|
138
|
+
# NOTE Unlike methods, tasks can't take parameters
|
|
139
|
+
# if they are to be used as prerequisites.
|
|
140
|
+
# This capability might be added in the future, but
|
|
141
|
+
# presently syntax limitations make it awkward.
|
|
142
|
+
|
|
143
|
+
module Taskable
|
|
144
|
+
|
|
145
|
+
# Provide a mapping of tasks, including task from ancestors.
|
|
146
|
+
# TODO Not sure this is properly reading from ancestors.
|
|
147
|
+
|
|
148
|
+
# Define description for subsequent task.
|
|
149
|
+
|
|
150
|
+
def desc(line=nil)
|
|
151
|
+
return @last_description unless line
|
|
152
|
+
@last_description = line.gsub("\n",'')
|
|
153
|
+
end
|
|
154
|
+
|
|
155
|
+
# Use a description for subsequent task.
|
|
156
|
+
|
|
157
|
+
def desc!
|
|
158
|
+
l = @last_description
|
|
159
|
+
@last_description = nil
|
|
160
|
+
l
|
|
161
|
+
end
|
|
162
|
+
|
|
163
|
+
# Access a task.
|
|
164
|
+
|
|
165
|
+
def instance_task( name )
|
|
166
|
+
instance_task_table[ name.to_sym ]
|
|
167
|
+
end
|
|
168
|
+
|
|
169
|
+
# List of task names.
|
|
170
|
+
|
|
171
|
+
def instance_tasks
|
|
172
|
+
instance_task_table.keys
|
|
173
|
+
# t = instance_methods(true).select{ |m| m =~ /^->/ }
|
|
174
|
+
# t.collect { |e| e[2..-1].to_sym }
|
|
175
|
+
end
|
|
176
|
+
|
|
177
|
+
# List of task names with descriptions.
|
|
178
|
+
|
|
179
|
+
def described_tasks
|
|
180
|
+
instance_tasks.select { |name| instance_task(name).description }
|
|
181
|
+
end
|
|
182
|
+
|
|
183
|
+
# List of task names without descriptions.
|
|
184
|
+
|
|
185
|
+
def undescribed_tasks
|
|
186
|
+
instance_tasks.select { |name| ! instance_task(name).description }
|
|
187
|
+
end
|
|
188
|
+
|
|
189
|
+
# Define a task.
|
|
190
|
+
|
|
191
|
+
def task(args, &action)
|
|
192
|
+
if Hash === args
|
|
193
|
+
raise ArgumentError, "#{args.size} for 1" if args.size != 1
|
|
194
|
+
name, *deps = *(args.to_a.flatten)
|
|
195
|
+
name = name.to_sym
|
|
196
|
+
deps = deps.compact.collect{ |e| e.to_sym }
|
|
197
|
+
else
|
|
198
|
+
name, deps = args.to_sym, []
|
|
199
|
+
end
|
|
200
|
+
# create task via create core and callable methods.
|
|
201
|
+
# We do it this way b/c otherwise we'd have to use
|
|
202
|
+
# instance_eval and then can't ever pass paramaters.
|
|
203
|
+
if action
|
|
204
|
+
define_method( "->#{name}", &action ) # core of the task
|
|
205
|
+
define_method( name ) do
|
|
206
|
+
# ensure no cycles in the graph and extract call graph
|
|
207
|
+
#own = (class << self; self; end) # in case there are singletons?
|
|
208
|
+
todolist = Task::Graph.new( self, name )
|
|
209
|
+
todolist.each_strongly_connected_component_from( name ) do |c|
|
|
210
|
+
send("->#{c}")
|
|
211
|
+
end
|
|
212
|
+
end
|
|
213
|
+
instance_task_table![name] = Task.new( name, self, deps, desc!, &action )
|
|
214
|
+
else
|
|
215
|
+
m = instance_task_table![name]
|
|
216
|
+
#m.description = desc! # TODO should this apply only if there is an action?
|
|
217
|
+
m.prerequisite.concat deps unless deps.empty?
|
|
218
|
+
m
|
|
219
|
+
end
|
|
220
|
+
end
|
|
221
|
+
|
|
222
|
+
# Include the Task module into the Module class.
|
|
223
|
+
|
|
224
|
+
class ::Module
|
|
225
|
+
include Taskable
|
|
226
|
+
# This has to be down here and not in Taskable b/c of
|
|
227
|
+
# a glitch in inheritor's design.
|
|
228
|
+
inheritor :instance_task_table, {}, :merge
|
|
229
|
+
end
|
|
230
|
+
|
|
231
|
+
end
|
|
232
|
+
|
|
233
|
+
#
|
|
234
|
+
|
|
235
|
+
class Object
|
|
236
|
+
def send_task( name )
|
|
237
|
+
(class << self; self; end).instance_task( name )
|
|
238
|
+
end
|
|
239
|
+
end
|
|
240
|
+
|
|
241
|
+
#--
|
|
242
|
+
# TODO Allows tasks to defined at the toplevel (main).
|
|
243
|
+
# This may need work b/c it might cause an infinite loop.
|
|
244
|
+
# Plus there are a few method missing yet. Anyway,
|
|
245
|
+
# I'm not needing this functionality at the moment, and
|
|
246
|
+
# I leave it to somone else to finish when they do.
|
|
247
|
+
#
|
|
248
|
+
# class Object
|
|
249
|
+
#
|
|
250
|
+
# def instance_tasks
|
|
251
|
+
# (class << self; self; end).instance_tasks
|
|
252
|
+
# end
|
|
253
|
+
#
|
|
254
|
+
# def instance_task(*args, &blk)
|
|
255
|
+
# (class << self; self; end).task(*args, &blk)
|
|
256
|
+
# end
|
|
257
|
+
#
|
|
258
|
+
# def desc(*args, &blk)
|
|
259
|
+
# (class << self; self; end).desc(*args, &blk)
|
|
260
|
+
# end
|
|
261
|
+
#
|
|
262
|
+
# def desc!(*args, &blk)
|
|
263
|
+
# (class << self; self; end).desc!(*args, &blk)
|
|
264
|
+
# end
|
|
265
|
+
#
|
|
266
|
+
# def task(*args, &blk)
|
|
267
|
+
# (class << self; self; end).desc(*args, &blk)
|
|
268
|
+
# end
|
|
269
|
+
#
|
|
270
|
+
# end
|
|
271
|
+
#++
|
|
272
|
+
|
|
273
|
+
|
|
274
|
+
# _____ _
|
|
275
|
+
# |_ _|__ ___| |_
|
|
276
|
+
# | |/ _ \/ __| __|
|
|
277
|
+
# | | __/\__ \ |_
|
|
278
|
+
# |_|\___||___/\__|
|
|
279
|
+
#
|
|
280
|
+
=begin test
|
|
281
|
+
|
|
282
|
+
require 'test/unit'
|
|
283
|
+
|
|
284
|
+
class TCTask < Test::Unit::TestCase
|
|
285
|
+
|
|
286
|
+
module M
|
|
287
|
+
task :m1 => [ :c1 ] do @x << "m1" end
|
|
288
|
+
task :m2 => [ :c2 ] do @x << "m2" end
|
|
289
|
+
task :m3 => [ :c3 ] do @x << "m3" end
|
|
290
|
+
task :m4 => [ :c1, :c2, :c3 ] do @x << "m4" end
|
|
291
|
+
task :m5 do @x << 'm5' end
|
|
292
|
+
end
|
|
293
|
+
|
|
294
|
+
class C
|
|
295
|
+
include M
|
|
296
|
+
attr :x
|
|
297
|
+
def initialize ; @x = [] ; end
|
|
298
|
+
|
|
299
|
+
task :c1 do @x << "c1" end
|
|
300
|
+
task :c2 => [ :c1, :c1 ] do @x << "c2" end
|
|
301
|
+
task :c3 => [ :c1, :c2 ] do @x << "c3" end
|
|
302
|
+
task :c4 => [ :m1 ] do @x << "c4" end
|
|
303
|
+
task :c5 => [ :c5 ] do @x << "c5" end
|
|
304
|
+
task :c6 => [ :c7 ] do @x << "c6" end
|
|
305
|
+
task :c7 => [ :c6 ] do @x << "c7" end
|
|
306
|
+
end
|
|
307
|
+
|
|
308
|
+
class D < C
|
|
309
|
+
task :d1 => [ :c1 ] do @x << "d1" ; end
|
|
310
|
+
task :d2 => [ :m1 ] do @x << "d2" ; end
|
|
311
|
+
end
|
|
312
|
+
|
|
313
|
+
module N
|
|
314
|
+
include M
|
|
315
|
+
end
|
|
316
|
+
|
|
317
|
+
class E
|
|
318
|
+
include N
|
|
319
|
+
attr :x
|
|
320
|
+
def initialize ; @x = [] ; end
|
|
321
|
+
|
|
322
|
+
task :e1 => [ :c1 ] do @x << "e1" ; end
|
|
323
|
+
task :e2 => [ :m1 ] do @x << "e2" ; end
|
|
324
|
+
task :e3 => [ :m5 ] do @x << "e3" ; end
|
|
325
|
+
end
|
|
326
|
+
|
|
327
|
+
module O
|
|
328
|
+
attr :x
|
|
329
|
+
task :o1 do (@x||=[]) << "o1" end
|
|
330
|
+
task :o2 => [ :o1 ] do (@x||=[]) << "o2" end
|
|
331
|
+
end
|
|
332
|
+
|
|
333
|
+
# TODO Appearently extending does play well with inheritor?
|
|
334
|
+
# F = Module.new { extend O }
|
|
335
|
+
|
|
336
|
+
# tests
|
|
337
|
+
|
|
338
|
+
def test_C1
|
|
339
|
+
c = C.new ; c.c1
|
|
340
|
+
assert_equal( [ 'c1' ], c.x )
|
|
341
|
+
end
|
|
342
|
+
|
|
343
|
+
def test_C2
|
|
344
|
+
c = C.new ; c.c2
|
|
345
|
+
assert_equal( [ 'c1', 'c2' ], c.x )
|
|
346
|
+
end
|
|
347
|
+
|
|
348
|
+
def test_C3
|
|
349
|
+
c = C.new ; c.c3
|
|
350
|
+
assert_equal( [ 'c1', 'c2', 'c3' ], c.x )
|
|
351
|
+
end
|
|
352
|
+
|
|
353
|
+
def test_C4
|
|
354
|
+
c = C.new ; c.c4
|
|
355
|
+
assert_equal( [ 'c1', 'm1', 'c4' ], c.x )
|
|
356
|
+
end
|
|
357
|
+
|
|
358
|
+
def test_M1
|
|
359
|
+
c = C.new ; c.m1
|
|
360
|
+
assert_equal( [ 'c1', 'm1' ], c.x )
|
|
361
|
+
end
|
|
362
|
+
|
|
363
|
+
def test_M2
|
|
364
|
+
c = C.new ; c.m2
|
|
365
|
+
assert_equal( [ 'c1', 'c2', 'm2' ], c.x )
|
|
366
|
+
end
|
|
367
|
+
|
|
368
|
+
def test_M3
|
|
369
|
+
c = C.new ; c.m3
|
|
370
|
+
assert_equal( [ 'c1', 'c2', 'c3', 'm3' ], c.x )
|
|
371
|
+
end
|
|
372
|
+
|
|
373
|
+
def test_M4
|
|
374
|
+
c = C.new ; c.m4
|
|
375
|
+
assert_equal( [ 'c1', 'c2', 'c3', 'm4' ], c.x )
|
|
376
|
+
end
|
|
377
|
+
|
|
378
|
+
def test_D1
|
|
379
|
+
d = D.new ; d.d1
|
|
380
|
+
assert_equal( [ 'c1', 'd1' ], d.x )
|
|
381
|
+
end
|
|
382
|
+
|
|
383
|
+
def test_D2
|
|
384
|
+
d = D.new ; d.d2
|
|
385
|
+
assert_equal( [ 'c1', 'm1', 'd2' ], d.x )
|
|
386
|
+
end
|
|
387
|
+
|
|
388
|
+
def test_E1
|
|
389
|
+
e = E.new
|
|
390
|
+
assert_raises( RuntimeError ) { e.e1 }
|
|
391
|
+
#assert_equal( [ 'c1', 'e1' ], e.x )
|
|
392
|
+
end
|
|
393
|
+
|
|
394
|
+
def test_E2
|
|
395
|
+
e = E.new
|
|
396
|
+
assert_raises( RuntimeError ) { e.e2 }
|
|
397
|
+
#assert_equal( [ 'c1', 'm1', 'e2' ], e.x )
|
|
398
|
+
end
|
|
399
|
+
|
|
400
|
+
def test_E3
|
|
401
|
+
e = E.new ; e.e3
|
|
402
|
+
assert_equal( [ 'm5', 'e3' ], e.x )
|
|
403
|
+
end
|
|
404
|
+
|
|
405
|
+
# def test_F1
|
|
406
|
+
# F.o1
|
|
407
|
+
# assert_equal( [ 'o1' ], F.x )
|
|
408
|
+
# end
|
|
409
|
+
#
|
|
410
|
+
# def test_F2
|
|
411
|
+
# F.o2
|
|
412
|
+
# assert_equal( [ 'o1', 'o1', 'o2' ], F.x )
|
|
413
|
+
# end
|
|
414
|
+
|
|
415
|
+
end
|
|
416
|
+
|
|
417
|
+
=end
|