facets 1.2.0 → 1.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +4 -3
- data/ProjectInfo +5 -2
- data/conf/facets/noauto +11 -11
- data/lib/facet/aspects.rb +1 -0
- data/lib/facet/float/round_off.rb +1 -0
- data/lib/facet/kernel/instance.rb +1 -0
- data/lib/facet/kernel/pp_exception.rb +1 -0
- data/lib/facet/module/cattr.rb +1 -0
- data/lib/facet/module/on_included.rb +1 -0
- data/lib/facet/nilclass/blank.rb +1 -0
- data/lib/facet/numeric/approx.rb +1 -0
- data/lib/facet/ostruct/instance.rb +1 -0
- data/lib/facets.rb +0 -1
- data/lib/facets/core/enumerable/every.rb +1 -5
- data/lib/facets/core/float.rb +1 -0
- data/lib/facets/core/float/approx.rb +2 -42
- data/lib/facets/core/float/round_at.rb +2 -1
- data/lib/facets/core/float/round_off.rb +8 -0
- data/lib/facets/core/float/round_to.rb +2 -1
- data/lib/facets/core/gem.rb +0 -3
- data/lib/facets/core/hash/inverse.rb +3 -1
- data/lib/facets/core/inflect.rb +3 -0
- data/lib/facets/core/kernel.rb +2 -2
- data/lib/facets/core/kernel/{__meta__.rb → instance.rb} +10 -9
- data/lib/facets/core/kernel/pp_exception.rb +17 -0
- data/lib/facets/core/module.rb +2 -0
- data/lib/facets/core/module/attr.rb +4 -1
- data/lib/facets/core/module/basename.rb +12 -1
- data/lib/facets/core/module/cattr.rb +180 -0
- data/lib/facets/core/module/cattr_accessor.rb +2 -141
- data/lib/facets/core/module/cattr_reader.rb +1 -1
- data/lib/facets/core/module/cattr_writer.rb +1 -1
- data/lib/facets/core/module/on_included.rb +48 -0
- data/lib/facets/core/module/wrap_method.rb +7 -2
- data/lib/facets/core/nilclass.rb +1 -1
- data/lib/facets/core/nilclass/{to_f.rb → blank.rb} +6 -6
- data/lib/facets/core/nilclass/op_cmp.rb +11 -0
- data/lib/facets/core/nilclass/succ.rb +5 -0
- data/lib/facets/core/numeric.rb +1 -0
- data/lib/facets/core/numeric/approx.rb +34 -0
- data/lib/facets/core/ostruct/__update__.rb +2 -2
- data/lib/facets/core/ostruct/instance.rb +37 -0
- data/lib/facets/core/string/modulize.rb +1 -1
- data/lib/facets/more/consoleapp.rb +27 -16
- data/lib/facets/more/crypt.rb +8 -4
- data/lib/facets/more/elementor.rb +104 -0
- data/lib/facets/more/expirable.rb +5 -0
- data/lib/facets/more/nilcomparable.rb +88 -31
- data/lib/facets/more/overload.rb +1 -1
- data/lib/facets/more/typecast.rb +12 -3
- data/test/FIXTURE/filelist/testfile.txt +0 -0
- data/test/FIXTURE/filelist/testfile2.txt +0 -0
- data/test/lib/{facet → facets/core}/array/test_at_rand.rb +3 -3
- data/test/lib/{facet → facets/core}/array/test_delete_unless.rb +3 -3
- data/test/lib/{facet → facets/core}/array/test_delete_values.rb +3 -3
- data/test/lib/{facet → facets/core}/array/test_delete_values_at.rb +3 -3
- data/test/lib/{facet → facets/core}/array/test_first.rb +3 -3
- data/test/lib/{facet → facets/core}/array/test_head.rb +3 -3
- data/test/lib/{facet → facets/core}/array/test_last_index.rb +3 -3
- data/test/lib/{facet → facets/core}/array/test_merge.rb +3 -3
- data/test/lib/{facet → facets/core}/array/test_mid.rb +3 -3
- data/test/lib/{facet → facets/core}/array/test_middle.rb +3 -3
- data/test/lib/{facet → facets/core}/array/test_op_fetch.rb +3 -3
- data/test/lib/{facet → facets/core}/array/test_op_store.rb +3 -3
- data/test/lib/{facet → facets/core}/array/test_pick.rb +3 -3
- data/test/lib/{facet → facets/core}/array/test_pos.rb +3 -3
- data/test/lib/{facet → facets/core}/array/test_pull.rb +3 -3
- data/test/lib/{facet → facets/core}/array/test_rand_index.rb +3 -3
- data/test/lib/{facet → facets/core}/array/test_rand_subset.rb +3 -3
- data/test/lib/{facet → facets/core}/array/test_range.rb +3 -3
- data/test/lib/{facet → facets/core}/array/test_rotate.rb +3 -3
- data/test/lib/{facet → facets/core}/array/test_select.rb +3 -3
- data/test/lib/{facet → facets/core}/array/test_shuffle.rb +3 -3
- data/test/lib/{facet → facets/core}/array/test_slap.rb +3 -3
- data/test/lib/{facet → facets/core}/array/test_thru.rb +3 -3
- data/test/lib/{facet → facets/core}/array/test_to_b.rb +3 -3
- data/test/lib/{facet → facets/core}/array/test_to_h.rb +3 -3
- data/test/lib/{facet → facets/core}/array/test_to_hash.rb +3 -3
- data/test/lib/{facet → facets/core}/binding/self/test_of_caller.rb +3 -3
- data/test/lib/{facet → facets/core}/binding/test___LINE__.rb +3 -3
- data/test/lib/{facet → facets/core}/binding/test_call_stack.rb +3 -3
- data/test/lib/{facet → facets/core}/binding/test_called.rb +3 -3
- data/test/lib/{facet → facets/core}/binding/test_caller.rb +3 -3
- data/test/lib/{facet → facets/core}/binding/test_defined.rb +3 -3
- data/test/lib/{facet → facets/core}/binding/test_eval.rb +3 -3
- data/test/lib/{facet → facets/core}/binding/test_local_variables.rb +3 -3
- data/test/lib/{facet → facets/core}/binding/test_method_name.rb +3 -3
- data/test/lib/{facet → facets/core}/binding/test_op_fetch.rb +3 -3
- data/test/lib/{facet → facets/core}/binding/test_op_store.rb +3 -3
- data/test/lib/{facet → facets/core}/binding/test_self.rb +3 -3
- data/test/lib/{facet → facets/core}/class/test_descendents.rb +3 -3
- data/test/lib/{facet → facets/core}/class/test_method_name.rb +3 -3
- data/test/lib/{facet → facets/core}/class/test_remove_descendents.rb +3 -3
- data/test/lib/{facet → facets/core}/class/test_unix_path.rb +3 -3
- data/test/lib/{facet → facets/core}/comparable/test_at_least.rb +3 -3
- data/test/lib/{facet → facets/core}/comparable/test_clip.rb +3 -3
- data/test/lib/{facet → facets/core}/comparable/test_cmp.rb +3 -3
- data/test/lib/{facet → facets/core}/continuation/self/test_create.rb +3 -3
- data/test/lib/{facet → facets/core}/date/test_days_in_month.rb +3 -3
- data/test/lib/{facet → facets/core}/date/test_days_of_month.rb +3 -3
- data/test/lib/{facet → facets/core}/date/test_stamp.rb +3 -3
- data/test/lib/{facet → facets/core}/date/test_to_date.rb +3 -3
- data/test/lib/{facet → facets/core}/date/test_to_s.rb +3 -3
- data/test/lib/{facet → facets/core}/date/test_to_time.rb +3 -3
- data/test/lib/{facet → facets/core}/dir/self/test_ancestor.rb +3 -3
- data/test/lib/{facet → facets/core}/dir/self/test_ascend.rb +3 -3
- data/test/lib/{facet → facets/core}/dir/self/test_ls_r.rb +3 -3
- data/test/lib/{facet → facets/core}/enumerable/self/test_combinations.rb +3 -3
- data/test/lib/{facet → facets/core}/enumerable/self/test_cross.rb +3 -3
- data/test/lib/{facet → facets/core}/enumerable/test_collect_with_index.rb +3 -3
- data/test/lib/{facet → facets/core}/enumerable/test_commonality.rb +3 -3
- data/test/lib/{facet → facets/core}/enumerable/test_compact_collect.rb +3 -3
- data/test/lib/{facet → facets/core}/enumerable/test_cross.rb +3 -3
- data/test/lib/{facet → facets/core}/enumerable/test_each_combination.rb +3 -3
- data/test/lib/{facet → facets/core}/enumerable/test_each_pair.rb +3 -3
- data/test/lib/{facet → facets/core}/enumerable/test_each_slice.rb +3 -3
- data/test/lib/{facet → facets/core}/enumerable/test_each_unique_pair.rb +3 -3
- data/test/lib/{facet → facets/core}/enumerable/test_entropy.rb +3 -3
- data/test/lib/{facet → facets/core}/enumerable/test_every.rb +3 -3
- data/test/lib/{facet → facets/core}/enumerable/test_ew.rb +3 -3
- data/test/lib/{facet → facets/core}/enumerable/test_filter_collect.rb +3 -3
- data/test/lib/{facet → facets/core}/enumerable/test_find_collisions.rb +3 -3
- data/test/lib/{facet → facets/core}/enumerable/test_frequency.rb +3 -3
- data/test/lib/{facet → facets/core}/enumerable/test_graph.rb +3 -3
- data/test/lib/{facet → facets/core}/enumerable/test_ideal_entropy.rb +3 -3
- data/test/lib/{facet → facets/core}/enumerable/test_none.rb +3 -3
- data/test/lib/{facet → facets/core}/enumerable/test_occur.rb +3 -3
- data/test/lib/{facet → facets/core}/enumerable/test_one.rb +3 -3
- data/test/lib/{facet → facets/core}/enumerable/test_op_pow.rb +3 -3
- data/test/lib/{facet → facets/core}/enumerable/test_partition_by.rb +3 -3
- data/test/lib/{facet → facets/core}/enumerable/test_permute.rb +3 -3
- data/test/lib/{facet → facets/core}/enumerable/test_probability.rb +3 -3
- data/test/lib/{facet → facets/core}/enumerable/test_to_h.rb +3 -3
- data/test/lib/{facet → facets/core}/enumerable/test_uniq_by.rb +3 -3
- data/test/lib/{facet → facets/core}/file/self/test_create.rb +3 -3
- data/test/lib/{facet → facets/core}/file/self/test_open_as_string.rb +3 -3
- data/test/lib/{facet → facets/core}/file/self/test_read_list.rb +3 -3
- data/test/lib/{facet → facets/core}/file/self/test_sanitize.rb +3 -3
- data/test/lib/{facet → facets/core}/file/self/test_split_all.rb +3 -3
- data/test/lib/{facet → facets/core}/fileutils/test_wc.rb +3 -3
- data/test/lib/{facet → facets/core}/fileutils/test_which.rb +3 -3
- data/test/lib/{facet → facets/core}/float/test_approx.rb +3 -3
- data/test/lib/{facet → facets/core}/float/test_round_at.rb +3 -3
- data/test/lib/{facet → facets/core}/float/test_round_to.rb +3 -3
- data/test/lib/{facet → facets/core}/hash/self/test_zipnew.rb +3 -3
- data/test/lib/{facet → facets/core}/hash/test_alias.rb +3 -3
- data/test/lib/{facet → facets/core}/hash/test_assert_has_keys.rb +3 -3
- data/test/lib/{facet → facets/core}/hash/test_assert_has_only_keys.rb +3 -3
- data/test/lib/{facet → facets/core}/hash/test_at.rb +3 -3
- data/test/lib/{facet → facets/core}/hash/test_collate.rb +3 -3
- data/test/lib/{facet → facets/core}/hash/test_each.rb +3 -3
- data/test/lib/{facet → facets/core}/hash/test_each_with_index.rb +3 -3
- data/test/lib/{facet → facets/core}/hash/test_each_with_key.rb +3 -3
- data/test/lib/{facet → facets/core}/hash/test_graph.rb +3 -3
- data/test/lib/{facet → facets/core}/hash/test_has_keys.rb +3 -3
- data/test/lib/{facet → facets/core}/hash/test_has_only_keys.rb +3 -3
- data/test/lib/{facet → facets/core}/hash/test_inverse.rb +6 -4
- data/test/lib/{facet → facets/core}/hash/test_keys_to_s.rb +3 -3
- data/test/lib/{facet → facets/core}/hash/test_keys_to_sym.rb +3 -3
- data/test/lib/{facet → facets/core}/hash/test_op_fetch.rb +3 -3
- data/test/lib/{facet → facets/core}/hash/test_op_lshift.rb +3 -3
- data/test/lib/{facet → facets/core}/hash/test_rand_key.rb +3 -3
- data/test/lib/{facet → facets/core}/hash/test_rand_pair.rb +3 -3
- data/test/lib/{facet → facets/core}/hash/test_rand_value.rb +3 -3
- data/test/lib/{facet → facets/core}/hash/test_replace_each.rb +3 -3
- data/test/lib/{facet → facets/core}/hash/test_shuffle.rb +3 -3
- data/test/lib/{facet → facets/core}/hash/test_slice.rb +3 -3
- data/test/lib/{facet → facets/core}/hash/test_swap.rb +3 -3
- data/test/lib/{facet → facets/core}/hash/test_swapkey.rb +3 -3
- data/test/lib/{facet → facets/core}/hash/test_to_h.rb +3 -3
- data/test/lib/{facet → facets/core}/hash/test_to_ostruct.rb +3 -3
- data/test/lib/{facet → facets/core}/hash/test_to_ostruct_recurse.rb +3 -3
- data/test/lib/{facet → facets/core}/hash/test_traverse.rb +3 -3
- data/test/lib/{facet → facets/core}/hash/test_update_each.rb +3 -3
- data/test/lib/{facet → facets/core}/hash/test_update_keys.rb +3 -3
- data/test/lib/{facet → facets/core}/hash/test_update_values.rb +3 -3
- data/test/lib/{facet → facets/core}/hash/test_weave.rb +3 -3
- data/test/lib/{facet → facets/core}/integer/test_factorial.rb +3 -3
- data/test/lib/{facet → facets/core}/integer/test_multiple.rb +3 -3
- data/test/lib/{facet → facets/core}/integer/test_ordinal.rb +3 -3
- data/test/lib/{facet → facets/core}/integer/test_times_collect.rb +3 -3
- data/test/lib/{facet → facets/core}/kernel/test___class__.rb +3 -3
- data/test/lib/{facet → facets/core}/kernel/test_as.rb +3 -3
- data/test/lib/{facet → facets/core}/kernel/test_assign_from.rb +3 -3
- data/test/lib/{facet → facets/core}/kernel/test_assign_with.rb +3 -3
- data/test/lib/{facet → facets/core}/kernel/test_bool.rb +3 -3
- data/test/lib/{facet → facets/core}/kernel/test_bug.rb +3 -3
- data/test/lib/{facet → facets/core}/kernel/test_call_stack.rb +3 -3
- data/test/lib/{facet → facets/core}/kernel/test_called.rb +3 -3
- data/test/lib/{facet → facets/core}/kernel/test_constant.rb +3 -3
- data/test/lib/{facet → facets/core}/kernel/test_copy.rb +3 -3
- data/test/lib/{facet → facets/core}/kernel/test_deep_copy.rb +3 -3
- data/test/lib/{facet → facets/core}/kernel/test_demo.rb +3 -3
- data/test/lib/{facet → facets/core}/kernel/test_fn.rb +3 -3
- data/test/lib/{facet → facets/core}/kernel/test_generate_method_name.rb +3 -3
- data/test/lib/{facet → facets/core}/kernel/test_get_by_id.rb +3 -3
- data/test/lib/{facet → facets/core}/kernel/test_here.rb +3 -3
- data/test/lib/{facet → facets/core}/kernel/test_in.rb +3 -3
- data/test/lib/{facet → facets/core}/kernel/test_maybe.rb +3 -3
- data/test/lib/{facet → facets/core}/kernel/test_metaclass.rb +3 -3
- data/test/lib/{facet → facets/core}/kernel/test_method.rb +3 -3
- data/test/lib/{facet → facets/core}/kernel/test_method_name.rb +3 -3
- data/test/lib/{facet → facets/core}/kernel/test_methods.rb +3 -3
- data/test/lib/{facet → facets/core}/kernel/test_new.rb +3 -3
- data/test/lib/{facet → facets/core}/kernel/test_object_class.rb +3 -3
- data/test/lib/{facet → facets/core}/kernel/test_object_hexid.rb +3 -3
- data/test/lib/{facet → facets/core}/kernel/test_require_all.rb +3 -3
- data/test/lib/{facet → facets/core}/kernel/test_require_esc.rb +3 -3
- data/test/lib/{facet → facets/core}/kernel/test_require_facet.rb +3 -3
- data/test/lib/{facet → facets/core}/kernel/test_resc.rb +3 -3
- data/test/lib/{facet → facets/core}/kernel/test_returning.rb +3 -3
- data/test/lib/{facet → facets/core}/kernel/test_send_as.rb +3 -3
- data/test/lib/{facet → facets/core}/kernel/test_set_from.rb +3 -3
- data/test/lib/{facet → facets/core}/kernel/test_set_with.rb +3 -3
- data/test/lib/{facet → facets/core}/kernel/test_silently.rb +3 -3
- data/test/lib/{facet → facets/core}/kernel/test_singleton.rb +3 -3
- data/test/lib/{facet → facets/core}/kernel/test_superior.rb +3 -3
- data/test/lib/{facet → facets/core}/kernel/test_supermethod.rb +3 -3
- data/test/lib/{facet → facets/core}/kernel/test_this.rb +3 -3
- data/test/lib/{facet → facets/core}/kernel/test_to_b.rb +3 -3
- data/test/lib/{facet → facets/core}/kernel/test_to_bool.rb +3 -3
- data/test/lib/{facet → facets/core}/kernel/test_uri.rb +3 -3
- data/test/lib/{facet → facets/core}/kernel/test_val.rb +3 -3
- data/test/lib/{facet → facets/core}/kernel/test_with_accessor.rb +3 -3
- data/test/lib/{facet → facets/core}/matchdata/test_match.rb +3 -3
- data/test/lib/{facet → facets/core}/matchdata/test_matchtree.rb +3 -3
- data/test/lib/{facet → facets/core}/module/test_abstract.rb +3 -3
- data/test/lib/{facet → facets/core}/module/test_alias_module_function.rb +3 -3
- data/test/lib/{facet → facets/core}/module/test_ancestor.rb +3 -3
- data/test/lib/{facet → facets/core}/module/test_basename.rb +3 -3
- data/test/lib/{facet → facets/core}/module/test_by_name.rb +3 -3
- data/test/lib/{facet → facets/core}/module/test_cattr_accessor.rb +3 -3
- data/test/lib/{facet → facets/core}/module/test_clone_using.rb +3 -3
- data/test/lib/{facet → facets/core}/module/test_dirname.rb +3 -3
- data/test/lib/{facet → facets/core}/module/test_equate_on.rb +3 -3
- data/test/lib/{facet → facets/core}/module/test_generate_instance_method_name.rb +3 -3
- data/test/lib/{facet → facets/core}/module/test_include_as.rb +3 -3
- data/test/lib/{facet → facets/core}/module/test_initializer.rb +3 -3
- data/test/lib/{facet → facets/core}/module/test_instance_methods.rb +3 -3
- data/test/lib/{facet → facets/core}/module/test_integrate.rb +3 -3
- data/test/lib/{facet → facets/core}/module/test_memoize.rb +3 -3
- data/test/lib/{facet → facets/core}/module/test_modspace.rb +3 -3
- data/test/lib/{facet → facets/core}/module/test_namespace.rb +3 -3
- data/test/lib/{facet → facets/core}/module/test_nesting.rb +3 -3
- data/test/lib/{facet → facets/core}/module/test_redef.rb +3 -3
- data/test/lib/{facet → facets/core}/module/test_redefine_method.rb +3 -3
- data/test/lib/{facet → facets/core}/module/test_redirect.rb +3 -3
- data/test/lib/{facet → facets/core}/module/test_redirect_method.rb +3 -3
- data/test/lib/{facet → facets/core}/module/test_remove.rb +3 -3
- data/test/lib/{facet → facets/core}/module/test_rename.rb +3 -3
- data/test/lib/{facet → facets/core}/module/test_rename_method.rb +3 -3
- data/test/lib/{facet → facets/core}/module/test_revisal.rb +3 -3
- data/test/lib/{facet → facets/core}/module/test_shadow_method.rb +3 -3
- data/test/lib/{facet → facets/core}/module/test_sort_on.rb +3 -3
- data/test/lib/{facet → facets/core}/module/test_undef.rb +3 -3
- data/test/lib/{facet → facets/core}/module/test_wrap.rb +3 -3
- data/test/lib/{facet → facets/core}/module/test_wrap_method.rb +3 -3
- data/test/lib/{facet → facets/core}/nilclass/test_empty.rb +3 -3
- data/test/lib/{facet → facets/core}/nilclass/test_include.rb +3 -3
- data/test/lib/{facet → facets/core}/nilclass/test_op_fetch.rb +3 -3
- data/test/lib/{facet → facets/core}/nilclass/test_size.rb +3 -3
- data/test/lib/{facet → facets/core}/nilclass/test_to_f.rb +3 -3
- data/test/lib/{facet → facets/core}/nilclass/test_to_h.rb +3 -3
- data/test/lib/{facet → facets/core}/numeric/test_ceil_multiple.rb +3 -3
- data/test/lib/{facet → facets/core}/numeric/test_succ.rb +3 -3
- data/test/lib/{facet → facets/core}/numeric/test_to_b.rb +3 -3
- data/test/lib/{facet → facets/core}/ostruct/test___merge__.rb +3 -3
- data/test/lib/{facet → facets/core}/ostruct/test___update__.rb +3 -3
- data/test/lib/{facet → facets/core}/ostruct/test_op_fetch.rb +3 -3
- data/test/lib/{facet → facets/core}/ostruct/test_op_store.rb +3 -3
- data/test/lib/{facet → facets/core}/proc/test_compose.rb +3 -3
- data/test/lib/{facet → facets/core}/proc/test_to_method.rb +3 -3
- data/test/lib/{facet → facets/core}/range/test_to_r.rb +3 -3
- data/test/lib/{facet → facets/core}/range/test_to_range.rb +3 -3
- data/test/lib/{facet → facets/core}/range/test_umbrella.rb +3 -3
- data/test/lib/{facet → facets/core}/range/test_within.rb +3 -3
- data/test/lib/{facet → facets/core}/regexp/test_arity.rb +3 -3
- data/test/lib/{facet → facets/core}/regexp/test_to_re.rb +3 -3
- data/test/lib/{facet → facets/core}/regexp/test_to_regexp.rb +3 -3
- data/test/lib/{facet → facets/core}/string/self/test_interpolate.rb +3 -3
- data/test/lib/{facet → facets/core}/string/self/test_patterns.rb +3 -3
- data/test/lib/{facet → facets/core}/string/self/test_rand_letter.rb +3 -3
- data/test/lib/{facet → facets/core}/string/test_align_center.rb +3 -3
- data/test/lib/{facet → facets/core}/string/test_at_rand.rb +3 -3
- data/test/lib/{facet → facets/core}/string/test_basename.rb +3 -3
- data/test/lib/{facet → facets/core}/string/test_blank.rb +3 -3
- data/test/lib/{facet → facets/core}/string/test_bracket.rb +3 -3
- data/test/lib/{facet → facets/core}/string/test_camelcase.rb +3 -3
- data/test/lib/{facet → facets/core}/string/test_camelize.rb +3 -3
- data/test/lib/{facet → facets/core}/string/test_capitalized.rb +3 -3
- data/test/lib/{facet → facets/core}/string/test_chars.rb +3 -3
- data/test/lib/{facet → facets/core}/string/test_cmp.rb +3 -3
- data/test/lib/{facet → facets/core}/string/test_demodulize.rb +3 -3
- data/test/lib/{facet → facets/core}/string/test_downcase.rb +3 -3
- data/test/lib/{facet → facets/core}/string/test_dresner.rb +3 -3
- data/test/lib/{facet → facets/core}/string/test_each_char.rb +3 -3
- data/test/lib/{facet → facets/core}/string/test_each_word.rb +3 -3
- data/test/lib/{facet → facets/core}/string/test_first.rb +3 -3
- data/test/lib/{facet → facets/core}/string/test_fold.rb +3 -3
- data/test/lib/{facet → facets/core}/string/test_frequency.rb +3 -3
- data/test/lib/{facet → facets/core}/string/test_humanize.rb +3 -3
- data/test/lib/{facet → facets/core}/string/test_indent.rb +3 -3
- data/test/lib/{facet → facets/core}/string/test_index_all.rb +3 -3
- data/test/lib/{facet → facets/core}/string/test_last.rb +3 -3
- data/test/lib/{facet → facets/core}/string/test_line_wrap.rb +3 -3
- data/test/lib/{facet → facets/core}/string/test_lines.rb +3 -3
- data/test/lib/{facet → facets/core}/string/test_lowercase.rb +3 -3
- data/test/lib/{facet → facets/core}/string/test_margin.rb +3 -3
- data/test/lib/{facet → facets/core}/string/test_methodize.rb +3 -3
- data/test/lib/{facet → facets/core}/string/test_modulize.rb +3 -3
- data/test/lib/{facet → facets/core}/string/test_mscan.rb +3 -3
- data/test/lib/{facet → facets/core}/string/test_natcmp.rb +3 -3
- data/test/lib/{facet → facets/core}/string/test_nchar.rb +3 -3
- data/test/lib/{facet → facets/core}/string/test_pathize.rb +3 -3
- data/test/lib/{facet → facets/core}/string/test_pop.rb +3 -3
- data/test/lib/{facet → facets/core}/string/test_probability.rb +3 -3
- data/test/lib/{facet → facets/core}/string/test_push.rb +3 -3
- data/test/lib/{facet → facets/core}/string/test_quote.rb +3 -3
- data/test/lib/{facet → facets/core}/string/test_rand_byte.rb +3 -3
- data/test/lib/{facet → facets/core}/string/test_rand_index.rb +3 -3
- data/test/lib/{facet → facets/core}/string/test_range.rb +3 -3
- data/test/lib/{facet → facets/core}/string/test_range_all.rb +3 -3
- data/test/lib/{facet → facets/core}/string/test_range_of_line.rb +3 -3
- data/test/lib/{facet → facets/core}/string/test_regesc.rb +3 -3
- data/test/lib/{facet → facets/core}/string/test_shatter.rb +3 -3
- data/test/lib/{facet → facets/core}/string/test_shift.rb +3 -3
- data/test/lib/{facet → facets/core}/string/test_shuffle.rb +3 -3
- data/test/lib/{facet → facets/core}/string/test_similarity.rb +3 -3
- data/test/lib/{facet → facets/core}/string/test_singular.rb +3 -3
- data/test/lib/{facet → facets/core}/string/test_slap.rb +3 -3
- data/test/lib/{facet → facets/core}/string/test_soundex.rb +3 -3
- data/test/lib/{facet → facets/core}/string/test_succ.rb +3 -3
- data/test/lib/{facet → facets/core}/string/test_to_a.rb +3 -3
- data/test/lib/{facet → facets/core}/string/test_to_arr.rb +3 -3
- data/test/lib/{facet → facets/core}/string/test_to_b.rb +3 -3
- data/test/lib/{facet → facets/core}/string/test_to_const.rb +3 -3
- data/test/lib/{facet → facets/core}/string/test_to_date.rb +3 -3
- data/test/lib/{facet → facets/core}/string/test_to_proc.rb +3 -3
- data/test/lib/{facet → facets/core}/string/test_to_re.rb +3 -3
- data/test/lib/{facet → facets/core}/string/test_to_time.rb +3 -3
- data/test/lib/{facet → facets/core}/string/test_unix_crypt.rb +3 -3
- data/test/lib/{facet → facets/core}/string/test_unpack.rb +3 -3
- data/test/lib/{facet → facets/core}/string/test_unshift.rb +3 -3
- data/test/lib/{facet → facets/core}/string/test_upcase.rb +3 -3
- data/test/lib/{facet → facets/core}/string/test_whitespace.rb +3 -3
- data/test/lib/{facet → facets/core}/string/test_word_filter.rb +3 -3
- data/test/lib/{facet → facets/core}/string/test_word_wrap.rb +3 -3
- data/test/lib/{facet → facets/core}/string/test_words.rb +3 -3
- data/test/lib/{facet → facets/core}/symbol/test_camelcase.rb +3 -3
- data/test/lib/{facet → facets/core}/symbol/test_camelize.rb +3 -3
- data/test/lib/{facet → facets/core}/symbol/test_capitalize.rb +3 -3
- data/test/lib/{facet → facets/core}/symbol/test_capitalized.rb +3 -3
- data/test/lib/{facet → facets/core}/symbol/test_downcase.rb +3 -3
- data/test/lib/{facet → facets/core}/symbol/test_not.rb +3 -3
- data/test/lib/{facet → facets/core}/symbol/test_pad.rb +3 -3
- data/test/lib/{facet → facets/core}/symbol/test_succ.rb +3 -3
- data/test/lib/{facet → facets/core}/symbol/test_to_const.rb +3 -3
- data/test/lib/{facet → facets/core}/symbol/test_to_proc.rb +3 -3
- data/test/lib/{facet → facets/core}/symbol/test_to_str.rb +3 -3
- data/test/lib/{facet → facets/core}/symbol/test_underscore.rb +3 -3
- data/test/lib/{facet → facets/core}/symbol/test_upcase.rb +3 -3
- data/test/lib/{facet → facets/core}/time/test_change.rb +3 -3
- data/test/lib/{facet → facets/core}/time/test_elapse.rb +3 -3
- data/test/lib/{facet → facets/core}/time/test_stamp.rb +3 -3
- data/test/lib/{facet → facets/core}/time/test_to_date.rb +3 -3
- data/test/lib/{facet → facets/core}/time/test_to_s.rb +3 -3
- data/test/lib/{facet → facets/core}/time/test_to_time.rb +3 -3
- data/test/lib/facets/more/test_annotation.rb +217 -0
- data/test/lib/facets/more/test_ansicode.rb +36 -0
- data/test/lib/facets/more/test_association.rb +46 -0
- data/test/lib/facets/more/test_bbcode.rb +34 -0
- data/test/lib/facets/more/test_bitmask.rb +47 -0
- data/test/lib/facets/more/test_bytes.rb +84 -0
- data/test/lib/facets/more/test_classinherit.rb +65 -0
- data/test/lib/facets/more/test_classmethods.rb +65 -0
- data/test/lib/facets/more/test_coroutine.rb +60 -0
- data/test/lib/facets/more/test_crypt.rb +46 -0
- data/test/lib/facets/more/test_dictionary.rb +97 -0
- data/test/lib/facets/more/test_enumerablepass.rb +86 -0
- data/test/lib/facets/more/test_floatstring.rb +36 -0
- data/test/lib/facets/more/test_functor.rb +39 -0
- data/test/lib/facets/more/test_inheritor.rb +155 -0
- data/test/lib/facets/more/test_interval.rb +119 -0
- data/test/lib/facets/more/test_lisp.rb +47 -0
- data/test/lib/facets/more/test_lisp_format.rb +37 -0
- data/test/lib/facets/more/test_lrucache.rb +25 -0
- data/test/lib/facets/more/test_mathconstants.rb +18 -0
- data/test/lib/facets/more/test_methodprobe.rb +53 -0
- data/test/lib/facets/more/test_multipliers.rb +114 -0
- data/test/lib/facets/more/test_multiton.rb +200 -0
- data/test/lib/facets/more/test_nackclass.rb +45 -0
- data/test/lib/facets/more/test_nilcomparable.rb +43 -0
- data/test/lib/facets/more/test_openobject.rb +66 -0
- data/test/lib/facets/more/test_overload.rb +54 -0
- data/test/lib/facets/more/test_paramix.rb +100 -0
- data/test/lib/facets/more/test_preinitialize.rb +49 -0
- data/test/lib/facets/more/test_promoteself.rb +45 -0
- data/test/lib/facets/more/test_snapshot.rb +34 -0
- data/test/lib/facets/more/test_statichash.rb +31 -0
- data/test/lib/facets/more/test_syncarray.rb +28 -0
- data/test/lib/facets/more/test_synchash.rb +28 -0
- data/test/lib/facets/more/test_tagiterator.rb +93 -0
- data/test/lib/facets/more/test_timer.rb +66 -0
- data/test/lib/facets/more/test_times.rb +73 -0
- data/test/lib/facets/more/test_tuple.rb +32 -0
- data/test/lib/facets/more/test_typecast.rb +65 -0
- data/test/lib/facets/more/test_uninheritable.rb +42 -0
- data/test/lib/facets/more/test_units.rb +104 -0
- data/test/lib/facets/more/test_yamlstruct.rb +37 -0
- metadata +416 -357
- data/lib/facet/kernel/__meta__.rb +0 -1
- data/lib/facet/kernel/meta.rb +0 -1
- data/lib/facet/nilclass/to_f.rb +0 -1
- data/lib/facets/core/kernel/meta.rb +0 -2
- data/test/lib/facet/fileutils/test_slice.rb +0 -96
@@ -1,141 +1,2 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
#++
|
4
|
-
|
5
|
-
class Module
|
6
|
-
|
7
|
-
# Creates a class-variable attr_reader that can
|
8
|
-
# be accessed both on an instance and class level.
|
9
|
-
#
|
10
|
-
# class MyClass
|
11
|
-
# @@a = 10
|
12
|
-
# cattr_reader :a
|
13
|
-
# end
|
14
|
-
#
|
15
|
-
# MyClass.a #=> 10
|
16
|
-
# MyClass.new.a #=> 10
|
17
|
-
#
|
18
|
-
def cattr_reader(*syms)
|
19
|
-
hsyms = ( syms.last.is_a?(Hash) ? syms.pop : {} )
|
20
|
-
hsyms.update( Hash[*(syms.zip([nil]*syms.size).flatten)] )
|
21
|
-
hsyms.each_pair do |sym, val|
|
22
|
-
class_eval <<-EOS
|
23
|
-
if ! defined? @@#{sym}
|
24
|
-
@@#{sym} = val
|
25
|
-
end
|
26
|
-
def self.#{sym}
|
27
|
-
@@#{sym}
|
28
|
-
end
|
29
|
-
def #{sym}
|
30
|
-
self.class.#{sym}
|
31
|
-
end
|
32
|
-
EOS
|
33
|
-
end
|
34
|
-
return hsyms.keys
|
35
|
-
end
|
36
|
-
|
37
|
-
# Creates a class-variable attr_writer that can
|
38
|
-
# be accessed both on an instance and class level.
|
39
|
-
#
|
40
|
-
# class MyClass
|
41
|
-
# cattr_writer :a
|
42
|
-
# def a
|
43
|
-
# @@a
|
44
|
-
# end
|
45
|
-
# end
|
46
|
-
#
|
47
|
-
# MyClass.a = 10
|
48
|
-
# MyClass.a #=> 10
|
49
|
-
# MyClass.new.a = 29
|
50
|
-
# MyClass.a #=> 29
|
51
|
-
#
|
52
|
-
def cattr_writer(*syms)
|
53
|
-
hsyms = ( syms.last.is_a?(Hash) ? syms.pop : {} )
|
54
|
-
hsyms.update( Hash[*(syms.zip([nil]*syms.size).flatten)] )
|
55
|
-
hsyms.each_pair do |sym, val|
|
56
|
-
class_eval <<-EOS
|
57
|
-
if ! defined? @@#{sym}
|
58
|
-
@@#{sym} = val
|
59
|
-
end
|
60
|
-
def self.#{sym}=(obj)
|
61
|
-
@@#{sym} = obj
|
62
|
-
end
|
63
|
-
def #{sym}=(obj)
|
64
|
-
self.class.#{sym}=(obj)
|
65
|
-
end
|
66
|
-
EOS
|
67
|
-
end
|
68
|
-
return hsyms.keys
|
69
|
-
end
|
70
|
-
|
71
|
-
# Creates a class-variable attr_accessor that can
|
72
|
-
# be accessed both on an instance and class level.
|
73
|
-
#
|
74
|
-
# class MyClass
|
75
|
-
# cattr_accessor :a
|
76
|
-
# end
|
77
|
-
#
|
78
|
-
# MyClass.a = 10
|
79
|
-
# MyClass.a #=> 10
|
80
|
-
# mc = MyClass.new
|
81
|
-
# mc.a #=> 10
|
82
|
-
#
|
83
|
-
def cattr_accessor(*syms)
|
84
|
-
m = []
|
85
|
-
m.concat( cattr_reader(*syms) )
|
86
|
-
m.concat( cattr_writer(*syms) )
|
87
|
-
m
|
88
|
-
end
|
89
|
-
|
90
|
-
end
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
# _____ _
|
95
|
-
# |_ _|__ ___| |_
|
96
|
-
# | |/ _ \/ __| __|
|
97
|
-
# | | __/\__ \ |_
|
98
|
-
# |_|\___||___/\__|
|
99
|
-
#
|
100
|
-
=begin test
|
101
|
-
|
102
|
-
require 'test/unit'
|
103
|
-
|
104
|
-
class TCModule < Test::Unit::TestCase
|
105
|
-
|
106
|
-
class MockObject
|
107
|
-
def initialize
|
108
|
-
@@a = 10
|
109
|
-
end
|
110
|
-
def b ; @@b ; end
|
111
|
-
end
|
112
|
-
|
113
|
-
def test_cattr_reader
|
114
|
-
assert_nothing_raised {
|
115
|
-
MockObject.class_eval { cattr_reader :a }
|
116
|
-
}
|
117
|
-
t = MockObject.new
|
118
|
-
assert_equal( 10, t.a )
|
119
|
-
end
|
120
|
-
|
121
|
-
def test_cattr_writer
|
122
|
-
assert_nothing_raised {
|
123
|
-
MockObject.class_eval { cattr_writer :b }
|
124
|
-
}
|
125
|
-
t = MockObject.new
|
126
|
-
t.b = 5
|
127
|
-
assert_equal( 5, t.b )
|
128
|
-
end
|
129
|
-
|
130
|
-
def test_cattr_accessor
|
131
|
-
assert_nothing_raised {
|
132
|
-
MockObject.class_eval { cattr_accessor :c }
|
133
|
-
}
|
134
|
-
t = MockObject.new
|
135
|
-
t.c = 50
|
136
|
-
assert_equal( 50, t.c )
|
137
|
-
end
|
138
|
-
|
139
|
-
end
|
140
|
-
|
141
|
-
=end
|
1
|
+
# stub
|
2
|
+
require 'facets/core/module/cattr.rb'
|
@@ -1,2 +1,2 @@
|
|
1
1
|
# stub
|
2
|
-
require 'facet/module/
|
2
|
+
require 'facet/module/cattr.rb'
|
@@ -1,2 +1,2 @@
|
|
1
1
|
# stub
|
2
|
-
require 'facet/module/
|
2
|
+
require 'facet/module/cattr.rb'
|
@@ -0,0 +1,48 @@
|
|
1
|
+
# George Moschovitis <gm@navel.gr>
|
2
|
+
|
3
|
+
class Module
|
4
|
+
|
5
|
+
# A useful macro for dynamic modules.
|
6
|
+
#--
|
7
|
+
# FIXME: quick and easy implementation, should
|
8
|
+
# come up with something better. The name
|
9
|
+
# sucks too.
|
10
|
+
#++
|
11
|
+
def on_included(code)
|
12
|
+
tag = caller[0].split(' ').first.split(/\/|\\/).last.gsub(/:|\.|\(|\)/, '_')
|
13
|
+
old = "__included_#{tag}"
|
14
|
+
module_eval %{
|
15
|
+
class << self
|
16
|
+
alias_method :#{old}, :included
|
17
|
+
def included(base)
|
18
|
+
#{old}(base)
|
19
|
+
#{code}
|
20
|
+
end
|
21
|
+
end
|
22
|
+
}
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
=begin Testing
|
27
|
+
|
28
|
+
module M
|
29
|
+
on_included %{
|
30
|
+
puts 'hello'
|
31
|
+
}
|
32
|
+
end
|
33
|
+
|
34
|
+
module Q
|
35
|
+
on_included %{
|
36
|
+
puts 'world'
|
37
|
+
}
|
38
|
+
on_included %{
|
39
|
+
puts 'it works'
|
40
|
+
}
|
41
|
+
end
|
42
|
+
|
43
|
+
class C
|
44
|
+
include M
|
45
|
+
include Q
|
46
|
+
end
|
47
|
+
|
48
|
+
=end
|
@@ -1,5 +1,9 @@
|
|
1
1
|
class Module
|
2
|
-
|
2
|
+
|
3
|
+
# Don't think we should bother making this private.
|
4
|
+
# That sort of defeats some of the AOP usefulness of this.
|
5
|
+
#private
|
6
|
+
|
3
7
|
# Creates a new method wrapping the previous of
|
4
8
|
# the same name. Reference to the old method
|
5
9
|
# is passed into the new definition block
|
@@ -12,13 +16,14 @@ class Module
|
|
12
16
|
#
|
13
17
|
# Keep in mind that this can not be used to wrap methods
|
14
18
|
# that take a block.
|
15
|
-
|
19
|
+
|
16
20
|
def wrap_method( sym, &blk )
|
17
21
|
raise ArgumentError, "method does not exist" unless method_defined?( sym )
|
18
22
|
old = instance_method(sym)
|
19
23
|
undef_method(sym)
|
20
24
|
define_method(sym) { |*args| blk.call(old.bind(self), *args) }
|
21
25
|
end
|
26
|
+
|
22
27
|
end
|
23
28
|
|
24
29
|
|
data/lib/facets/core/nilclass.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
|
+
require 'facets/core/nilclass/blank'
|
1
2
|
require 'facets/core/nilclass/empty'
|
2
3
|
require 'facets/core/nilclass/include'
|
3
4
|
require 'facets/core/nilclass/length'
|
4
5
|
require 'facets/core/nilclass/op_fetch'
|
5
6
|
require 'facets/core/nilclass/size'
|
6
|
-
require 'facets/core/nilclass/to_f'
|
7
7
|
require 'facets/core/nilclass/to_h'
|
@@ -1,16 +1,16 @@
|
|
1
1
|
|
2
2
|
class NilClass
|
3
3
|
|
4
|
-
#
|
4
|
+
# Allows <tt>nil</tt> to respond to #blank? method.
|
5
|
+
# Alwasy returns <tt>true</tt>.
|
5
6
|
#
|
6
|
-
# nil.
|
7
|
+
# nil.blank? #=> true
|
7
8
|
#
|
8
|
-
def
|
9
|
+
def blank? ; true ; end
|
9
10
|
|
10
11
|
end
|
11
12
|
|
12
13
|
|
13
|
-
|
14
14
|
# _____ _
|
15
15
|
# |_ _|__ ___| |_
|
16
16
|
# | |/ _ \/ __| __|
|
@@ -23,8 +23,8 @@ end
|
|
23
23
|
|
24
24
|
class TCNilClass < Test::Unit::TestCase
|
25
25
|
|
26
|
-
def
|
27
|
-
|
26
|
+
def test_blank?
|
27
|
+
assert( nil.blank? )
|
28
28
|
end
|
29
29
|
|
30
30
|
end
|
data/lib/facets/core/numeric.rb
CHANGED
@@ -0,0 +1,34 @@
|
|
1
|
+
|
2
|
+
class Numeric
|
3
|
+
# Determines if another number is approximately equal
|
4
|
+
# within a given _n_th degree. Defaults to 100ths
|
5
|
+
# if the degree is not specified.
|
6
|
+
def approx?( x, n=0.01 )
|
7
|
+
return(self == x) if n == 0
|
8
|
+
(self - x).abs <= n
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
|
13
|
+
# _____ _
|
14
|
+
# |_ _|__ ___| |_
|
15
|
+
# | |/ _ \/ __| __|
|
16
|
+
# | | __/\__ \ |_
|
17
|
+
# |_|\___||___/\__|
|
18
|
+
#
|
19
|
+
=begin test
|
20
|
+
|
21
|
+
require 'test/unit'
|
22
|
+
|
23
|
+
class TCFloat < Test::Unit::TestCase
|
24
|
+
|
25
|
+
def test_approx?
|
26
|
+
f = 10.006
|
27
|
+
assert( f.approx?(10.01) )
|
28
|
+
assert( f.approx?(10, 0.1) )
|
29
|
+
assert( 100.4.approx?(100.6, 1) )
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
33
|
+
|
34
|
+
=end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
|
2
|
+
require 'facet/core/kernel/instance'
|
3
|
+
|
4
|
+
class OpenStruct
|
5
|
+
|
6
|
+
# Intercepts some methods to apply to the inner table
|
7
|
+
# rather then be defined as part of the open members.
|
8
|
+
# As with Kernel#instance all other methods are passed
|
9
|
+
# on to the Kernel binding.
|
10
|
+
#
|
11
|
+
# o = OpenStruct.new
|
12
|
+
# o.a = 1
|
13
|
+
# o.b = 2
|
14
|
+
# o.instance.each { |k, v| puts "#{k} #{v}" }
|
15
|
+
#
|
16
|
+
# produces
|
17
|
+
#
|
18
|
+
# a 1
|
19
|
+
# b 2
|
20
|
+
#
|
21
|
+
# Methods supported:
|
22
|
+
# store, fetch, merge, update, each, key?
|
23
|
+
#
|
24
|
+
|
25
|
+
def instance
|
26
|
+
Functor.new { |op, *args|
|
27
|
+
case op
|
28
|
+
when :[], :[]=, :store, :fetch, :merge, :update,
|
29
|
+
:each, :key?
|
30
|
+
@table.send(op,*args)
|
31
|
+
else
|
32
|
+
super(op,*args) # send(op,*args)
|
33
|
+
end
|
34
|
+
}
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
@@ -23,6 +23,8 @@
|
|
23
23
|
#
|
24
24
|
#++
|
25
25
|
|
26
|
+
module Console ; end
|
27
|
+
|
26
28
|
#:title: Console Application
|
27
29
|
#
|
28
30
|
# Console::Application provides a clean and easy way
|
@@ -65,13 +67,14 @@
|
|
65
67
|
# JUMP! JUMP! JUMP!
|
66
68
|
#
|
67
69
|
|
68
|
-
module Console ; end
|
69
|
-
|
70
70
|
class Console::Application
|
71
71
|
|
72
72
|
def go
|
73
|
+
|
73
74
|
i = 0; args = ARGV.dup
|
75
|
+
|
74
76
|
while i < ARGV.size
|
77
|
+
# options
|
75
78
|
if md = %r{^[-]}.match( ARGV[i] )
|
76
79
|
opt = ARGV[i].gsub('-','_')
|
77
80
|
if self.respond_to?( opt )
|
@@ -93,29 +96,37 @@ class Console::Application
|
|
93
96
|
i += 1
|
94
97
|
end
|
95
98
|
|
96
|
-
#
|
99
|
+
# Non-secondary command type of application
|
100
|
+
|
97
101
|
if self.respond_to?(:main)
|
98
|
-
main(*args)
|
99
|
-
exit 0
|
100
|
-
|
102
|
+
main( *args )
|
103
|
+
#exit 0
|
104
|
+
|
105
|
+
# secondary command type of application
|
101
106
|
|
102
|
-
|
103
|
-
if args.first
|
107
|
+
elsif not args.empty?
|
104
108
|
if self.respond_to?( args.first )
|
105
109
|
__send__( *args )
|
106
110
|
else
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
111
|
+
if self.private_methods.include?( "no_command_error" )
|
112
|
+
no_command_error( *args )
|
113
|
+
else
|
114
|
+
$stderr << "Non-applicable command #{args.join(' ')}\n"
|
115
|
+
exit -1
|
116
|
+
end
|
113
117
|
end
|
118
|
+
|
114
119
|
elsif self.respond_to?( :default )
|
115
120
|
default(*args)
|
121
|
+
|
116
122
|
else
|
117
|
-
|
118
|
-
|
123
|
+
if self.private_methods.include?( "no_action_error" )
|
124
|
+
no_action_error( *args )
|
125
|
+
else
|
126
|
+
$stderr << "Nothing to do.\n"
|
127
|
+
exit -1
|
128
|
+
end
|
129
|
+
|
119
130
|
end
|
120
131
|
|
121
132
|
end #def go
|