facets 1.3.1 → 1.3.2
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +7 -1
- data/ProjectInfo +4 -3
- data/data/facets/index.yml +1 -4
- data/lib/facet/gem/self/gemdir.rb +1 -0
- data/lib/facet/htmlbuilder.rb +1 -0
- data/lib/facet/htmlhelper.rb +1 -0
- data/lib/facet/xmlbuilder.rb +1 -0
- data/lib/facet/xmlhelper.rb +1 -0
- data/lib/facets/core/class/cattr.rb +25 -42
- data/lib/facets/core/gem.rb +1 -0
- data/lib/facets/core/gem/self/gemdir.rb +12 -0
- data/lib/facets/core/gem/self/gempath.rb +8 -2
- data/lib/facets/core/kernel/as.rb +3 -1
- data/lib/facets/core/module.rb +0 -4
- data/lib/facets/more/aspects.rb +29 -37
- data/lib/facets/more/basicobject.rb +69 -30
- data/lib/facets/more/builderobject.rb +41 -158
- data/lib/facets/more/downloader.rb +1 -1
- data/lib/facets/more/functor.rb +1 -0
- data/lib/facets/more/htmlbuilder.rb +83 -0
- data/lib/facets/more/htmlhelper.rb +9 -0
- data/lib/facets/more/multiton.rb +1 -4
- data/lib/facets/more/rexmlbuilder.rb +169 -13
- data/lib/facets/more/tuple.rb +3 -2
- data/lib/facets/more/xmlbuilder.rb +83 -0
- data/lib/facets/more/xmlhelper.rb +171 -0
- 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_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 +1 -1
- 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_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_undef.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_annotation.rb +1 -1
- data/test/lib/facets/more/test_ansicode.rb +1 -1
- data/test/lib/facets/more/test_association.rb +1 -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_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 +38 -0
- 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 -2
- 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_openobject.rb +1 -1
- 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_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 +1 -1
- 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_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 +38 -0
- data/test/lib/facets/more/test_xmlhelper.rb +40 -0
- data/test/lib/facets/more/test_xoxo.rb +1 -1
- data/test/lib/facets/more/test_yamlstruct.rb +1 -1
- metadata +17 -17
- data/lib/facet/module/mattr.rb +0 -1
- data/lib/facet/module/mattr_accessor.rb +0 -1
- data/lib/facet/module/mattr_reader.rb +0 -1
- data/lib/facet/module/mattr_writer.rb +0 -1
- data/lib/facets/core/module/mattr.rb +0 -180
- data/lib/facets/core/module/mattr_accessor.rb +0 -2
- data/lib/facets/core/module/mattr_reader.rb +0 -2
- data/lib/facets/core/module/mattr_writer.rb +0 -2
- data/test/lib/facets/core/array/test_slap.rb +0 -28
- data/test/lib/facets/core/module/test_let.rb +0 -31
- data/test/lib/facets/core/module/test_mattr.rb +0 -71
- data/test/lib/facets/core/string/test_slap.rb +0 -40
- data/test/lib/facets/core/string/test_to_arr.rb +0 -26
data/CHANGELOG
CHANGED
@@ -3,10 +3,16 @@
|
|
3
3
|
== 1.3.1
|
4
4
|
* Deprecated string/to_arr, and slightly adjusted string#to_a.
|
5
5
|
(Not commonly used so not a major change.)
|
6
|
+
* Minor bug fixes.
|
6
7
|
|
7
8
|
== 1.3.0
|
9
|
+
* Ported parts of Nitro's Glue library to Facets.
|
10
|
+
* more/aspects.rb
|
11
|
+
* core/module/on_included.rb
|
12
|
+
* core/module/expirable.rb
|
13
|
+
* core/enumerable/accumulate.rb
|
8
14
|
* Added xoxo.rb, json.rb and rtals.rb.
|
9
|
-
*
|
15
|
+
* Repaired missing data files for units.rb.
|
10
16
|
* Moved cattr methods from module/ to class/.
|
11
17
|
* mattr methods are in limbo at the moment.
|
12
18
|
(They were aliases for cattr.)
|
data/ProjectInfo
CHANGED
@@ -2,8 +2,8 @@
|
|
2
2
|
|
3
3
|
title : Facets
|
4
4
|
name : facets
|
5
|
-
version : '1.3.
|
6
|
-
date : '2006-04-17'
|
5
|
+
version : '1.3.2'
|
6
|
+
#date : '2006-04-17'
|
7
7
|
status : Beta/Stable
|
8
8
|
|
9
9
|
author : Thomas Sawyer
|
@@ -43,7 +43,7 @@ package:
|
|
43
43
|
- web
|
44
44
|
- note
|
45
45
|
|
46
|
-
|
46
|
+
extest:
|
47
47
|
files: 'lib/facets/**/*.rb'
|
48
48
|
|
49
49
|
rdoc:
|
@@ -81,4 +81,5 @@ announce:
|
|
81
81
|
links:
|
82
82
|
- http://facets.rubyforge.org
|
83
83
|
|
84
|
+
install: ~
|
84
85
|
|
data/data/facets/index.yml
CHANGED
@@ -92,10 +92,6 @@ module:
|
|
92
92
|
- instance_methods
|
93
93
|
- integrate
|
94
94
|
- is
|
95
|
-
- mattr
|
96
|
-
- mattr_accessor
|
97
|
-
- mattr_reader
|
98
|
-
- mattr_writer
|
99
95
|
- memoize
|
100
96
|
- modspace
|
101
97
|
- namespace
|
@@ -223,6 +219,7 @@ date:
|
|
223
219
|
- to_time
|
224
220
|
gem:
|
225
221
|
- self/active
|
222
|
+
- self/gemdir
|
226
223
|
- self/gempath
|
227
224
|
- self/gemspec
|
228
225
|
proc:
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'facets/core/gem/self/gemdir.rb'
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'facets/more/htmlbuilder.rb'
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'facets/more/htmlhelper.rb'
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'facets/more/xmlbuilder.rb'
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'facets/more/xmlhelper.rb'
|
@@ -1,37 +1,27 @@
|
|
1
1
|
#--
|
2
|
-
#
|
2
|
+
# Credit for original goes to David Heinemeier Hansson.
|
3
3
|
#++
|
4
4
|
|
5
|
-
class
|
5
|
+
class Class
|
6
6
|
|
7
7
|
# Creates a class-variable attribute that can
|
8
8
|
# be accessed both on an instance and class level.
|
9
9
|
#
|
10
|
-
# NOTE
|
11
|
-
#
|
12
|
-
#
|
13
|
-
#
|
14
|
-
#
|
15
|
-
# The mattr methods are more versitile.
|
10
|
+
# NOTE These used to be a Module methods. But turns out
|
11
|
+
# these to work as expected when included. The class-level
|
12
|
+
# method is not carried along. So the are now just class
|
13
|
+
# methods. Accordingly, #mattr will eventually be deprecated
|
14
|
+
# so use #cattr instead.
|
16
15
|
|
17
16
|
def cattr( *syms )
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
true
|
25
|
-
else
|
26
|
-
false
|
27
|
-
end
|
28
|
-
end
|
29
|
-
if writer
|
30
|
-
cattr_accessor( *syms )
|
31
|
-
else
|
32
|
-
cattr_reader( *syms )
|
33
|
-
end
|
17
|
+
accessors, readers = syms.flatten.partition { |a| a.to_s =~ /=$/ }
|
18
|
+
writers = accessors.collect{ |e| e.to_s.chomp('=').to_sym }
|
19
|
+
readers.concat( writers )
|
20
|
+
cattr_writer( *writers )
|
21
|
+
cattr_reader( *readers )
|
22
|
+
return readers + accessors
|
34
23
|
end
|
24
|
+
alias_method :mattr, :cattr # deprecate
|
35
25
|
|
36
26
|
# Creates a class-variable attr_reader that can
|
37
27
|
# be accessed both on an instance and class level.
|
@@ -45,23 +35,19 @@ class Module
|
|
45
35
|
# MyClass.new.a #=> 10
|
46
36
|
#
|
47
37
|
def cattr_reader( *syms )
|
48
|
-
|
49
|
-
|
50
|
-
hsyms.each_pair do |sym, val|
|
51
|
-
class_eval <<-EOS
|
52
|
-
if ! defined? @@#{sym}
|
53
|
-
@@#{sym} = val
|
54
|
-
end
|
38
|
+
syms.flatten.each do |sym|
|
39
|
+
class_eval(<<-EOS, __FILE__, __LINE__)
|
55
40
|
def self.#{sym}
|
56
41
|
@@#{sym}
|
57
42
|
end
|
58
43
|
def #{sym}
|
59
|
-
|
44
|
+
@@#{sym}
|
60
45
|
end
|
61
46
|
EOS
|
62
47
|
end
|
63
|
-
return
|
48
|
+
return syms
|
64
49
|
end
|
50
|
+
alias_method :mattr_reader, :cattr_reader # deprecate
|
65
51
|
|
66
52
|
# Creates a class-variable attr_writer that can
|
67
53
|
# be accessed both on an instance and class level.
|
@@ -79,23 +65,19 @@ class Module
|
|
79
65
|
# MyClass.a #=> 29
|
80
66
|
#
|
81
67
|
def cattr_writer(*syms)
|
82
|
-
|
83
|
-
|
84
|
-
hsyms.each_pair do |sym, val|
|
85
|
-
class_eval <<-EOS
|
86
|
-
if ! defined? @@#{sym}
|
87
|
-
@@#{sym} = val
|
88
|
-
end
|
68
|
+
syms.flatten.each do |sym|
|
69
|
+
class_eval(<<-EOS, __FILE__, __LINE__)
|
89
70
|
def self.#{sym}=(obj)
|
90
71
|
@@#{sym} = obj
|
91
72
|
end
|
92
73
|
def #{sym}=(obj)
|
93
|
-
|
74
|
+
@@#{sym}=(obj)
|
94
75
|
end
|
95
76
|
EOS
|
96
77
|
end
|
97
|
-
return
|
78
|
+
return syms
|
98
79
|
end
|
80
|
+
alias_method :mattr_writer, :cattr_writer # deprecate
|
99
81
|
|
100
82
|
# Creates a class-variable attr_accessor that can
|
101
83
|
# be accessed both on an instance and class level.
|
@@ -115,6 +97,7 @@ class Module
|
|
115
97
|
m.concat( cattr_writer(*syms) )
|
116
98
|
m
|
117
99
|
end
|
100
|
+
alias_method :mattr_accessor, :cattr_accessor # deprecate
|
118
101
|
|
119
102
|
end
|
120
103
|
|
data/lib/facets/core/gem.rb
CHANGED
@@ -3,8 +3,14 @@ require 'facet/gem/self/active'
|
|
3
3
|
|
4
4
|
module Gem
|
5
5
|
|
6
|
-
def self.gempath(gemname)
|
7
|
-
|
6
|
+
def self.gempath(gemname, subdir=nil)
|
7
|
+
if active?(gemname)
|
8
|
+
if subdir
|
9
|
+
File.join( @loaded_specs[gemname].full_gem_path, subdir )
|
10
|
+
else
|
11
|
+
@loaded_specs[gemname].full_gem_path
|
12
|
+
end
|
13
|
+
end
|
8
14
|
end
|
9
15
|
|
10
16
|
end
|
@@ -19,7 +19,7 @@ module Kernel
|
|
19
19
|
#
|
20
20
|
# C.new.x #=> 1
|
21
21
|
#
|
22
|
-
def
|
22
|
+
def __as__( klass=nil, &blk )
|
23
23
|
selfclass = Kernel.instance_method(:class).bind(self).call
|
24
24
|
klass ||= selfclass.superclass
|
25
25
|
if selfclass.ancestors.include?(klass)
|
@@ -31,6 +31,8 @@ module Kernel
|
|
31
31
|
end
|
32
32
|
end
|
33
33
|
|
34
|
+
alias_method :as, :__as__
|
35
|
+
|
34
36
|
=begin :nodoc:
|
35
37
|
def as( role, &blk )
|
36
38
|
unless role.is_a?(Class)
|
data/lib/facets/core/module.rb
CHANGED
@@ -20,10 +20,6 @@ require 'facets/core/module/initializer'
|
|
20
20
|
require 'facets/core/module/instance_methods'
|
21
21
|
require 'facets/core/module/integrate'
|
22
22
|
require 'facets/core/module/is'
|
23
|
-
require 'facets/core/module/mattr'
|
24
|
-
require 'facets/core/module/mattr_accessor'
|
25
|
-
require 'facets/core/module/mattr_reader'
|
26
|
-
require 'facets/core/module/mattr_writer'
|
27
23
|
require 'facets/core/module/memoize'
|
28
24
|
require 'facets/core/module/modspace'
|
29
25
|
require 'facets/core/module/namespace'
|
data/lib/facets/more/aspects.rb
CHANGED
@@ -1,7 +1,5 @@
|
|
1
1
|
require 'facet/inheritor'
|
2
2
|
|
3
|
-
module Glue
|
4
|
-
|
5
3
|
# An Aspect is a class that defines advices.
|
6
4
|
|
7
5
|
class Aspect
|
@@ -30,7 +28,7 @@ end
|
|
30
28
|
# wrap Benchmark, :on => :index
|
31
29
|
# post :taraa, :on => login
|
32
30
|
# end
|
33
|
-
#
|
31
|
+
#
|
34
32
|
# module Timestamped
|
35
33
|
# pre :on => :og_insert { |this| this.create_time = Time.now }
|
36
34
|
# pre :on => :og_update { |this| this.update_time = Time.now }
|
@@ -48,12 +46,12 @@ module Aspects
|
|
48
46
|
|
49
47
|
def self.wrap(target, methods = target.instance_methods)
|
50
48
|
include_advice_modules(target)
|
51
|
-
|
49
|
+
|
52
50
|
for m in [methods].flatten
|
53
51
|
args = []
|
54
52
|
target.instance_method(m).arity.times { |i| args << "a#{i}" }
|
55
53
|
args = args.join(',')
|
56
|
-
|
54
|
+
|
57
55
|
target.module_eval <<-end_eval, __FILE__, __LINE__
|
58
56
|
alias_method :__unwrapped_#{m}, :#{m}
|
59
57
|
def #{m}(#{args})
|
@@ -74,11 +72,11 @@ module Aspects
|
|
74
72
|
def self.include_advice_modules(target)
|
75
73
|
add_advices = []
|
76
74
|
del_advices = []
|
77
|
-
|
75
|
+
|
78
76
|
for a in target.advices
|
79
77
|
if a.code.is_a?(Module) and (!a.code.class.ancestors.include?(Class))
|
80
78
|
target.module_eval %{ include #{a.code} }
|
81
|
-
|
79
|
+
|
82
80
|
options = a.options.reject { |k,v| k == :pre || k == :post }
|
83
81
|
|
84
82
|
method = (a.options[:pre] || 'pre').to_s
|
@@ -86,32 +84,32 @@ module Aspects
|
|
86
84
|
options.update(:where => :prepend, :join => :pre)
|
87
85
|
add_advices << Advice.new(method.to_sym, options)
|
88
86
|
end
|
89
|
-
|
87
|
+
|
90
88
|
method = (a.options[:post] || 'post').to_s
|
91
89
|
if a.code.instance_methods.include?(method)
|
92
90
|
options.update(:where => :append, :join => :post)
|
93
91
|
add_advices << Advice.new(method.to_sym, options)
|
94
92
|
end
|
95
|
-
|
93
|
+
|
96
94
|
del_advices << a
|
97
95
|
end
|
98
96
|
end
|
99
97
|
|
100
98
|
# Delete the original advices.
|
101
|
-
|
99
|
+
|
102
100
|
for a in del_advices
|
103
101
|
target.advices!.delete(a)
|
104
102
|
end
|
105
|
-
|
103
|
+
|
106
104
|
# Add the new advices.
|
107
|
-
|
105
|
+
|
108
106
|
target.advices!.concat(add_advices)
|
109
107
|
end
|
110
108
|
|
111
109
|
# Generates the code to call the aspects.
|
112
|
-
|
110
|
+
|
113
111
|
def self.gen_advice_code(method, advices, join = :pre) # :nodoc:
|
114
|
-
code = ''
|
112
|
+
code = ''
|
115
113
|
|
116
114
|
advices.each_with_index do |advice, idx|
|
117
115
|
o = options = advice.options
|
@@ -121,7 +119,7 @@ module Aspects
|
|
121
119
|
elsif except = options[:except]
|
122
120
|
next if [except].flatten.include?(method.to_sym)
|
123
121
|
end
|
124
|
-
|
122
|
+
|
125
123
|
advice = advice.code
|
126
124
|
|
127
125
|
if advice.is_a?(Symbol) or advice.is_a?(String)
|
@@ -144,9 +142,9 @@ module Aspects
|
|
144
142
|
end
|
145
143
|
end
|
146
144
|
end
|
147
|
-
|
145
|
+
|
148
146
|
return code
|
149
|
-
end
|
147
|
+
end
|
150
148
|
|
151
149
|
def self.append_features(base)
|
152
150
|
super
|
@@ -155,7 +153,7 @@ module Aspects
|
|
155
153
|
end
|
156
154
|
|
157
155
|
module ClassMethods
|
158
|
-
|
156
|
+
|
159
157
|
# Add a pre (before) advice.
|
160
158
|
|
161
159
|
def pre(*args, &block)
|
@@ -170,17 +168,15 @@ module Aspects
|
|
170
168
|
else
|
171
169
|
new_advices = args.collect { |a| Advice.new(a, options) }
|
172
170
|
end
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
end
|
179
|
-
=end
|
171
|
+
# if options[:where] == :prepend
|
172
|
+
# self.advices = advices + self.advices
|
173
|
+
# else
|
174
|
+
# self.advices = self.advices + advices
|
175
|
+
# end
|
180
176
|
self.advices!.concat(new_advices)
|
181
177
|
end
|
182
178
|
alias_method :before, :pre
|
183
|
-
|
179
|
+
|
184
180
|
# Add a post (after) advice.
|
185
181
|
|
186
182
|
def post(*args, &block)
|
@@ -195,20 +191,18 @@ module Aspects
|
|
195
191
|
else
|
196
192
|
new_advices = args.collect { |a| Advice.new(a, options) }
|
197
193
|
end
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
end
|
204
|
-
=end
|
194
|
+
# if options[:where] == :prepend
|
195
|
+
# self.advices = advices + self.advices
|
196
|
+
# else
|
197
|
+
# self.advices = self.advices + advices
|
198
|
+
# end
|
205
199
|
self.advices!.concat(new_advices)
|
206
200
|
end
|
207
201
|
alias_method :after, :post
|
208
202
|
|
209
203
|
# Add a wrap (arround) aspect. An aspect is a class that
|
210
204
|
# responds to the before and after advices.
|
211
|
-
|
205
|
+
|
212
206
|
def wrap(*args)
|
213
207
|
o = options = {
|
214
208
|
:pre => :pre,
|
@@ -223,8 +217,6 @@ module Aspects
|
|
223
217
|
alias_method :around, :wrap
|
224
218
|
alias_method :observer, :wrap
|
225
219
|
|
226
|
-
end
|
227
|
-
|
228
|
-
end
|
220
|
+
end
|
229
221
|
|
230
222
|
end
|
@@ -16,16 +16,16 @@
|
|
16
16
|
# ==========================================================================
|
17
17
|
# Revision History
|
18
18
|
# ==========================================================================
|
19
|
-
# 2006.04.03
|
20
|
-
# *
|
19
|
+
# 2006.04.03 trans
|
20
|
+
# * Got rid of ^object_ exclusion.
|
21
21
|
#
|
22
|
-
# 2005.10.26
|
23
|
-
# *
|
22
|
+
# 2005.10.26 trans
|
23
|
+
# * Preserved a few addtional methods --everyhting ending in ?, dup and
|
24
24
|
# object_id.
|
25
|
-
# *
|
25
|
+
# * Changed name from BlankSlate to BasicObject
|
26
26
|
#
|
27
27
|
# 2005.04.28 trans
|
28
|
-
# *
|
28
|
+
# * Ported from BlankSlate and added __class__.
|
29
29
|
# ==========================================================================
|
30
30
|
#
|
31
31
|
# TODO Might be nice it there were a factory method to alter which methods
|
@@ -47,13 +47,13 @@ require 'facets/core/kernel/__class__'
|
|
47
47
|
#
|
48
48
|
# The pattern used to reserve methods is:
|
49
49
|
#
|
50
|
-
# /(^__|^instance_|^
|
50
|
+
# /(^__|^instance_|^initialize$|^null$|^inspect$|^dup$|^clone$\?$)/
|
51
51
|
#
|
52
52
|
# By default these are the reserved methods:
|
53
53
|
#
|
54
|
-
# __id__ __class__ __self__ __send__ dup eql? equal? frozen?
|
55
|
-
# instance_of? instance_variable_get instance_variable_set
|
56
|
-
# is_a? kind_of? nil? null
|
54
|
+
# __id__ __class__ __self__ __send__ clone dup eql? equal? frozen? initialize
|
55
|
+
# inspect instance_eval instance_of? instance_variable_get instance_variable_set
|
56
|
+
# instance_variables is_a? kind_of? nil? null respond_to? tainted?
|
57
57
|
#
|
58
58
|
# The special method #__self__ allows access to the underlying object via a
|
59
59
|
# specialized Functor-style class called, BasicObject::Self. This binds the
|
@@ -70,63 +70,102 @@ require 'facets/core/kernel/__class__'
|
|
70
70
|
|
71
71
|
class BasicObject
|
72
72
|
|
73
|
+
# The Self class allows one to get access the hidden Object/Kernel methods.
|
74
|
+
# It is essentially a specialized Functor which binds an Object/Kernel
|
75
|
+
# method to the current object for the current call.
|
76
|
+
|
77
|
+
class Self < self
|
78
|
+
def method_missing(meth, *args, &blk)
|
79
|
+
Object.instance_method(meth).bind(self).call(*args, &blk)
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
# Returns the Self functor class, which can then be used to
|
84
|
+
# call Kernel/Object methods on the current object.
|
85
|
+
|
86
|
+
def __self__
|
87
|
+
@__self__ ||= Self.new
|
88
|
+
end
|
89
|
+
|
90
|
+
# Shodow some important methods.
|
73
91
|
alias_method :__method__, :method
|
74
92
|
|
75
|
-
#
|
76
|
-
EXCLUDE =
|
93
|
+
# Methods not to get rid of. They are too important.
|
94
|
+
#EXCLUDE = /^(__|instance_eval$)/
|
95
|
+
EXCLUDE = /(^__|^instance_|^initialize$|^initialize_copy$|^null$|^inspect$|^dup$|^clone$|\?$)/
|
77
96
|
|
78
97
|
def self.hide(name)
|
79
98
|
#if instance_methods.include?(name.to_s) and name !~ EXCLUDE #/^(#{EXCLUDE.join('|')})/
|
80
|
-
if
|
99
|
+
if name !~ EXCLUDE and
|
100
|
+
( public_instance_methods.include?(name.to_s) or
|
101
|
+
private_instance_methods.include?(name.to_s) or
|
102
|
+
protected_instance_methods.include?(name.to_s)
|
103
|
+
)
|
81
104
|
undef_method name
|
82
105
|
end
|
83
106
|
end
|
84
107
|
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
Object.instance_method(meth).bind(self).call(*args) # ,&blk)
|
90
|
-
end
|
91
|
-
end
|
92
|
-
|
93
|
-
def __self__
|
94
|
-
@__self__ ||= Self.new
|
95
|
-
end
|
108
|
+
# remove all methods
|
109
|
+
public_instance_methods(true).each { |m| hide(m) }
|
110
|
+
private_instance_methods(true).each { |m| hide(m) }
|
111
|
+
protected_instance_methods(true).each { |m| hide(m) }
|
96
112
|
|
97
113
|
end
|
98
114
|
|
99
115
|
# Since Ruby is very dynamic, methods added to the ancestors of
|
100
116
|
# BasicObject <em>after BasicObject is defined</em> will show up in the
|
101
|
-
# list of available BasicObject methods. We handle this by defining
|
102
|
-
# in
|
117
|
+
# list of available BasicObject methods. We handle this by defining
|
118
|
+
# hooks in Object, Kernel and Module that will hide any defined.
|
103
119
|
|
104
120
|
module Kernel
|
105
121
|
class << self
|
106
122
|
madded = method(:method_added)
|
107
123
|
define_method(:method_added) do |name|
|
108
|
-
#return if name == :kernel_method_added
|
109
124
|
r = madded.call(name)
|
110
|
-
return if self != Kernel
|
125
|
+
return r if self != Kernel
|
111
126
|
BasicObject.hide(name)
|
112
127
|
r
|
113
128
|
end
|
114
129
|
end
|
115
130
|
end
|
116
131
|
|
132
|
+
# See Kernel callback.
|
133
|
+
|
117
134
|
class Object
|
118
135
|
class << self
|
119
136
|
madded = method(:method_added)
|
120
137
|
define_method(:method_added) do |name|
|
121
|
-
#return if name == :object_method_added
|
122
138
|
r = madded.call(name)
|
123
|
-
return if self != Object
|
139
|
+
return r if self != Object
|
124
140
|
BasicObject.hide(name)
|
125
141
|
r
|
126
142
|
end
|
127
143
|
end
|
128
144
|
end
|
129
145
|
|
146
|
+
# Also, modules included into Object need to be scanned and have their
|
147
|
+
# instance methods removed from blank slate. In theory, modules
|
148
|
+
# included into Kernel would have to be removed as well, but a
|
149
|
+
# "feature" of Ruby prevents late includes into modules from being
|
150
|
+
# exposed in the first place.
|
151
|
+
=begin
|
152
|
+
class Module
|
153
|
+
if method_defined?(:append_features)
|
154
|
+
mappended = method(:append_features)
|
155
|
+
else
|
156
|
+
mappended = nil
|
157
|
+
end
|
158
|
+
define_method(:append_features) do |mod|
|
159
|
+
r = mappended.call(mod) if mappended
|
160
|
+
return r if mod != Object
|
161
|
+
public_instance_methods(true).each { |name| BasicObject.hide(name) }
|
162
|
+
private_instance_methods(true).each { |name| BasicObject.hide(name) }
|
163
|
+
public_instance_methods(true).each { |name| BasicObject.hide(name) }
|
164
|
+
r
|
165
|
+
end
|
166
|
+
end
|
167
|
+
=end
|
168
|
+
|
130
169
|
|
131
170
|
# _____ _
|
132
171
|
# |_ _|__ ___| |_
|