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,34 +1,25 @@
|
|
|
1
|
-
|
|
2
|
-
# ClassInherit
|
|
1
|
+
# = classinherit.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
|
-
# 2005-11-29 trans
|
|
19
|
-
# Version "2.0". Improved by adopting old #class_inherit functionality
|
|
20
|
-
# as well, i.e. ClassInherit module now will be inherited down
|
|
21
|
-
# the Hierarchy chain.
|
|
14
|
+
# == Authors and Contributors
|
|
22
15
|
#
|
|
23
|
-
#
|
|
24
|
-
|
|
25
|
-
#
|
|
26
|
-
#
|
|
27
|
-
#
|
|
28
|
-
#
|
|
29
|
-
#++
|
|
16
|
+
# * Thomas Sawyer
|
|
17
|
+
|
|
18
|
+
# Author:: Thomas Sawyer
|
|
19
|
+
# Copyright:: Copyright (c) 2005 Thomas Sawyer
|
|
20
|
+
# License:: Ruby License
|
|
30
21
|
|
|
31
|
-
|
|
22
|
+
# = ClassInherit
|
|
32
23
|
#
|
|
33
24
|
# This framework provides a very convenient way to have modules
|
|
34
25
|
# pass along class methods in the inheritance chain.
|
|
@@ -105,13 +96,6 @@
|
|
|
105
96
|
# And making non-inheritance the exception, which is alwasy easy
|
|
106
97
|
# enough to achieve: just put the code in a separate
|
|
107
98
|
# (and thus uninherited) module.
|
|
108
|
-
#
|
|
109
|
-
# == Author(s)
|
|
110
|
-
#
|
|
111
|
-
# * Thomas Sawyer
|
|
112
|
-
# * Nobu Nakada
|
|
113
|
-
# * Ulysses
|
|
114
|
-
#
|
|
115
99
|
|
|
116
100
|
class Module
|
|
117
101
|
|
|
@@ -1,34 +1,31 @@
|
|
|
1
|
-
|
|
2
|
-
# ClassMethods
|
|
1
|
+
# = classmethods.rb
|
|
3
2
|
#
|
|
4
|
-
# Copyright (c) 2005 Thomas Sawyer
|
|
3
|
+
# == Copyright (c) 2005 Nobu Nakada, 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
|
-
# 2005-11-29 trans
|
|
19
|
-
# Version "2.0". Improved by adopting old #class_inherit functionality
|
|
20
|
-
# as well, i.e. ClassMethods module now will be inherited down
|
|
21
|
-
# the Hierarchy chain.
|
|
14
|
+
# == Special Thanks
|
|
22
15
|
#
|
|
23
|
-
#
|
|
24
|
-
# Reimplemented for Calibre based on Nabu's work.
|
|
25
|
-
# ==========================================================================
|
|
16
|
+
# Thanks to Nobu and Ulysses for their original work on this.
|
|
26
17
|
#
|
|
27
|
-
#
|
|
18
|
+
# == Authors and Contributors
|
|
28
19
|
#
|
|
29
|
-
|
|
20
|
+
# * Nobu Nakada
|
|
21
|
+
# * Thomas Sawyer
|
|
22
|
+
# * Ulysses
|
|
30
23
|
|
|
31
|
-
|
|
24
|
+
# Author:: Nobu Nakada, Thomas Sawyer
|
|
25
|
+
# Copyright:: Copyright (c) 2005 Nobu Nakada, Thomas Sawyer
|
|
26
|
+
# License:: Ruby License
|
|
27
|
+
|
|
28
|
+
# = ClassMethods
|
|
32
29
|
#
|
|
33
30
|
# Miniframework provides a very convenient way to have modules
|
|
34
31
|
# pass along class methods in the inheritance chain.
|
|
@@ -105,13 +102,6 @@
|
|
|
105
102
|
# And making non-inheritance the exception, which is alwasy easy
|
|
106
103
|
# enough to achieve: put the code in a separate (and thus uninherited)
|
|
107
104
|
# module.
|
|
108
|
-
#
|
|
109
|
-
# == Author(s)
|
|
110
|
-
#
|
|
111
|
-
# * Thomas Sawyer
|
|
112
|
-
# * Nobu Nakada
|
|
113
|
-
# * Ulysses
|
|
114
|
-
#
|
|
115
105
|
|
|
116
106
|
class Module
|
|
117
107
|
|
|
@@ -1,42 +1,54 @@
|
|
|
1
|
-
|
|
2
|
-
#
|
|
3
|
-
#
|
|
4
|
-
#
|
|
5
|
-
#
|
|
6
|
-
#
|
|
7
|
-
#
|
|
8
|
-
#
|
|
9
|
-
#
|
|
10
|
-
#
|
|
11
|
-
#
|
|
12
|
-
# the
|
|
13
|
-
#
|
|
14
|
-
#
|
|
15
|
-
#
|
|
16
|
-
#
|
|
17
|
-
#
|
|
18
|
-
#
|
|
19
|
-
#
|
|
20
|
-
#
|
|
21
|
-
#
|
|
22
|
-
#
|
|
23
|
-
#
|
|
24
|
-
|
|
1
|
+
# = cloneable.rb
|
|
2
|
+
#
|
|
3
|
+
# == Copyright (c) 2003-2004 Jim Weirich
|
|
4
|
+
#
|
|
5
|
+
# GNU General Public License (GPL)
|
|
6
|
+
#
|
|
7
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
|
8
|
+
# a copy of this software and associated documentation files (the
|
|
9
|
+
# "Software"), to deal in the Software without restriction, including
|
|
10
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
|
11
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
|
12
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
|
13
|
+
# the following conditions:
|
|
14
|
+
#
|
|
15
|
+
# The above copyright notice and this permission notice shall be
|
|
16
|
+
# included in all copies or substantial portions of the Software.
|
|
17
|
+
#
|
|
18
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
19
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
20
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
21
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
22
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
23
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
24
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
25
|
+
#
|
|
26
|
+
# == Speical Thanks
|
|
27
|
+
#
|
|
28
|
+
# Cloneable was ported from Jim Weirich's Rake.
|
|
29
|
+
#
|
|
30
|
+
# == Authors and Contributors
|
|
31
|
+
#
|
|
32
|
+
# * Jim Weirich
|
|
33
|
+
#
|
|
34
|
+
# == Developer Notes
|
|
35
|
+
#
|
|
36
|
+
# TODO Method #clone should copy '<<'-methods in contrast to #dup.
|
|
37
|
+
|
|
38
|
+
# Author:: Jim Weirich
|
|
39
|
+
# Copyright:: Copyright (c) 2002 Jim Weirich
|
|
40
|
+
# License:: GNU General Public License (GPL)
|
|
25
41
|
|
|
26
|
-
#
|
|
42
|
+
# = Cloneable
|
|
27
43
|
#
|
|
28
44
|
# Stadard basis for adding #dup and #clone methods to a class.
|
|
29
|
-
#
|
|
30
|
-
#--
|
|
31
|
-
# TODO #clone should copy '<<'-methods in contrast to #dup.
|
|
32
|
-
#++
|
|
33
45
|
|
|
34
46
|
module Cloneable
|
|
35
47
|
def clone
|
|
36
48
|
sibling = self.class.new
|
|
37
49
|
instance_variables.each do |ivar|
|
|
38
50
|
value = self.instance_variable_get(ivar)
|
|
39
|
-
sibling.instance_variable_set(ivar, value.rake_dup)
|
|
51
|
+
sibling.instance_variable_set(ivar, value.dup) #rake_dup)
|
|
40
52
|
end
|
|
41
53
|
sibling
|
|
42
54
|
end
|
|
@@ -1,31 +1,44 @@
|
|
|
1
|
-
|
|
2
|
-
# Console Applicaiton
|
|
1
|
+
# = consoleapp.rb
|
|
3
2
|
#
|
|
4
|
-
# Copyright (c) 2005
|
|
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
|
|
8
|
+
# redistribute this software under the same terms as Ruby.
|
|
10
9
|
#
|
|
11
|
-
#
|
|
12
|
-
#
|
|
13
|
-
#
|
|
14
|
-
#
|
|
10
|
+
# This program is distributed in the hope that it will be
|
|
11
|
+
# useful, but WITHOUT ANY WARRANTY; without even the implied
|
|
12
|
+
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
|
13
|
+
# PURPOSE.
|
|
15
14
|
#
|
|
16
|
-
#
|
|
17
|
-
# HISTORY
|
|
18
|
-
# -------------------------------------------------------------
|
|
19
|
-
# 2005-09-09 Trans * Created.
|
|
20
|
-
# =============================================================
|
|
15
|
+
# == Author(s)
|
|
21
16
|
#
|
|
22
|
-
#
|
|
17
|
+
# * Thomas Sawyer
|
|
23
18
|
#
|
|
24
|
-
|
|
19
|
+
# == Developer Notes
|
|
20
|
+
#
|
|
21
|
+
# TODO Add documentation features.
|
|
22
|
+
#
|
|
23
|
+
# TODO Rename file to consolecmd.rb or consolecommand.rb,
|
|
24
|
+
# or move to console/command.rb, but I'm not sure yet if
|
|
25
|
+
# adding subdirectories to more/ is a good idea.
|
|
26
|
+
#
|
|
27
|
+
# TODO Also, probably should deprecate Console::Application
|
|
28
|
+
# alias at some point.
|
|
29
|
+
|
|
30
|
+
# Author:: Thomas Sawyer
|
|
31
|
+
# Copyright:: Copyright (c) 2005 Thomas Sawyer
|
|
32
|
+
# License:: Ruby License
|
|
33
|
+
|
|
34
|
+
# = Console
|
|
35
|
+
#
|
|
36
|
+
# Console namespace for use by tools specifically designed
|
|
37
|
+
# for command line interfaces.
|
|
25
38
|
|
|
26
39
|
module Console ; end
|
|
27
40
|
|
|
28
|
-
|
|
41
|
+
# = Console Command
|
|
29
42
|
#
|
|
30
43
|
# Console::Command provides a clean and easy way
|
|
31
44
|
# to create a command line interface for your program.
|
|
@@ -69,13 +82,20 @@ module Console ; end
|
|
|
69
82
|
|
|
70
83
|
class Console::Command
|
|
71
84
|
|
|
72
|
-
def execute(
|
|
85
|
+
def self.execute( *args )
|
|
86
|
+
new.execute( *args )
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
def initialize
|
|
90
|
+
# do not let this pass through on to
|
|
91
|
+
# any included module.
|
|
92
|
+
end
|
|
73
93
|
|
|
94
|
+
def execute( argv=nil )
|
|
74
95
|
argv ||= ARGV # argv remains unchanged
|
|
75
96
|
args = argv.dup # args is manipulated
|
|
76
97
|
|
|
77
98
|
# process options
|
|
78
|
-
|
|
79
99
|
i = 0;
|
|
80
100
|
while i < argv.size
|
|
81
101
|
if md = %r{^[-]}.match( argv[i] )
|
|
@@ -140,8 +160,8 @@ class Console::Command
|
|
|
140
160
|
end
|
|
141
161
|
|
|
142
162
|
alias_method :go, :execute
|
|
143
|
-
|
|
163
|
+
|
|
144
164
|
end
|
|
145
165
|
|
|
146
|
-
#
|
|
166
|
+
# backward compatability
|
|
147
167
|
Console::Application = Console::Command
|
|
@@ -0,0 +1,565 @@
|
|
|
1
|
+
# = cookie.rb
|
|
2
|
+
#
|
|
3
|
+
# == Copyright (c) 2004 TAKAHASHI `Maki' Masayoshi
|
|
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
|
|
15
|
+
#
|
|
16
|
+
# cookie.rb is redistributed file which is originally included in Webagent
|
|
17
|
+
# version 0.6.2 by TAKAHASHI `Maki' Masayoshi. And it contains some bug fixes.
|
|
18
|
+
# You can download the entire package of Webagent from:
|
|
19
|
+
# * http://www.rubycolor.org/arc/.
|
|
20
|
+
#
|
|
21
|
+
# == Additional Information
|
|
22
|
+
#
|
|
23
|
+
# * w3m homepage: http://ei5nazha.yz.yamagata-u.ac.jp/~aito/w3m/eng/
|
|
24
|
+
#
|
|
25
|
+
# == Develop Notes
|
|
26
|
+
#
|
|
27
|
+
# TODO Remove from WebAgent contatiner,
|
|
28
|
+
# Perhaps move to HTTP containter.
|
|
29
|
+
|
|
30
|
+
# Author:: TAKAHASHI `Maki' Masayoshi
|
|
31
|
+
# Copyright:: Copyright (c) 2004 TAKAHASHI `Maki' Masayoshi
|
|
32
|
+
# License:: Ruby License
|
|
33
|
+
|
|
34
|
+
# = Cookie
|
|
35
|
+
#
|
|
36
|
+
# I refered to w3m's source to make these classes. Some comments
|
|
37
|
+
# are quoted from it. I'm thanksful for author(s) of it.
|
|
38
|
+
|
|
39
|
+
require 'uri'
|
|
40
|
+
|
|
41
|
+
# WebAgent
|
|
42
|
+
|
|
43
|
+
class WebAgent
|
|
44
|
+
|
|
45
|
+
module CookieUtils
|
|
46
|
+
|
|
47
|
+
def head_match?(str1, str2)
|
|
48
|
+
str1 == str2[0, str1.length]
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
def tail_match?(str1, str2)
|
|
52
|
+
if str1.length > 0
|
|
53
|
+
str1 == str2[-str1.length..-1].to_s
|
|
54
|
+
else
|
|
55
|
+
true
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
def domain_match(host, domain)
|
|
60
|
+
case domain
|
|
61
|
+
when /\d+\.\d+\.\d+\.\d+/
|
|
62
|
+
return (host == domain)
|
|
63
|
+
when '.'
|
|
64
|
+
return true
|
|
65
|
+
when /^\./
|
|
66
|
+
return tail_match?(domain, host)
|
|
67
|
+
else
|
|
68
|
+
return (host == domain)
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
def total_dot_num(string)
|
|
73
|
+
string.scan(/\./).length()
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
class Cookie
|
|
79
|
+
include CookieUtils
|
|
80
|
+
|
|
81
|
+
require 'parsedate'
|
|
82
|
+
include ParseDate
|
|
83
|
+
|
|
84
|
+
attr_accessor :name, :value
|
|
85
|
+
attr_accessor :domain, :path
|
|
86
|
+
attr_accessor :expires ## for Netscape Cookie
|
|
87
|
+
attr_accessor :url
|
|
88
|
+
attr_writer :use, :secure, :discard, :domain_orig, :path_orig, :override
|
|
89
|
+
|
|
90
|
+
USE = 1
|
|
91
|
+
SECURE = 2
|
|
92
|
+
DOMAIN = 4
|
|
93
|
+
PATH = 8
|
|
94
|
+
DISCARD = 16
|
|
95
|
+
OVERRIDE = 32
|
|
96
|
+
OVERRIDE_OK = 32
|
|
97
|
+
|
|
98
|
+
def initialize()
|
|
99
|
+
@discard = @use = @secure = @domain_orig = @path_orig = @override = nil
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
def discard?
|
|
103
|
+
@discard
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
def use?
|
|
107
|
+
@use
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
def secure?
|
|
111
|
+
@secure
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
def domain_orig?
|
|
115
|
+
@domain_orig
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
def path_orig?
|
|
119
|
+
@path_orig
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
def override?
|
|
123
|
+
@override
|
|
124
|
+
end
|
|
125
|
+
|
|
126
|
+
def flag
|
|
127
|
+
flg = 0
|
|
128
|
+
flg += USE if @use
|
|
129
|
+
flg += SECURE if @secure
|
|
130
|
+
flg += DOMAIN if @domain_orig
|
|
131
|
+
flg += PATH if @path_orig
|
|
132
|
+
flg += DISCARD if @discard
|
|
133
|
+
flg += OVERRIDE if @override
|
|
134
|
+
flg
|
|
135
|
+
end
|
|
136
|
+
|
|
137
|
+
def set_flag(flag)
|
|
138
|
+
flag = flag.to_i
|
|
139
|
+
@use = true if flag & USE > 0
|
|
140
|
+
@secure = true if flag & SECURE > 0
|
|
141
|
+
@domain_orig = true if flag & DOMAIN > 0
|
|
142
|
+
@path_orig = true if flag & PATH > 0
|
|
143
|
+
@discard = true if flag & DISCARD > 0
|
|
144
|
+
@override = true if flag & OVERRIDE > 0
|
|
145
|
+
end
|
|
146
|
+
|
|
147
|
+
def match?(url)
|
|
148
|
+
domainname = url.host
|
|
149
|
+
if (!domainname ||
|
|
150
|
+
!domain_match(domainname, @domain) ||
|
|
151
|
+
(@path && !head_match?(@path, url.path)) ||
|
|
152
|
+
(@secure && (url.scheme != 'https')) )
|
|
153
|
+
return false
|
|
154
|
+
else
|
|
155
|
+
return true
|
|
156
|
+
end
|
|
157
|
+
end
|
|
158
|
+
|
|
159
|
+
def join_quotedstr(array, sep)
|
|
160
|
+
ret = Array.new()
|
|
161
|
+
old_elem = nil
|
|
162
|
+
array.each{|elem|
|
|
163
|
+
if (elem.scan(/"/).length % 2) == 0
|
|
164
|
+
if old_elem
|
|
165
|
+
old_elem << sep << elem
|
|
166
|
+
else
|
|
167
|
+
ret << elem
|
|
168
|
+
old_elem = nil
|
|
169
|
+
end
|
|
170
|
+
else
|
|
171
|
+
if old_elem
|
|
172
|
+
old_elem << sep << elem
|
|
173
|
+
ret << old_elem
|
|
174
|
+
old_elem = nil
|
|
175
|
+
else
|
|
176
|
+
old_elem = elem.dup
|
|
177
|
+
end
|
|
178
|
+
end
|
|
179
|
+
}
|
|
180
|
+
ret
|
|
181
|
+
end
|
|
182
|
+
|
|
183
|
+
def parse(str, url)
|
|
184
|
+
@url = url
|
|
185
|
+
cookie_elem = str.split(/;/)
|
|
186
|
+
cookie_elem = join_quotedstr(cookie_elem, ';')
|
|
187
|
+
first_elem = cookie_elem.shift
|
|
188
|
+
if first_elem !~ /([^=]*)(\=(.*))?/
|
|
189
|
+
return
|
|
190
|
+
## raise ArgumentError 'invalid cookie value'
|
|
191
|
+
end
|
|
192
|
+
@name = $1.strip
|
|
193
|
+
@value = $3
|
|
194
|
+
if @value
|
|
195
|
+
if @value =~ /^\s*"(.*)"\s*$/
|
|
196
|
+
@value = $1
|
|
197
|
+
else
|
|
198
|
+
@value.dup.strip!
|
|
199
|
+
end
|
|
200
|
+
end
|
|
201
|
+
cookie_elem.each{|pair|
|
|
202
|
+
key, value = pair.split(/=/) ## value may nil
|
|
203
|
+
key.strip!
|
|
204
|
+
if value
|
|
205
|
+
value = value.strip.sub(/\A"(.*)"\z/) { $1 }
|
|
206
|
+
end
|
|
207
|
+
case key.downcase
|
|
208
|
+
when 'domain'
|
|
209
|
+
@domain = value
|
|
210
|
+
when 'expires'
|
|
211
|
+
begin
|
|
212
|
+
@expires = Time.gm(*parsedate(value)[0,6])
|
|
213
|
+
rescue ArgumentError
|
|
214
|
+
@expires = nil
|
|
215
|
+
end
|
|
216
|
+
when 'path'
|
|
217
|
+
@path = value
|
|
218
|
+
when 'secure'
|
|
219
|
+
@secure = true ## value may nil, but must 'true'.
|
|
220
|
+
else
|
|
221
|
+
## ignore
|
|
222
|
+
end
|
|
223
|
+
}
|
|
224
|
+
end
|
|
225
|
+
|
|
226
|
+
end
|
|
227
|
+
|
|
228
|
+
class CookieManager
|
|
229
|
+
include CookieUtils
|
|
230
|
+
|
|
231
|
+
### errors
|
|
232
|
+
class Error < StandardError; end
|
|
233
|
+
class ErrorOverrideOK < Error; end
|
|
234
|
+
class SpecialError < Error; end
|
|
235
|
+
class NoDotError < ErrorOverrideOK; end
|
|
236
|
+
|
|
237
|
+
SPECIAL_DOMAIN = [".com",".edu",".gov",".mil",".net",".org",".int"]
|
|
238
|
+
|
|
239
|
+
attr_accessor :cookies
|
|
240
|
+
attr_accessor :cookies_file
|
|
241
|
+
attr_accessor :accept_domains, :reject_domains
|
|
242
|
+
attr_accessor :netscape_rule
|
|
243
|
+
|
|
244
|
+
def initialize(file=nil)
|
|
245
|
+
@cookies = Array.new()
|
|
246
|
+
@cookies_file = file
|
|
247
|
+
@is_saved = true
|
|
248
|
+
@reject_domains = Array.new()
|
|
249
|
+
@accept_domains = Array.new()
|
|
250
|
+
# for conformance to http://wp.netscape.com/newsref/std/cookie_spec.html
|
|
251
|
+
@netscape_rule = false
|
|
252
|
+
end
|
|
253
|
+
|
|
254
|
+
def save_all_cookies(force = nil, save_unused = true, save_discarded = true)
|
|
255
|
+
if @is_saved and !force
|
|
256
|
+
return
|
|
257
|
+
end
|
|
258
|
+
File.open(@cookies_file, 'w') do |f|
|
|
259
|
+
@cookies.each do |cookie|
|
|
260
|
+
if (cookie.use? or save_unused) and
|
|
261
|
+
(!cookie.discard? or save_discarded)
|
|
262
|
+
f.print(cookie.url.to_s,"\t",
|
|
263
|
+
cookie.name,"\t",
|
|
264
|
+
cookie.value,"\t",
|
|
265
|
+
cookie.expires.to_i,"\t",
|
|
266
|
+
cookie.domain,"\t",
|
|
267
|
+
cookie.path,"\t",
|
|
268
|
+
cookie.flag,"\n")
|
|
269
|
+
end
|
|
270
|
+
end
|
|
271
|
+
end
|
|
272
|
+
end
|
|
273
|
+
|
|
274
|
+
def save_cookies(force = nil)
|
|
275
|
+
save_all_cookies(force, false, false)
|
|
276
|
+
end
|
|
277
|
+
|
|
278
|
+
def check_expired_cookies()
|
|
279
|
+
@cookies.reject!{|cookie|
|
|
280
|
+
is_expired = (cookie.expires && (cookie.expires < Time.now.gmtime))
|
|
281
|
+
if is_expired && !cookie.discard?
|
|
282
|
+
@is_saved = false
|
|
283
|
+
end
|
|
284
|
+
is_expired
|
|
285
|
+
}
|
|
286
|
+
end
|
|
287
|
+
|
|
288
|
+
def parse(str, url)
|
|
289
|
+
cookie = WebAgent::Cookie.new()
|
|
290
|
+
cookie.parse(str, url)
|
|
291
|
+
add(cookie)
|
|
292
|
+
end
|
|
293
|
+
|
|
294
|
+
def make_cookie_str(cookie_list)
|
|
295
|
+
if cookie_list.empty?
|
|
296
|
+
return nil
|
|
297
|
+
end
|
|
298
|
+
|
|
299
|
+
ret = ''
|
|
300
|
+
c = cookie_list.shift
|
|
301
|
+
ret += "#{c.name}=#{c.value}"
|
|
302
|
+
cookie_list.each{|cookie|
|
|
303
|
+
ret += "; #{cookie.name}=#{cookie.value}"
|
|
304
|
+
}
|
|
305
|
+
return ret
|
|
306
|
+
end
|
|
307
|
+
private :make_cookie_str
|
|
308
|
+
|
|
309
|
+
|
|
310
|
+
def find(url)
|
|
311
|
+
|
|
312
|
+
check_expired_cookies()
|
|
313
|
+
|
|
314
|
+
cookie_list = Array.new()
|
|
315
|
+
|
|
316
|
+
@cookies.each{|cookie|
|
|
317
|
+
if cookie.use? && cookie.match?(url)
|
|
318
|
+
if cookie_list.select{|c1| c1.name == cookie.name}.empty?
|
|
319
|
+
cookie_list << cookie
|
|
320
|
+
end
|
|
321
|
+
end
|
|
322
|
+
}
|
|
323
|
+
return make_cookie_str(cookie_list)
|
|
324
|
+
end
|
|
325
|
+
|
|
326
|
+
def find_cookie_info(domain, path, name)
|
|
327
|
+
@cookies.find{|c|
|
|
328
|
+
c.domain == domain && c.path == path && c.name == name
|
|
329
|
+
}
|
|
330
|
+
end
|
|
331
|
+
private :find_cookie_info
|
|
332
|
+
|
|
333
|
+
def cookie_error(err, override)
|
|
334
|
+
if err.kind_of?(ErrorOverrideOK) || !override
|
|
335
|
+
raise err
|
|
336
|
+
end
|
|
337
|
+
end
|
|
338
|
+
private :cookie_error
|
|
339
|
+
|
|
340
|
+
def add(cookie)
|
|
341
|
+
url = cookie.url
|
|
342
|
+
name, value = cookie.name, cookie.value
|
|
343
|
+
expires, domain, path =
|
|
344
|
+
cookie.expires, cookie.domain, cookie.path
|
|
345
|
+
secure, domain_orig, path_orig =
|
|
346
|
+
cookie.secure?, cookie.domain_orig?, cookie.path_orig?
|
|
347
|
+
discard, override =
|
|
348
|
+
cookie.discard?, cookie.override?
|
|
349
|
+
|
|
350
|
+
domainname = url.host
|
|
351
|
+
domain_orig, path_orig = domain, path
|
|
352
|
+
use_security = override
|
|
353
|
+
|
|
354
|
+
if !domainname
|
|
355
|
+
cookie_error(NodotError.new(), override)
|
|
356
|
+
end
|
|
357
|
+
|
|
358
|
+
if domain
|
|
359
|
+
|
|
360
|
+
# [DRAFT 12] s. 4.2.2 (does not apply in the case that
|
|
361
|
+
# host name is the same as domain attribute for version 0
|
|
362
|
+
# cookie)
|
|
363
|
+
# I think that this rule has almost the same effect as the
|
|
364
|
+
# tail match of [NETSCAPE].
|
|
365
|
+
if domain !~ /^\./ && domainname != domain
|
|
366
|
+
domain = '.'+domain
|
|
367
|
+
end
|
|
368
|
+
|
|
369
|
+
n = total_dot_num(domain)
|
|
370
|
+
if n < 2
|
|
371
|
+
cookie_error(SpecialError.new(), override)
|
|
372
|
+
elsif @netscape_rule and n == 2
|
|
373
|
+
## [NETSCAPE] rule
|
|
374
|
+
ok = SPECIAL_DOMAIN.select{|sdomain|
|
|
375
|
+
sdomain == domain[-(sdomain.length)..-1]
|
|
376
|
+
}
|
|
377
|
+
if ok.empty?
|
|
378
|
+
cookie_error(SpecialError.new(), override)
|
|
379
|
+
end
|
|
380
|
+
end
|
|
381
|
+
|
|
382
|
+
end
|
|
383
|
+
|
|
384
|
+
path ||= url.path.sub!(%r|/[^/]*|, '')
|
|
385
|
+
domain ||= domainname
|
|
386
|
+
cookie = find_cookie_info(domain, path, name)
|
|
387
|
+
|
|
388
|
+
if !cookie
|
|
389
|
+
cookie = WebAgent::Cookie.new()
|
|
390
|
+
cookie.use = true
|
|
391
|
+
@cookies << cookie
|
|
392
|
+
end
|
|
393
|
+
|
|
394
|
+
cookie.url = url
|
|
395
|
+
cookie.name = name
|
|
396
|
+
cookie.value = value
|
|
397
|
+
cookie.expires = expires
|
|
398
|
+
cookie.domain = domain
|
|
399
|
+
cookie.path = path
|
|
400
|
+
|
|
401
|
+
## for flag
|
|
402
|
+
cookie.secure = secure
|
|
403
|
+
cookie.domain_orig = domain_orig
|
|
404
|
+
cookie.path_orig = path_orig
|
|
405
|
+
if discard || cookie.expires == nil
|
|
406
|
+
cookie.discard = true
|
|
407
|
+
else
|
|
408
|
+
cookie.discard = false
|
|
409
|
+
@is_saved = false
|
|
410
|
+
end
|
|
411
|
+
|
|
412
|
+
check_expired_cookies()
|
|
413
|
+
return false
|
|
414
|
+
end
|
|
415
|
+
|
|
416
|
+
def load_cookies()
|
|
417
|
+
return if !File.readable?(@cookies_file)
|
|
418
|
+
File.open(@cookies_file,'r'){|f|
|
|
419
|
+
while line = f.gets
|
|
420
|
+
cookie = WebAgent::Cookie.new()
|
|
421
|
+
@cookies << cookie
|
|
422
|
+
col = line.chomp.split(/\t/)
|
|
423
|
+
cookie.url = URI.parse(col[0])
|
|
424
|
+
cookie.name = col[1]
|
|
425
|
+
cookie.value = col[2]
|
|
426
|
+
cookie.expires = Time.at(col[3].to_i)
|
|
427
|
+
cookie.domain = col[4]
|
|
428
|
+
cookie.path = col[5]
|
|
429
|
+
cookie.set_flag(col[6])
|
|
430
|
+
end
|
|
431
|
+
}
|
|
432
|
+
end
|
|
433
|
+
|
|
434
|
+
def check_cookie_accept_domain(domain)
|
|
435
|
+
unless domain
|
|
436
|
+
return false
|
|
437
|
+
end
|
|
438
|
+
@accept_domains.each{|dom|
|
|
439
|
+
if domain_match(domain, dom)
|
|
440
|
+
return true
|
|
441
|
+
end
|
|
442
|
+
}
|
|
443
|
+
@reject_domains.each{|dom|
|
|
444
|
+
if domain_match(domain, dom)
|
|
445
|
+
return false
|
|
446
|
+
end
|
|
447
|
+
}
|
|
448
|
+
return true
|
|
449
|
+
end
|
|
450
|
+
end
|
|
451
|
+
end
|
|
452
|
+
|
|
453
|
+
__END__
|
|
454
|
+
|
|
455
|
+
=begin
|
|
456
|
+
|
|
457
|
+
== WebAgent::CookieManager Class
|
|
458
|
+
|
|
459
|
+
Load, save, parse and send cookies.
|
|
460
|
+
|
|
461
|
+
=== Usage
|
|
462
|
+
|
|
463
|
+
## initialize
|
|
464
|
+
cm = WebAgent::CookieManager.new("/home/foo/bar/cookie")
|
|
465
|
+
|
|
466
|
+
## load cookie data
|
|
467
|
+
cm.load_cookies()
|
|
468
|
+
|
|
469
|
+
## parse cookie from string (maybe "Set-Cookie:" header)
|
|
470
|
+
cm.parse(str)
|
|
471
|
+
|
|
472
|
+
## send cookie data to url
|
|
473
|
+
f.write(cm.find(url))
|
|
474
|
+
|
|
475
|
+
## save cookie to cookiefile
|
|
476
|
+
cm.save_cookies()
|
|
477
|
+
|
|
478
|
+
|
|
479
|
+
=== Class Methods
|
|
480
|
+
|
|
481
|
+
-- CookieManager::new(file=nil)
|
|
482
|
+
|
|
483
|
+
create new CookieManager. If a file is provided,
|
|
484
|
+
use it as cookies' file.
|
|
485
|
+
|
|
486
|
+
=== Methods
|
|
487
|
+
|
|
488
|
+
-- CookieManager#save_cookies(force = nil)
|
|
489
|
+
|
|
490
|
+
save cookies' data into file. if argument is true,
|
|
491
|
+
save data although data is not modified.
|
|
492
|
+
|
|
493
|
+
-- CookieManager#parse(str, url)
|
|
494
|
+
|
|
495
|
+
parse string and store cookie (to parse HTTP response header).
|
|
496
|
+
|
|
497
|
+
-- CookieManager#find(url)
|
|
498
|
+
|
|
499
|
+
get cookies and make into string (to send as HTTP request header).
|
|
500
|
+
|
|
501
|
+
-- CookieManager#add(cookie)
|
|
502
|
+
|
|
503
|
+
add new cookie.
|
|
504
|
+
|
|
505
|
+
-- CookieManager#load_cookies()
|
|
506
|
+
|
|
507
|
+
load cookies' data from file.
|
|
508
|
+
|
|
509
|
+
|
|
510
|
+
== WebAgent::CookieUtils Module
|
|
511
|
+
|
|
512
|
+
-- CookieUtils::head_match?(str1, str2)
|
|
513
|
+
-- CookieUtils::tail_match?(str1, str2)
|
|
514
|
+
-- CookieUtils::domain_match(host, domain)
|
|
515
|
+
-- CookieUtils::total_dot_num(str)
|
|
516
|
+
|
|
517
|
+
|
|
518
|
+
== WebAgent::Cookie Class
|
|
519
|
+
|
|
520
|
+
=== Class Methods
|
|
521
|
+
|
|
522
|
+
-- Cookie::new()
|
|
523
|
+
|
|
524
|
+
create new cookie.
|
|
525
|
+
|
|
526
|
+
=== Methods
|
|
527
|
+
|
|
528
|
+
-- Cookie#match?(url)
|
|
529
|
+
|
|
530
|
+
match cookie by url. if match, return true. otherwise,
|
|
531
|
+
return false.
|
|
532
|
+
|
|
533
|
+
-- Cookie#name
|
|
534
|
+
-- Cookie#name=(name)
|
|
535
|
+
-- Cookie#value
|
|
536
|
+
-- Cookie#value=(value)
|
|
537
|
+
-- Cookie#domain
|
|
538
|
+
-- Cookie#domain=(domain)
|
|
539
|
+
-- Cookie#path
|
|
540
|
+
-- Cookie#path=(path)
|
|
541
|
+
-- Cookie#expires
|
|
542
|
+
-- Cookie#expires=(expires)
|
|
543
|
+
-- Cookie#url
|
|
544
|
+
-- Cookie#url=(url)
|
|
545
|
+
|
|
546
|
+
accessor methods for cookie's items.
|
|
547
|
+
|
|
548
|
+
-- Cookie#discard?
|
|
549
|
+
-- Cookie#discard=(discard)
|
|
550
|
+
-- Cookie#use?
|
|
551
|
+
-- Cookie#use=(use)
|
|
552
|
+
-- Cookie#secure?
|
|
553
|
+
-- Cookie#secure=(secure)
|
|
554
|
+
-- Cookie#domain_orig?
|
|
555
|
+
-- Cookie#domain_orig=(domain_orig)
|
|
556
|
+
-- Cookie#path_orig?
|
|
557
|
+
-- Cookie#path_orig=(path_orig)
|
|
558
|
+
-- Cookie#override?
|
|
559
|
+
-- Cookie#override=(override)
|
|
560
|
+
-- Cookie#flag
|
|
561
|
+
-- Cookie#set_flag(flag_num)
|
|
562
|
+
|
|
563
|
+
accessor methods for flags.
|
|
564
|
+
|
|
565
|
+
=end
|