facets 1.4.1 → 1.4.2
Sign up to get free protection for your applications and to get access to all the features.
- data/{test/FIXTURE → FIXTURE}/filelist/testfile.txt +0 -0
- data/{test/FIXTURE → FIXTURE}/filelist/testfile2.txt +0 -0
- data/{test/FIXTURE → FIXTURE}/ls_r/A.txt +0 -0
- data/{test/FIXTURE → FIXTURE}/ls_r/A/B.txt +0 -0
- data/{test/FIXTURE → FIXTURE}/ls_r/A/B/C.txt +0 -0
- data/{test/FIXTURE → FIXTURE}/test_file.txt +0 -0
- data/{test/FIXTURE → FIXTURE}/test_file2.txt +0 -0
- data/ProjectInfo +15 -2
- data/Reapfile +1 -1
- data/data/roll/facets/Libspec +17 -0
- data/forge/core/class/to_module.rb +3 -0
- data/forge/core/module/inherit.rb +79 -39
- data/forge/core/module/inherit0.rb +59 -0
- data/forge/core/module/to_module.rb +37 -0
- data/{lib/facets → forge}/core/string/frequency.rb +1 -0
- data/{lib/facets → forge}/core/string/probability.rb +1 -0
- data/forge/core/string/to_arr.rb +57 -0
- data/forge/more/capsule2.rb +152 -0
- data/{lib/facets → forge}/more/classinherit.rb +0 -2
- data/forge/more/clean.rb +35 -0
- data/forge/more/codepack.rb +16 -10
- data/lib/facet/command.rb +1 -0
- data/lib/facet/config/datadir.rb +1 -0
- data/lib/facet/file/self/rootname.rb +1 -0
- data/lib/facet/kernel/__callee__.rb +1 -0
- data/lib/facet/kernel/__method__.rb +1 -0
- data/lib/facet/kernel/quaclass.rb +1 -0
- data/lib/facet/kernel/singleton_class.rb +1 -0
- data/lib/facet/module/class_extension.rb +1 -0
- data/lib/facets/core/config/datadir.rb +20 -0
- data/lib/facets/core/file/self/rootname.rb +22 -0
- data/lib/facets/core/hash/to_ostruct_recurse.rb +4 -0
- data/lib/facets/core/kernel/__callee__.rb +2 -0
- data/lib/facets/core/kernel/__method__.rb +45 -0
- data/lib/facets/core/kernel/quaclass.rb +36 -0
- data/lib/facets/core/kernel/singleton_class.rb +36 -0
- data/lib/facets/core/module/class_extension.rb +153 -0
- data/lib/facets/core/symbol/to_proc.rb +12 -3
- data/lib/facets/more/annattr.rb +1 -0
- data/lib/facets/more/annotation.rb +12 -9
- data/lib/facets/more/basicobject.rb +8 -0
- data/lib/facets/more/classmethods.rb +17 -20
- data/lib/facets/more/command.rb +307 -0
- data/lib/facets/more/inheritor.rb +7 -3
- data/lib/facets/more/tuple.rb +61 -13
- data/lib/facets/more/typecast.rb +59 -58
- data/note/CHANGELOG +13 -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_count.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___method__.rb +26 -0
- 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_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_quaclass.rb +27 -0
- 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_singleton_class.rb +27 -0
- 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/{more/test_classinherit.rb → core/module/test_class_extension.rb} +13 -8
- 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_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_nodef.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_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_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_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 +8 -2
- 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 +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_binaryreader.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_classmethods.rb +8 -4
- data/test/lib/facets/more/test_command.rb +38 -0
- 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 +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_pqueue.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_taskable.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 +10 -2
- data/test/lib/facets/more/test_typecast.rb +7 -4
- 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 +1660 -2489
- data/lib/facet/classinherit.rb +0 -1
- data/lib/facet/consoleapp.rb +0 -1
- data/lib/facet/gem/self/gemdir.rb +0 -1
- data/lib/facet/kernel/me.rb +0 -1
- data/lib/facet/kernel/method_name.rb +0 -1
- data/lib/facet/kernel/methodname.rb +0 -1
- data/lib/facet/module/inherit.rb +0 -1
- data/lib/facet/module/singleton_to_module.rb +0 -1
- data/lib/facet/string/frequency.rb +0 -1
- data/lib/facet/string/probability.rb +0 -1
- data/lib/facets/core/gem/self/gemdir.rb +0 -12
- data/lib/facets/core/kernel/me.rb +0 -18
- data/lib/facets/core/kernel/method_name.rb +0 -2
- data/lib/facets/core/kernel/methodname.rb +0 -49
- data/lib/facets/core/module/inherit.rb +0 -70
- data/lib/facets/core/module/singleton_to_module.rb +0 -23
- data/lib/facets/more/consoleapp.rb +0 -167
- data/test/lib/facets/core/kernel/test_methodname.rb +0 -31
- data/test/lib/facets/core/module/test_inherit.rb +0 -58
- data/test/lib/facets/core/string/test_frequency.rb +0 -28
- data/test/lib/facets/core/string/test_probability.rb +0 -28
- data/test/lib/facets/more/test_annotatedattr.rb +0 -39
- data/web/doc/api/core/classes/Array.html +0 -1356
- data/web/doc/api/core/classes/Binding.html +0 -538
- data/web/doc/api/core/classes/Class.html +0 -475
- data/web/doc/api/core/classes/Comparable.html +0 -231
- data/web/doc/api/core/classes/Continuation.html +0 -168
- data/web/doc/api/core/classes/Date.html +0 -219
- data/web/doc/api/core/classes/Dir.html +0 -208
- data/web/doc/api/core/classes/Enumerable.html +0 -1435
- data/web/doc/api/core/classes/FalseClass.html +0 -115
- data/web/doc/api/core/classes/File.html +0 -349
- data/web/doc/api/core/classes/FileUtils.html +0 -468
- data/web/doc/api/core/classes/Float.html +0 -157
- data/web/doc/api/core/classes/Gem.html +0 -171
- data/web/doc/api/core/classes/Hash.html +0 -1657
- data/web/doc/api/core/classes/Integer.html +0 -353
- data/web/doc/api/core/classes/Kernal.html +0 -86
- data/web/doc/api/core/classes/Kernel.html +0 -1972
- data/web/doc/api/core/classes/Logger.html +0 -157
- data/web/doc/api/core/classes/MatchData.html +0 -195
- data/web/doc/api/core/classes/Module.html +0 -1712
- data/web/doc/api/core/classes/NackClass.html +0 -92
- data/web/doc/api/core/classes/NilClass.html +0 -332
- data/web/doc/api/core/classes/Numeric.html +0 -306
- data/web/doc/api/core/classes/Object.html +0 -332
- data/web/doc/api/core/classes/OpenStruct.html +0 -315
- data/web/doc/api/core/classes/Pathname.html +0 -154
- data/web/doc/api/core/classes/Proc.html +0 -154
- data/web/doc/api/core/classes/Range.html +0 -235
- data/web/doc/api/core/classes/Regexp.html +0 -185
- data/web/doc/api/core/classes/ScriptBug.html +0 -92
- data/web/doc/api/core/classes/String.html +0 -3286
- data/web/doc/api/core/classes/Symbol.html +0 -463
- data/web/doc/api/core/classes/Time.html +0 -307
- data/web/doc/api/core/classes/TrueClass.html +0 -115
- data/web/doc/api/core/classes/UnboundMethod.html +0 -121
- data/web/doc/api/core/created.rid +0 -1
- data/web/doc/api/core/files/AUTHORS.html +0 -206
- data/web/doc/api/core/files/COPYING.html +0 -517
- data/web/doc/api/core/files/README.html +0 -386
- data/web/doc/api/core/files/WARNING.html +0 -151
- data/web/doc/api/core/files/lib/facets/core/all_rb.html +0 -96
- data/web/doc/api/core/files/lib/facets/core/array/at_rand_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/array/body_rb.html +0 -100
- data/web/doc/api/core/files/lib/facets/core/array/delete_unless_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/array/delete_values_at_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/array/delete_values_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/array/each_with_key_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/array/first_rb.html +0 -96
- data/web/doc/api/core/files/lib/facets/core/array/foot_rb.html +0 -100
- data/web/doc/api/core/files/lib/facets/core/array/head_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/array/join_sentence_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/array/last_index_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/array/last_rb.html +0 -100
- data/web/doc/api/core/files/lib/facets/core/array/merge_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/array/mid_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/array/middle_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/array/op_fetch_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/array/op_mod_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/array/op_store_rb.html +0 -96
- data/web/doc/api/core/files/lib/facets/core/array/pick_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/array/pos_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/array/pot_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/array/pull_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/array/rand_index_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/array/rand_subset_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/array/range_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/array/rotate_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/array/select_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/array/shuffle_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/array/store_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/array/tail_rb.html +0 -100
- data/web/doc/api/core/files/lib/facets/core/array/thru_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/array/to_b_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/array/to_h_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/array/to_hash_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/array/unzip_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/binding/__DIR___rb.html +0 -100
- data/web/doc/api/core/files/lib/facets/core/binding/__FILE___rb.html +0 -100
- data/web/doc/api/core/files/lib/facets/core/binding/__LINE___rb.html +0 -96
- data/web/doc/api/core/files/lib/facets/core/binding/call_stack_rb.html +0 -97
- data/web/doc/api/core/files/lib/facets/core/binding/called_rb.html +0 -96
- data/web/doc/api/core/files/lib/facets/core/binding/caller_rb.html +0 -96
- data/web/doc/api/core/files/lib/facets/core/binding/defined_rb.html +0 -96
- data/web/doc/api/core/files/lib/facets/core/binding/eval_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/binding/local_variables_rb.html +0 -96
- data/web/doc/api/core/files/lib/facets/core/binding/method_name_rb.html +0 -96
- data/web/doc/api/core/files/lib/facets/core/binding/op_fetch_rb.html +0 -97
- data/web/doc/api/core/files/lib/facets/core/binding/op_store_rb.html +0 -97
- data/web/doc/api/core/files/lib/facets/core/binding/self/of_caller_rb.html +0 -96
- data/web/doc/api/core/files/lib/facets/core/binding/self_rb.html +0 -96
- data/web/doc/api/core/files/lib/facets/core/binding_rb.html +0 -109
- data/web/doc/api/core/files/lib/facets/core/class/by_name_rb.html +0 -96
- data/web/doc/api/core/files/lib/facets/core/class/cattr_accessor_rb.html +0 -100
- data/web/doc/api/core/files/lib/facets/core/class/cattr_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/class/cattr_reader_rb.html +0 -100
- data/web/doc/api/core/files/lib/facets/core/class/cattr_writer_rb.html +0 -100
- data/web/doc/api/core/files/lib/facets/core/class/descendents_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/class/method_name_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/class/remove_descendents_rb.html +0 -96
- data/web/doc/api/core/files/lib/facets/core/class/remove_subclasses_rb.html +0 -100
- data/web/doc/api/core/files/lib/facets/core/class/subclasses_rb.html +0 -100
- data/web/doc/api/core/files/lib/facets/core/class/to_proc_rb.html +0 -98
- data/web/doc/api/core/files/lib/facets/core/class/unix_path_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/comparable/at_least_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/comparable/at_most_rb.html +0 -100
- data/web/doc/api/core/files/lib/facets/core/comparable/cap_rb.html +0 -100
- data/web/doc/api/core/files/lib/facets/core/comparable/clip_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/comparable/cmp_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/continuation/self/create_rb.html +0 -148
- data/web/doc/api/core/files/lib/facets/core/date/days_in_month_rb.html +0 -96
- data/web/doc/api/core/files/lib/facets/core/date/days_of_month_rb.html +0 -96
- data/web/doc/api/core/files/lib/facets/core/date/stamp_rb.html +0 -96
- data/web/doc/api/core/files/lib/facets/core/date/to_date_rb.html +0 -96
- data/web/doc/api/core/files/lib/facets/core/date/to_s_rb.html +0 -96
- data/web/doc/api/core/files/lib/facets/core/date/to_time_rb.html +0 -96
- data/web/doc/api/core/files/lib/facets/core/dir/self/ancestor_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/dir/self/ascend_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/dir/self/descend_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/dir/self/ls_r_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/dir/self/recurse_rb.html +0 -100
- data/web/doc/api/core/files/lib/facets/core/enumerable/accumulate_rb.html +0 -96
- data/web/doc/api/core/files/lib/facets/core/enumerable/collect_if_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/enumerable/collect_with_counter_rb.html +0 -100
- data/web/doc/api/core/files/lib/facets/core/enumerable/collect_with_index_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/enumerable/commonality_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/enumerable/compact_collect_rb.html +0 -96
- data/web/doc/api/core/files/lib/facets/core/enumerable/compact_map_rb.html +0 -100
- data/web/doc/api/core/files/lib/facets/core/enumerable/count_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/enumerable/cross_rb.html +0 -96
- data/web/doc/api/core/files/lib/facets/core/enumerable/each_by_rb.html +0 -100
- data/web/doc/api/core/files/lib/facets/core/enumerable/each_combination_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/enumerable/each_pair_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/enumerable/each_permutation_rb.html +0 -100
- data/web/doc/api/core/files/lib/facets/core/enumerable/each_slice_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/enumerable/each_unique_pair_rb.html +0 -96
- data/web/doc/api/core/files/lib/facets/core/enumerable/each_with_counter_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/enumerable/elementwise_rb.html +0 -100
- data/web/doc/api/core/files/lib/facets/core/enumerable/entropy_rb.html +0 -97
- data/web/doc/api/core/files/lib/facets/core/enumerable/every_rb.html +0 -96
- data/web/doc/api/core/files/lib/facets/core/enumerable/ew_rb.html +0 -96
- data/web/doc/api/core/files/lib/facets/core/enumerable/filter_collect_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/enumerable/filter_map_rb.html +0 -100
- data/web/doc/api/core/files/lib/facets/core/enumerable/find_collisions_rb.html +0 -96
- data/web/doc/api/core/files/lib/facets/core/enumerable/frequency_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/enumerable/graph_rb.html +0 -96
- data/web/doc/api/core/files/lib/facets/core/enumerable/ideal_entropy_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/enumerable/map_if_rb.html +0 -100
- data/web/doc/api/core/files/lib/facets/core/enumerable/map_with_counter_rb.html +0 -100
- data/web/doc/api/core/files/lib/facets/core/enumerable/map_with_index_rb.html +0 -100
- data/web/doc/api/core/files/lib/facets/core/enumerable/mode_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/enumerable/none_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/enumerable/nonuniq_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/enumerable/occur_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/enumerable/one_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/enumerable/op_pow_rb.html +0 -96
- data/web/doc/api/core/files/lib/facets/core/enumerable/partition_by_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/enumerable/permute_rb.html +0 -96
- data/web/doc/api/core/files/lib/facets/core/enumerable/probability_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/enumerable/project_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/enumerable/self/combinations_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/enumerable/self/cross_rb.html +0 -96
- data/web/doc/api/core/files/lib/facets/core/enumerable/to_h_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/enumerable/uniq_by_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/enumerable/where_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/file/self/append_rb.html +0 -96
- data/web/doc/api/core/files/lib/facets/core/file/self/create_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/file/self/open_as_string_rb.html +0 -118
- data/web/doc/api/core/files/lib/facets/core/file/self/read_binary_rb.html +0 -96
- data/web/doc/api/core/files/lib/facets/core/file/self/read_list_rb.html +0 -97
- data/web/doc/api/core/files/lib/facets/core/file/self/sanitize_rb.html +0 -96
- data/web/doc/api/core/files/lib/facets/core/file/self/split_all_rb.html +0 -101
- data/web/doc/api/core/files/lib/facets/core/file/self/write_rb.html +0 -96
- data/web/doc/api/core/files/lib/facets/core/fileutils/head_rb.html +0 -100
- data/web/doc/api/core/files/lib/facets/core/fileutils/safe_ln_rb.html +0 -96
- data/web/doc/api/core/files/lib/facets/core/fileutils/slice_rb.html +0 -96
- data/web/doc/api/core/files/lib/facets/core/fileutils/split_all_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/fileutils/tail_rb.html +0 -100
- data/web/doc/api/core/files/lib/facets/core/fileutils/wc_rb.html +0 -96
- data/web/doc/api/core/files/lib/facets/core/fileutils/whereis_rb.html +0 -96
- data/web/doc/api/core/files/lib/facets/core/fileutils/which_rb.html +0 -96
- data/web/doc/api/core/files/lib/facets/core/float/approx_rb.html +0 -100
- data/web/doc/api/core/files/lib/facets/core/float/round_at_rb.html +0 -96
- data/web/doc/api/core/files/lib/facets/core/float/round_off_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/float/round_to_rb.html +0 -96
- data/web/doc/api/core/files/lib/facets/core/gem/self/active_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/gem/self/gemdir_rb.html +0 -96
- data/web/doc/api/core/files/lib/facets/core/gem/self/gempath_rb.html +0 -96
- data/web/doc/api/core/files/lib/facets/core/gem/self/gemspec_rb.html +0 -96
- data/web/doc/api/core/files/lib/facets/core/hash/alias_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/hash/assert_has_keys_rb.html +0 -96
- data/web/doc/api/core/files/lib/facets/core/hash/assert_has_only_keys_rb.html +0 -96
- data/web/doc/api/core/files/lib/facets/core/hash/at_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/hash/collate_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/hash/delete_unless_rb.html +0 -96
- data/web/doc/api/core/files/lib/facets/core/hash/each_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/hash/each_with_index_rb.html +0 -97
- data/web/doc/api/core/files/lib/facets/core/hash/each_with_key_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/hash/graph_rb.html +0 -96
- data/web/doc/api/core/files/lib/facets/core/hash/has_keys_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/hash/has_only_keys_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/hash/inverse_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/hash/join_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/hash/keys_to_iv_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/hash/keys_to_s_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/hash/keys_to_sym_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/hash/op_fetch_rb.html +0 -96
- data/web/doc/api/core/files/lib/facets/core/hash/op_lshift_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/hash/op_store_rb.html +0 -100
- data/web/doc/api/core/files/lib/facets/core/hash/rand_key_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/hash/rand_pair_rb.html +0 -96
- data/web/doc/api/core/files/lib/facets/core/hash/rand_value_rb.html +0 -96
- data/web/doc/api/core/files/lib/facets/core/hash/replace_each_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/hash/self/zipnew_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/hash/shuffle_rb.html +0 -96
- data/web/doc/api/core/files/lib/facets/core/hash/slice_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/hash/stringify_keys_rb.html +0 -100
- data/web/doc/api/core/files/lib/facets/core/hash/swap_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/hash/swapkey_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/hash/symoblize_keys_rb.html +0 -100
- data/web/doc/api/core/files/lib/facets/core/hash/to_h_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/hash/to_ostruct_rb.html +0 -96
- data/web/doc/api/core/files/lib/facets/core/hash/to_ostruct_recurse_rb.html +0 -97
- data/web/doc/api/core/files/lib/facets/core/hash/to_proc_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/hash/traverse_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/hash/update_each_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/hash/update_keys_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/hash/update_values_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/hash/variablize_keys_rb.html +0 -100
- data/web/doc/api/core/files/lib/facets/core/hash/weave_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/inflect_rb.html +0 -117
- data/web/doc/api/core/files/lib/facets/core/integer/even_rb.html +0 -100
- data/web/doc/api/core/files/lib/facets/core/integer/fac_rb.html +0 -100
- data/web/doc/api/core/files/lib/facets/core/integer/fact_rb.html +0 -100
- data/web/doc/api/core/files/lib/facets/core/integer/factorial_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/integer/multiple_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/integer/odd_rb.html +0 -100
- data/web/doc/api/core/files/lib/facets/core/integer/ordinal_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/integer/times_collect_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/integer/times_map_rb.html +0 -100
- data/web/doc/api/core/files/lib/facets/core/kernel/__DIR___rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/kernel/__class___rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/kernel/__get___rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/kernel/__self___rb.html +0 -96
- data/web/doc/api/core/files/lib/facets/core/kernel/__set___rb.html +0 -100
- data/web/doc/api/core/files/lib/facets/core/kernel/adhoc_rb.html +0 -99
- data/web/doc/api/core/files/lib/facets/core/kernel/as_rb.html +0 -96
- data/web/doc/api/core/files/lib/facets/core/kernel/assign_from_rb.html +0 -96
- data/web/doc/api/core/files/lib/facets/core/kernel/assign_with_rb.html +0 -97
- data/web/doc/api/core/files/lib/facets/core/kernel/autoreload_files_rb.html +0 -100
- data/web/doc/api/core/files/lib/facets/core/kernel/autoreload_glob_rb.html +0 -100
- data/web/doc/api/core/files/lib/facets/core/kernel/autoreload_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/kernel/bool_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/kernel/bug_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/kernel/cache_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/kernel/call_stack_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/kernel/called_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/kernel/complete_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/kernel/constant_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/kernel/copy_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/kernel/deep_copy_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/kernel/demo_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/kernel/eigenclass_rb.html +0 -103
- data/web/doc/api/core/files/lib/facets/core/kernel/false_rb.html +0 -100
- data/web/doc/api/core/files/lib/facets/core/kernel/fn_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/kernel/generate_method_name_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/kernel/get_by_id_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/kernel/here_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/kernel/in_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/kernel/instance_assign_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/kernel/instvar_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/kernel/is_rb.html +0 -96
- data/web/doc/api/core/files/lib/facets/core/kernel/maybe_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/kernel/me_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/kernel/metaclass_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/kernel/method_name_rb.html +0 -100
- data/web/doc/api/core/files/lib/facets/core/kernel/method_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/kernel/methodname_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/kernel/methods_rb.html +0 -96
- data/web/doc/api/core/files/lib/facets/core/kernel/nack_rb.html +0 -98
- data/web/doc/api/core/files/lib/facets/core/kernel/new_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/kernel/object_class_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/kernel/object_hexid_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/kernel/op_esc_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/kernel/own_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/kernel/p_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/kernel/pp_exception_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/kernel/require_all_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/kernel/require_esc_rb.html +0 -96
- data/web/doc/api/core/files/lib/facets/core/kernel/require_facet_rb.html +0 -96
- data/web/doc/api/core/files/lib/facets/core/kernel/require_local_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/kernel/resc_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/kernel/respond_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/kernel/returning_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/kernel/send_as_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/kernel/set_from_rb.html +0 -96
- data/web/doc/api/core/files/lib/facets/core/kernel/set_with_rb.html +0 -96
- data/web/doc/api/core/files/lib/facets/core/kernel/silence_warnings_rb.html +0 -100
- data/web/doc/api/core/files/lib/facets/core/kernel/silently_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/kernel/singleton_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/kernel/superior_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/kernel/supermethod_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/kernel/this_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/kernel/to_b_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/kernel/to_bool_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/kernel/true_rb.html +0 -100
- data/web/doc/api/core/files/lib/facets/core/kernel/unuri_rb.html +0 -100
- data/web/doc/api/core/files/lib/facets/core/kernel/uri_rb.html +0 -96
- data/web/doc/api/core/files/lib/facets/core/kernel/val_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/kernel/warn_with_line_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/kernel/with_accessor_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/kernel/with_reader_rb.html +0 -100
- data/web/doc/api/core/files/lib/facets/core/kernel/with_writer_rb.html +0 -100
- data/web/doc/api/core/files/lib/facets/core/logger/format_message_rb.html +0 -96
- data/web/doc/api/core/files/lib/facets/core/logger/format_rb.html +0 -96
- data/web/doc/api/core/files/lib/facets/core/matchdata/match_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/matchdata/matchset_rb.html +0 -100
- data/web/doc/api/core/files/lib/facets/core/matchdata/matchtree_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/module/abstract_rb.html +0 -105
- data/web/doc/api/core/files/lib/facets/core/module/alias_module_function_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/module/ancestor_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/module/attr_query_rb.html +0 -96
- data/web/doc/api/core/files/lib/facets/core/module/attr_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/module/attr_setter_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/module/attr_tester_rb.html +0 -96
- data/web/doc/api/core/files/lib/facets/core/module/attr_validator_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/module/basename_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/module/by_name_rb.html +0 -96
- data/web/doc/api/core/files/lib/facets/core/module/class_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/module/clone_removing_rb.html +0 -100
- data/web/doc/api/core/files/lib/facets/core/module/clone_renaming_rb.html +0 -100
- data/web/doc/api/core/files/lib/facets/core/module/clone_using_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/module/dirname_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/module/equate_on_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/module/generate_instance_method_name_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/module/include_as_rb.html +0 -96
- data/web/doc/api/core/files/lib/facets/core/module/inherit_rb.html +0 -96
- data/web/doc/api/core/files/lib/facets/core/module/initializer_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/module/instance_methods_rb.html +0 -96
- data/web/doc/api/core/files/lib/facets/core/module/integrate_rb.html +0 -104
- data/web/doc/api/core/files/lib/facets/core/module/is_rb.html +0 -96
- data/web/doc/api/core/files/lib/facets/core/module/memoize_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/module/modspace_rb.html +0 -97
- data/web/doc/api/core/files/lib/facets/core/module/namespace_rb.html +0 -96
- data/web/doc/api/core/files/lib/facets/core/module/nesting_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/module/nodef_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/module/on_included_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/module/redef_rb.html +0 -96
- data/web/doc/api/core/files/lib/facets/core/module/redefine_method_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/module/redirect_method_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/module/redirect_rb.html +0 -96
- data/web/doc/api/core/files/lib/facets/core/module/remove_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/module/rename_method_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/module/rename_rb.html +0 -96
- data/web/doc/api/core/files/lib/facets/core/module/revisal_rb.html +0 -100
- data/web/doc/api/core/files/lib/facets/core/module/shadow_all_rb.html +0 -96
- data/web/doc/api/core/files/lib/facets/core/module/shadow_method_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/module/singleton_to_module_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/module/sort_on_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/module/this_rb.html +0 -96
- data/web/doc/api/core/files/lib/facets/core/module/wrap_method_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/module/wrap_rb.html +0 -96
- data/web/doc/api/core/files/lib/facets/core/nil_as_emptiness_rb.html +0 -116
- data/web/doc/api/core/files/lib/facets/core/nilclass/blank_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/nilclass/empty_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/nilclass/include_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/nilclass/length_rb.html +0 -100
- data/web/doc/api/core/files/lib/facets/core/nilclass/op_cmp_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/nilclass/op_fetch_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/nilclass/size_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/nilclass/succ_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/nilclass/to_h_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/numeric/approx_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/numeric/ceil_multiple_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/numeric/pred_rb.html +0 -100
- data/web/doc/api/core/files/lib/facets/core/numeric/succ_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/numeric/to_b_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/ostruct/__merge___rb.html +0 -97
- data/web/doc/api/core/files/lib/facets/core/ostruct/__table___rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/ostruct/__update___rb.html +0 -98
- data/web/doc/api/core/files/lib/facets/core/ostruct/instance_rb.html +0 -96
- data/web/doc/api/core/files/lib/facets/core/ostruct/op_fetch_rb.html +0 -96
- data/web/doc/api/core/files/lib/facets/core/ostruct/op_store_rb.html +0 -96
- data/web/doc/api/core/files/lib/facets/core/ostruct/to_h_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/ostruct_rb.html +0 -102
- data/web/doc/api/core/files/lib/facets/core/pathname/ascend_rb.html +0 -96
- data/web/doc/api/core/files/lib/facets/core/pathname/descend_rb.html +0 -96
- data/web/doc/api/core/files/lib/facets/core/proc/compose_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/proc/op_mul_rb.html +0 -100
- data/web/doc/api/core/files/lib/facets/core/proc/to_method_rb.html +0 -133
- data/web/doc/api/core/files/lib/facets/core/random_rb.html +0 -111
- data/web/doc/api/core/files/lib/facets/core/range/to_r_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/range/to_range_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/range/umbrella_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/range/within_rb.html +0 -96
- data/web/doc/api/core/files/lib/facets/core/regexp/arity_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/regexp/to_re_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/regexp/to_regexp_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/string/align_center_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/string/align_left_rb.html +0 -100
- data/web/doc/api/core/files/lib/facets/core/string/align_right_rb.html +0 -100
- data/web/doc/api/core/files/lib/facets/core/string/at_rand_rb.html +0 -98
- data/web/doc/api/core/files/lib/facets/core/string/at_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/string/basename_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/string/blank_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/string/bracket_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/string/brief_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/string/bytes_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/string/camelcase_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/string/camelize_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/string/capitalized_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/string/chars_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/string/cmp_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/string/demodulize_rb.html +0 -96
- data/web/doc/api/core/files/lib/facets/core/string/dequote_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/string/downcase_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/string/dresner_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/string/each_char_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/string/each_word_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/string/ends_with_rb.html +0 -100
- data/web/doc/api/core/files/lib/facets/core/string/first_char_rb.html +0 -96
- data/web/doc/api/core/files/lib/facets/core/string/first_rb.html +0 -98
- data/web/doc/api/core/files/lib/facets/core/string/fold_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/string/format_rb.html +0 -96
- data/web/doc/api/core/files/lib/facets/core/string/frequency_rb.html +0 -97
- data/web/doc/api/core/files/lib/facets/core/string/humanize_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/string/indent_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/string/index_all_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/string/last_char_rb.html +0 -96
- data/web/doc/api/core/files/lib/facets/core/string/last_rb.html +0 -98
- data/web/doc/api/core/files/lib/facets/core/string/line_wrap_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/string/lines_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/string/lowercase_rb.html +0 -96
- data/web/doc/api/core/files/lib/facets/core/string/margin_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/string/methodize_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/string/modulize_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/string/mscan_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/string/natcmp_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/string/nchar_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/string/ordinal_rb.html +0 -96
- data/web/doc/api/core/files/lib/facets/core/string/pathize_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/string/plural_rb.html +0 -100
- data/web/doc/api/core/files/lib/facets/core/string/pop_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/string/pot_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/string/probability_rb.html +0 -97
- data/web/doc/api/core/files/lib/facets/core/string/pull_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/string/push_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/string/quote_rb.html +0 -96
- data/web/doc/api/core/files/lib/facets/core/string/rand_byte_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/string/rand_index_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/string/range_all_rb.html +0 -96
- data/web/doc/api/core/files/lib/facets/core/string/range_of_line_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/string/range_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/string/regesc_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/string/self/format_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/string/self/interpolate_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/string/self/patterns_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/string/self/rand_letter_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/string/self/random_rb.html +0 -99
- data/web/doc/api/core/files/lib/facets/core/string/shatter_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/string/shell_escape_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/string/shift_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/string/shuffle_rb.html +0 -96
- data/web/doc/api/core/files/lib/facets/core/string/similarity_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/string/singular_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/string/soundex_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/string/starts_with_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/string/succ_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/string/tab_rb.html +0 -100
- data/web/doc/api/core/files/lib/facets/core/string/tabto_rb.html +0 -100
- data/web/doc/api/core/files/lib/facets/core/string/to_a_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/string/to_b_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/string/to_const_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/string/to_date_rb.html +0 -97
- data/web/doc/api/core/files/lib/facets/core/string/to_proc_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/string/to_re_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/string/to_rx_rb.html +0 -100
- data/web/doc/api/core/files/lib/facets/core/string/to_time_rb.html +0 -96
- data/web/doc/api/core/files/lib/facets/core/string/unbracket_rb.html +0 -96
- data/web/doc/api/core/files/lib/facets/core/string/underscore_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/string/unix_crypt_rb.html +0 -96
- data/web/doc/api/core/files/lib/facets/core/string/unpack_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/string/unshift_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/string/upcase_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/string/uppercase_rb.html +0 -100
- data/web/doc/api/core/files/lib/facets/core/string/whitespace_rb.html +0 -96
- data/web/doc/api/core/files/lib/facets/core/string/word_filter_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/string/word_wrap_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/string/words_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/string_as_array_rb.html +0 -109
- data/web/doc/api/core/files/lib/facets/core/symbol/camelcase_rb.html +0 -96
- data/web/doc/api/core/files/lib/facets/core/symbol/camelize_rb.html +0 -96
- data/web/doc/api/core/files/lib/facets/core/symbol/capitalize_rb.html +0 -96
- data/web/doc/api/core/files/lib/facets/core/symbol/capitalized_rb.html +0 -97
- data/web/doc/api/core/files/lib/facets/core/symbol/downcase_rb.html +0 -96
- data/web/doc/api/core/files/lib/facets/core/symbol/not_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/symbol/pad_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/symbol/succ_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/symbol/to_const_rb.html +0 -96
- data/web/doc/api/core/files/lib/facets/core/symbol/to_proc_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/symbol/to_str_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/symbol/underscore_rb.html +0 -96
- data/web/doc/api/core/files/lib/facets/core/symbol/upcase_rb.html +0 -96
- data/web/doc/api/core/files/lib/facets/core/time/change_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/time/elapse_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/time/self/days_extrema_rb.html +0 -114
- data/web/doc/api/core/files/lib/facets/core/time/self/stamp_rb.html +0 -100
- data/web/doc/api/core/files/lib/facets/core/time/stamp_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/time/to_date_rb.html +0 -96
- data/web/doc/api/core/files/lib/facets/core/time/to_s_rb.html +0 -96
- data/web/doc/api/core/files/lib/facets/core/time/to_time_rb.html +0 -92
- data/web/doc/api/core/files/lib/facets/core/unboundmethod/name_rb.html +0 -92
- data/web/doc/api/core/fr_class_index.html +0 -80
- data/web/doc/api/core/fr_file_index.html +0 -521
- data/web/doc/api/core/fr_method_index.html +0 -555
- data/web/doc/api/core/index.html +0 -26
- data/web/doc/api/core/rdoc-style.css +0 -175
- data/web/doc/api/more/classes/Annotation.html +0 -258
- data/web/doc/api/more/classes/Array.html +0 -362
- data/web/doc/api/more/classes/Aspect.html +0 -159
- data/web/doc/api/more/classes/Aspects.html +0 -240
- data/web/doc/api/more/classes/Aspects/ClassMethods.html +0 -254
- data/web/doc/api/more/classes/Association.html +0 -289
- data/web/doc/api/more/classes/BBCode.html +0 -531
- data/web/doc/api/more/classes/BasicObject.html +0 -260
- data/web/doc/api/more/classes/BasicObject/Self.html +0 -142
- data/web/doc/api/more/classes/BinaryReader.html +0 -535
- data/web/doc/api/more/classes/BinaryReader/ByteOrder.html +0 -225
- data/web/doc/api/more/classes/BuilderObject.html +0 -248
- data/web/doc/api/more/classes/Class.html +0 -201
- data/web/doc/api/more/classes/Client.html +0 -1251
- data/web/doc/api/more/classes/Cloneable.html +0 -133
- data/web/doc/api/more/classes/Console.html +0 -105
- data/web/doc/api/more/classes/Console/ANSICode.html +0 -488
- data/web/doc/api/more/classes/Console/Command.html +0 -275
- data/web/doc/api/more/classes/Console/ProgressBar.html +0 -640
- data/web/doc/api/more/classes/Coroutine.html +0 -284
- data/web/doc/api/more/classes/Crypt.html +0 -270
- data/web/doc/api/more/classes/DebugSocket.html +0 -242
- data/web/doc/api/more/classes/Dictionary.html +0 -974
- data/web/doc/api/more/classes/Downloader.html +0 -515
- data/web/doc/api/more/classes/Downloader/Checksum.html +0 -96
- data/web/doc/api/more/classes/Downloader/Mirror.html +0 -134
- data/web/doc/api/more/classes/Elementor.html +0 -202
- data/web/doc/api/more/classes/Enumerable.html +0 -86
- data/web/doc/api/more/classes/EnumerablePass.html +0 -217
- data/web/doc/api/more/classes/Expirable.html +0 -197
- data/web/doc/api/more/classes/FalseClass.html +0 -119
- data/web/doc/api/more/classes/FileList.html +0 -971
- data/web/doc/api/more/classes/Float.html +0 -140
- data/web/doc/api/more/classes/FloatString.html +0 -413
- data/web/doc/api/more/classes/Functor.html +0 -203
- data/web/doc/api/more/classes/HTMLBuilder.html +0 -132
- data/web/doc/api/more/classes/HTMLHelper.html +0 -189
- data/web/doc/api/more/classes/HTTP.html +0 -154
- data/web/doc/api/more/classes/HTTP/BadResponseError.html +0 -94
- data/web/doc/api/more/classes/HTTP/Error.html +0 -96
- data/web/doc/api/more/classes/HTTP/Message.html +0 -633
- data/web/doc/api/more/classes/HTTP/Message/Body.html +0 -299
- data/web/doc/api/more/classes/HTTP/Message/Headers.html +0 -641
- data/web/doc/api/more/classes/HTTP/Status.html +0 -148
- data/web/doc/api/more/classes/HTTPAccess.html +0 -115
- data/web/doc/api/more/classes/Hash.html +0 -257
- data/web/doc/api/more/classes/HashBuilder.html +0 -216
- data/web/doc/api/more/classes/Heap.html +0 -535
- data/web/doc/api/more/classes/Heap/EmptyHeapException.html +0 -92
- data/web/doc/api/more/classes/Heap/Max.html +0 -133
- data/web/doc/api/more/classes/Heap/Min.html +0 -133
- data/web/doc/api/more/classes/IORedirect.html +0 -225
- data/web/doc/api/more/classes/Integer.html +0 -298
- data/web/doc/api/more/classes/Interval.html +0 -853
- data/web/doc/api/more/classes/InvalidNackError.html +0 -117
- data/web/doc/api/more/classes/JSON.html +0 -410
- data/web/doc/api/more/classes/JSON/Parser.html +0 -374
- data/web/doc/api/more/classes/JSON/State.html +0 -280
- data/web/doc/api/more/classes/Kernel.html +0 -400
- data/web/doc/api/more/classes/LRUCache.html +0 -461
- data/web/doc/api/more/classes/LRUCache/Item.html +0 -114
- data/web/doc/api/more/classes/LRUCache/Sentinel.html +0 -102
- data/web/doc/api/more/classes/Lazy.html +0 -96
- data/web/doc/api/more/classes/Lazy/Future.html +0 -100
- data/web/doc/api/more/classes/Lazy/Promise.html +0 -114
- data/web/doc/api/more/classes/Lazy/PromiseSafe.html +0 -99
- data/web/doc/api/more/classes/Lisp.html +0 -846
- data/web/doc/api/more/classes/Lisp/DottedPair.html +0 -289
- data/web/doc/api/more/classes/Lisp/Format.html +0 -147
- data/web/doc/api/more/classes/Math.html +0 -110
- data/web/doc/api/more/classes/Math/Constants.html +0 -691
- data/web/doc/api/more/classes/Math/Constants/CGS.html +0 -584
- data/web/doc/api/more/classes/Method.html +0 -170
- data/web/doc/api/more/classes/Method/Probe.html +0 -267
- data/web/doc/api/more/classes/Mock.html +0 -276
- data/web/doc/api/more/classes/Module.html +0 -691
- data/web/doc/api/more/classes/Multiton.html +0 -256
- data/web/doc/api/more/classes/NackClass.html +0 -245
- data/web/doc/api/more/classes/NilClass.html +0 -238
- data/web/doc/api/more/classes/NullClass.html +0 -202
- data/web/doc/api/more/classes/Numeric.html +0 -1104
- data/web/doc/api/more/classes/ORMSupport.html +0 -357
- data/web/doc/api/more/classes/Object.html +0 -323
- data/web/doc/api/more/classes/OpenCascade.html +0 -230
- data/web/doc/api/more/classes/OpenObject.html +0 -552
- data/web/doc/api/more/classes/PQueue.html +0 -471
- data/web/doc/api/more/classes/PathList.html +0 -162
- data/web/doc/api/more/classes/PathList/Finder.html +0 -137
- data/web/doc/api/more/classes/Pool.html +0 -207
- data/web/doc/api/more/classes/Proc.html +0 -140
- data/web/doc/api/more/classes/PromoteSelf.html +0 -138
- data/web/doc/api/more/classes/Quaternion.html +0 -1497
- data/web/doc/api/more/classes/REXMLBuilder.html +0 -357
- data/web/doc/api/more/classes/REXMLBuilder/REXMLUtil.html +0 -396
- data/web/doc/api/more/classes/Recorder.html +0 -208
- data/web/doc/api/more/classes/Reference.html +0 -201
- data/web/doc/api/more/classes/RubyOneLiners.html +0 -139
- data/web/doc/api/more/classes/RubyTals.html +0 -316
- data/web/doc/api/more/classes/SSLSocketWrap.html +0 -410
- data/web/doc/api/more/classes/Semaphore.html +0 -264
- data/web/doc/api/more/classes/SimpleStringIO.html +0 -139
- data/web/doc/api/more/classes/Snapshot.html +0 -191
- data/web/doc/api/more/classes/StateMachine.html +0 -248
- data/web/doc/api/more/classes/StateParser.html +0 -276
- data/web/doc/api/more/classes/StateParser/Constants.html +0 -109
- data/web/doc/api/more/classes/StateParser/Marker.html +0 -269
- data/web/doc/api/more/classes/StateParser/State.html +0 -448
- data/web/doc/api/more/classes/StaticHash.html +0 -144
- data/web/doc/api/more/classes/String.html +0 -278
- data/web/doc/api/more/classes/StringIO.html +0 -123
- data/web/doc/api/more/classes/Struct.html +0 -134
- data/web/doc/api/more/classes/Symbol.html +0 -116
- data/web/doc/api/more/classes/SyncArray.html +0 -131
- data/web/doc/api/more/classes/SyncHash.html +0 -135
- data/web/doc/api/more/classes/SyncHash/Delegator.html +0 -213
- data/web/doc/api/more/classes/SyncHash/Inheritor.html +0 -213
- data/web/doc/api/more/classes/System.html +0 -1055
- data/web/doc/api/more/classes/TSort.html +0 -123
- data/web/doc/api/more/classes/TagIterator.html +0 -706
- data/web/doc/api/more/classes/Task.html +0 -237
- data/web/doc/api/more/classes/Task/Graph.html +0 -165
- data/web/doc/api/more/classes/Taskable.html +0 -300
- data/web/doc/api/more/classes/Time.html +0 -746
- data/web/doc/api/more/classes/Timer.html +0 -471
- data/web/doc/api/more/classes/Timer/Dummy.html +0 -141
- data/web/doc/api/more/classes/TracePoint.html +0 -453
- data/web/doc/api/more/classes/TrueClass.html +0 -118
- data/web/doc/api/more/classes/Tuple.html +0 -861
- data/web/doc/api/more/classes/URI.html +0 -107
- data/web/doc/api/more/classes/Uninheritable.html +0 -130
- data/web/doc/api/more/classes/Units.html +0 -191
- data/web/doc/api/more/classes/Units/Config.html +0 -120
- data/web/doc/api/more/classes/Units/Converter.html +0 -808
- data/web/doc/api/more/classes/Units/Converter/ExchangeRate.html +0 -155
- data/web/doc/api/more/classes/Units/Converter/ExchangeRate/CachedXMethods.html +0 -143
- data/web/doc/api/more/classes/Units/Converter/ExchangeRate/XMethods.html +0 -197
- data/web/doc/api/more/classes/Units/Unit.html +0 -434
- data/web/doc/api/more/classes/Units/Value.html +0 -331
- data/web/doc/api/more/classes/ValueHolder.html +0 -167
- data/web/doc/api/more/classes/WebAgent.html +0 -103
- data/web/doc/api/more/classes/WebAgent/Cookie.html +0 -513
- data/web/doc/api/more/classes/WebAgent/CookieManager.html +0 -515
- data/web/doc/api/more/classes/WebAgent/CookieManager/Error.html +0 -96
- data/web/doc/api/more/classes/WebAgent/CookieManager/ErrorOverrideOK.html +0 -94
- data/web/doc/api/more/classes/WebAgent/CookieManager/NoDotError.html +0 -94
- data/web/doc/api/more/classes/WebAgent/CookieManager/SpecialError.html +0 -94
- data/web/doc/api/more/classes/WebAgent/CookieUtils.html +0 -171
- data/web/doc/api/more/classes/XMLBuilder.html +0 -132
- data/web/doc/api/more/classes/XMLHelper.html +0 -428
- data/web/doc/api/more/classes/XOXO.html +0 -252
- data/web/doc/api/more/classes/YAMLStruct.html +0 -166
- data/web/doc/api/more/created.rid +0 -1
- data/web/doc/api/more/files/AUTHORS.html +0 -206
- data/web/doc/api/more/files/COPYING.html +0 -517
- data/web/doc/api/more/files/README.html +0 -389
- data/web/doc/api/more/files/WARNING.html +0 -151
- data/web/doc/api/more/files/lib/facets/more/annattr_rb.html +0 -115
- data/web/doc/api/more/files/lib/facets/more/annotation_rb.html +0 -118
- data/web/doc/api/more/files/lib/facets/more/ansicode_rb.html +0 -128
- data/web/doc/api/more/files/lib/facets/more/aspects_rb.html +0 -115
- data/web/doc/api/more/files/lib/facets/more/association_rb.html +0 -111
- data/web/doc/api/more/files/lib/facets/more/basicobject_rb.html +0 -129
- data/web/doc/api/more/files/lib/facets/more/bbcode_rb.html +0 -111
- data/web/doc/api/more/files/lib/facets/more/binaryreader_rb.html +0 -111
- data/web/doc/api/more/files/lib/facets/more/bitmask_rb.html +0 -111
- data/web/doc/api/more/files/lib/facets/more/blankslate_rb.html +0 -113
- data/web/doc/api/more/files/lib/facets/more/builderobject_rb.html +0 -115
- data/web/doc/api/more/files/lib/facets/more/bytes_rb.html +0 -131
- data/web/doc/api/more/files/lib/facets/more/classinherit_rb.html +0 -111
- data/web/doc/api/more/files/lib/facets/more/classmethods_rb.html +0 -121
- data/web/doc/api/more/files/lib/facets/more/cloneable_rb.html +0 -132
- data/web/doc/api/more/files/lib/facets/more/consoleapp_rb.html +0 -131
- data/web/doc/api/more/files/lib/facets/more/cookie_rb.html +0 -133
- data/web/doc/api/more/files/lib/facets/more/coroutine_rb.html +0 -111
- data/web/doc/api/more/files/lib/facets/more/crypt_rb.html +0 -146
- data/web/doc/api/more/files/lib/facets/more/dictionary_rb.html +0 -123
- data/web/doc/api/more/files/lib/facets/more/downloader_rb.html +0 -124
- data/web/doc/api/more/files/lib/facets/more/elementor_rb.html +0 -115
- data/web/doc/api/more/files/lib/facets/more/enumerablepass_rb.html +0 -115
- data/web/doc/api/more/files/lib/facets/more/expirable_rb.html +0 -111
- data/web/doc/api/more/files/lib/facets/more/filelist_rb.html +0 -128
- data/web/doc/api/more/files/lib/facets/more/floatstring_rb.html +0 -115
- data/web/doc/api/more/files/lib/facets/more/functor_rb.html +0 -115
- data/web/doc/api/more/files/lib/facets/more/hashbuilder_rb.html +0 -115
- data/web/doc/api/more/files/lib/facets/more/heap_rb.html +0 -131
- data/web/doc/api/more/files/lib/facets/more/htmlbuilder_rb.html +0 -116
- data/web/doc/api/more/files/lib/facets/more/htmlhelper_rb.html +0 -119
- data/web/doc/api/more/files/lib/facets/more/http_rb.html +0 -116
- data/web/doc/api/more/files/lib/facets/more/httpaccess_rb.html +0 -137
- data/web/doc/api/more/files/lib/facets/more/inheritor_rb.html +0 -115
- data/web/doc/api/more/files/lib/facets/more/interval_rb.html +0 -120
- data/web/doc/api/more/files/lib/facets/more/ioredirect_rb.html +0 -116
- data/web/doc/api/more/files/lib/facets/more/json_rb.html +0 -141
- data/web/doc/api/more/files/lib/facets/more/lazy_rb.html +0 -111
- data/web/doc/api/more/files/lib/facets/more/lisp_format_rb.html +0 -129
- data/web/doc/api/more/files/lib/facets/more/lisp_rb.html +0 -119
- data/web/doc/api/more/files/lib/facets/more/lrucache_rb.html +0 -111
- data/web/doc/api/more/files/lib/facets/more/mathconstants_rb.html +0 -121
- data/web/doc/api/more/files/lib/facets/more/methodprobe_rb.html +0 -111
- data/web/doc/api/more/files/lib/facets/more/mock_rb.html +0 -208
- data/web/doc/api/more/files/lib/facets/more/multipliers_rb.html +0 -115
- data/web/doc/api/more/files/lib/facets/more/multiton_rb.html +0 -114
- data/web/doc/api/more/files/lib/facets/more/nackclass_rb.html +0 -151
- data/web/doc/api/more/files/lib/facets/more/nilcomparable_rb.html +0 -118
- data/web/doc/api/more/files/lib/facets/more/nullclass_rb.html +0 -111
- data/web/doc/api/more/files/lib/facets/more/one_rb.html +0 -158
- data/web/doc/api/more/files/lib/facets/more/opencascade_rb.html +0 -129
- data/web/doc/api/more/files/lib/facets/more/openobject_rb.html +0 -120
- data/web/doc/api/more/files/lib/facets/more/orderedhash_rb.html +0 -113
- data/web/doc/api/more/files/lib/facets/more/ormsupport_rb.html +0 -125
- data/web/doc/api/more/files/lib/facets/more/overload_rb.html +0 -111
- data/web/doc/api/more/files/lib/facets/more/paramix_rb.html +0 -118
- data/web/doc/api/more/files/lib/facets/more/pathlist_rb.html +0 -111
- data/web/doc/api/more/files/lib/facets/more/pool_rb.html +0 -120
- data/web/doc/api/more/files/lib/facets/more/pqueue_rb.html +0 -122
- data/web/doc/api/more/files/lib/facets/more/preinitialize_rb.html +0 -115
- data/web/doc/api/more/files/lib/facets/more/progressbar_rb.html +0 -111
- data/web/doc/api/more/files/lib/facets/more/promoteself_rb.html +0 -111
- data/web/doc/api/more/files/lib/facets/more/quaternion_rb.html +0 -150
- data/web/doc/api/more/files/lib/facets/more/recorder_rb.html +0 -115
- data/web/doc/api/more/files/lib/facets/more/reference_rb.html +0 -115
- data/web/doc/api/more/files/lib/facets/more/rexmlbuilder_rb.html +0 -116
- data/web/doc/api/more/files/lib/facets/more/rtals_rb.html +0 -115
- data/web/doc/api/more/files/lib/facets/more/semaphore_rb.html +0 -111
- data/web/doc/api/more/files/lib/facets/more/snapshot_rb.html +0 -121
- data/web/doc/api/more/files/lib/facets/more/stateparser_rb.html +0 -115
- data/web/doc/api/more/files/lib/facets/more/statichash_rb.html +0 -133
- data/web/doc/api/more/files/lib/facets/more/syncarray_rb.html +0 -115
- data/web/doc/api/more/files/lib/facets/more/synchash_rb.html +0 -115
- data/web/doc/api/more/files/lib/facets/more/system_rb.html +0 -123
- data/web/doc/api/more/files/lib/facets/more/tagiterator_rb.html +0 -111
- data/web/doc/api/more/files/lib/facets/more/taskable_rb.html +0 -118
- data/web/doc/api/more/files/lib/facets/more/timer_rb.html +0 -127
- data/web/doc/api/more/files/lib/facets/more/times_rb.html +0 -127
- data/web/doc/api/more/files/lib/facets/more/tracepoint_rb.html +0 -131
- data/web/doc/api/more/files/lib/facets/more/tuple_rb.html +0 -122
- data/web/doc/api/more/files/lib/facets/more/typecast_rb.html +0 -124
- data/web/doc/api/more/files/lib/facets/more/uninheritable_rb.html +0 -111
- data/web/doc/api/more/files/lib/facets/more/units_rb.html +0 -118
- data/web/doc/api/more/files/lib/facets/more/xmlbuilder_rb.html +0 -116
- data/web/doc/api/more/files/lib/facets/more/xmlhelper_rb.html +0 -111
- data/web/doc/api/more/files/lib/facets/more/xoxo_rb.html +0 -125
- data/web/doc/api/more/files/lib/facets/more/yamlstruct_rb.html +0 -123
- data/web/doc/api/more/fr_class_index.html +0 -197
- data/web/doc/api/more/fr_file_index.html +0 -136
- data/web/doc/api/more/fr_method_index.html +0 -1290
- data/web/doc/api/more/index.html +0 -26
- data/web/doc/api/more/rdoc-style.css +0 -175
- data/web/images/best_jupiter_cass.jpg +0 -0
- data/web/images/super-friends-volume-two-20050606010933166-001.jpg +0 -0
@@ -1,185 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
-
<!DOCTYPE html
|
3
|
-
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
-
<html>
|
6
|
-
<head>
|
7
|
-
<title>Class: Regexp</title>
|
8
|
-
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
9
|
-
<link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
|
10
|
-
|
11
|
-
<script language="JavaScript" type="text/javascript">
|
12
|
-
// <![CDATA[
|
13
|
-
|
14
|
-
function toggleSource( id )
|
15
|
-
{
|
16
|
-
var elem
|
17
|
-
var link
|
18
|
-
|
19
|
-
if( document.getElementById )
|
20
|
-
{
|
21
|
-
elem = document.getElementById( id )
|
22
|
-
link = document.getElementById( "l_" + id )
|
23
|
-
}
|
24
|
-
else if ( document.all )
|
25
|
-
{
|
26
|
-
elem = eval( "document.all." + id )
|
27
|
-
link = eval( "document.all.l_" + id )
|
28
|
-
}
|
29
|
-
else
|
30
|
-
return false;
|
31
|
-
|
32
|
-
if( elem.style.display == "block" )
|
33
|
-
{
|
34
|
-
elem.style.display = "none"
|
35
|
-
link.innerHTML = "show source"
|
36
|
-
}
|
37
|
-
else
|
38
|
-
{
|
39
|
-
elem.style.display = "block"
|
40
|
-
link.innerHTML = "hide source"
|
41
|
-
}
|
42
|
-
}
|
43
|
-
|
44
|
-
function openCode( url )
|
45
|
-
{
|
46
|
-
window.open( url, "SOURCE_CODE", "width=400,height=400,scrollbars=yes" )
|
47
|
-
}
|
48
|
-
// ]]>
|
49
|
-
</script>
|
50
|
-
</head>
|
51
|
-
|
52
|
-
<body>
|
53
|
-
<table width="100%" border='0' cellpadding='0' cellspacing='0' class='banner'><tr>
|
54
|
-
<td class="file-title"><span class="file-title-prefix">Class</span><br />Regexp</td>
|
55
|
-
<td align="right">
|
56
|
-
<table cellspacing=0 cellpadding=2>
|
57
|
-
<tr valign="top">
|
58
|
-
<td>In:</td>
|
59
|
-
<td>
|
60
|
-
<a href="../files/lib/facets/core/regexp/to_regexp_rb.html">lib/facets/core/regexp/to_regexp.rb</a>
|
61
|
-
<a href="../files/lib/facets/core/regexp/to_re_rb.html">lib/facets/core/regexp/to_re.rb</a>
|
62
|
-
<a href="../files/lib/facets/core/regexp/arity_rb.html">lib/facets/core/regexp/arity.rb</a>
|
63
|
-
</td>
|
64
|
-
</tr>
|
65
|
-
<tr>
|
66
|
-
<td>Parent:</td>
|
67
|
-
<td>
|
68
|
-
<a href="Object.html">
|
69
|
-
Object
|
70
|
-
</a>
|
71
|
-
</td>
|
72
|
-
</tr>
|
73
|
-
</table>
|
74
|
-
</td>
|
75
|
-
</tr>
|
76
|
-
</table>
|
77
|
-
<!-- banner header -->
|
78
|
-
|
79
|
-
<div id="bodyContent">
|
80
|
-
<div id="content">
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
<div class="sectiontitle">Methods</div>
|
86
|
-
<ul>
|
87
|
-
<li><a href="#M000042">arity</a></li>
|
88
|
-
<li><a href="#M000041">to_re</a></li>
|
89
|
-
<li><a href="#M000040">to_regexp</a></li>
|
90
|
-
</ul>
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
<div class="sectiontitle">Public Instance methods</div>
|
98
|
-
<div class="method">
|
99
|
-
<div class="title">
|
100
|
-
<a name="M000042"></a><b>arity</b>()
|
101
|
-
</div>
|
102
|
-
<div class="description">
|
103
|
-
<p>
|
104
|
-
Returns the number of backreferencing subexpressions.
|
105
|
-
</p>
|
106
|
-
<pre>
|
107
|
-
/(a)(b)(c)/.arity #=> 3
|
108
|
-
/(a(b(c)))/.arity #=> 3
|
109
|
-
</pre>
|
110
|
-
<p>
|
111
|
-
Note: This is not perfect, especially with regards to \x and embedded
|
112
|
-
comments.
|
113
|
-
</p>
|
114
|
-
</div>
|
115
|
-
<div class="sourcecode">
|
116
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000042_source')" id="l_M000042_source">show source</a> ]</p>
|
117
|
-
<div id="M000042_source" class="dyn-source">
|
118
|
-
<pre>
|
119
|
-
<span class="ruby-comment cmt"># File lib/facets/core/regexp/arity.rb, line 9</span>
|
120
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">arity</span>
|
121
|
-
<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">source</span>.<span class="ruby-identifier">scan</span>( <span class="ruby-regexp re">/(?!\\)[(](?!\?[#=:!>-imx])/</span> ).<span class="ruby-identifier">length</span>
|
122
|
-
<span class="ruby-keyword kw">end</span>
|
123
|
-
</pre>
|
124
|
-
</div>
|
125
|
-
</div>
|
126
|
-
</div>
|
127
|
-
<div class="method">
|
128
|
-
<div class="title">
|
129
|
-
<a name="M000041"></a><b>to_re</b>( esc=false )
|
130
|
-
</div>
|
131
|
-
<div class="description">
|
132
|
-
<p>
|
133
|
-
Simply returns itself. Helpful when converting strings to regular
|
134
|
-
expressions, where regexp might occur as well —in the same vien as
|
135
|
-
using to_s on symbols. The parameter is actaully a dummy parameter to
|
136
|
-
coincide with <a href="String.html#M000339">String#to_re</a>.
|
137
|
-
</p>
|
138
|
-
<pre>
|
139
|
-
/abc/.to_re #=> /abc/
|
140
|
-
</pre>
|
141
|
-
</div>
|
142
|
-
<div class="sourcecode">
|
143
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000041_source')" id="l_M000041_source">show source</a> ]</p>
|
144
|
-
<div id="M000041_source" class="dyn-source">
|
145
|
-
<pre>
|
146
|
-
<span class="ruby-comment cmt"># File lib/facets/core/regexp/to_re.rb, line 11</span>
|
147
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_re</span>( <span class="ruby-identifier">esc</span>=<span class="ruby-keyword kw">false</span> )
|
148
|
-
<span class="ruby-keyword kw">self</span> <span class="ruby-comment cmt"># Of course, things really should know how to say "I" ;)</span>
|
149
|
-
<span class="ruby-keyword kw">end</span>
|
150
|
-
</pre>
|
151
|
-
</div>
|
152
|
-
</div>
|
153
|
-
</div>
|
154
|
-
<div class="method">
|
155
|
-
<div class="title">
|
156
|
-
<a name="M000040"></a><b>to_regexp</b>()
|
157
|
-
</div>
|
158
|
-
<div class="description">
|
159
|
-
<p>
|
160
|
-
Like <a href="Regexp.html#M000041">to_re</a>, but following Ruby’s
|
161
|
-
formal definitions, only a Regular expression type object will respond to
|
162
|
-
this.
|
163
|
-
</p>
|
164
|
-
<p>
|
165
|
-
Note: To be of much real use this should be defined in core Ruby.
|
166
|
-
</p>
|
167
|
-
</div>
|
168
|
-
<div class="sourcecode">
|
169
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000040_source')" id="l_M000040_source">show source</a> ]</p>
|
170
|
-
<div id="M000040_source" class="dyn-source">
|
171
|
-
<pre>
|
172
|
-
<span class="ruby-comment cmt"># File lib/facets/core/regexp/to_regexp.rb, line 8</span>
|
173
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_regexp</span>
|
174
|
-
<span class="ruby-keyword kw">self</span>
|
175
|
-
<span class="ruby-keyword kw">end</span>
|
176
|
-
</pre>
|
177
|
-
</div>
|
178
|
-
</div>
|
179
|
-
</div>
|
180
|
-
</div>
|
181
|
-
|
182
|
-
</div>
|
183
|
-
|
184
|
-
</body>
|
185
|
-
</html>
|
@@ -1,92 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
-
<!DOCTYPE html
|
3
|
-
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
-
<html>
|
6
|
-
<head>
|
7
|
-
<title>Class: ScriptBug</title>
|
8
|
-
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
9
|
-
<link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
|
10
|
-
|
11
|
-
<script language="JavaScript" type="text/javascript">
|
12
|
-
// <![CDATA[
|
13
|
-
|
14
|
-
function toggleSource( id )
|
15
|
-
{
|
16
|
-
var elem
|
17
|
-
var link
|
18
|
-
|
19
|
-
if( document.getElementById )
|
20
|
-
{
|
21
|
-
elem = document.getElementById( id )
|
22
|
-
link = document.getElementById( "l_" + id )
|
23
|
-
}
|
24
|
-
else if ( document.all )
|
25
|
-
{
|
26
|
-
elem = eval( "document.all." + id )
|
27
|
-
link = eval( "document.all.l_" + id )
|
28
|
-
}
|
29
|
-
else
|
30
|
-
return false;
|
31
|
-
|
32
|
-
if( elem.style.display == "block" )
|
33
|
-
{
|
34
|
-
elem.style.display = "none"
|
35
|
-
link.innerHTML = "show source"
|
36
|
-
}
|
37
|
-
else
|
38
|
-
{
|
39
|
-
elem.style.display = "block"
|
40
|
-
link.innerHTML = "hide source"
|
41
|
-
}
|
42
|
-
}
|
43
|
-
|
44
|
-
function openCode( url )
|
45
|
-
{
|
46
|
-
window.open( url, "SOURCE_CODE", "width=400,height=400,scrollbars=yes" )
|
47
|
-
}
|
48
|
-
// ]]>
|
49
|
-
</script>
|
50
|
-
</head>
|
51
|
-
|
52
|
-
<body>
|
53
|
-
<table width="100%" border='0' cellpadding='0' cellspacing='0' class='banner'><tr>
|
54
|
-
<td class="file-title"><span class="file-title-prefix">Class</span><br />ScriptBug</td>
|
55
|
-
<td align="right">
|
56
|
-
<table cellspacing=0 cellpadding=2>
|
57
|
-
<tr valign="top">
|
58
|
-
<td>In:</td>
|
59
|
-
<td>
|
60
|
-
<a href="../files/lib/facets/core/kernel/bug_rb.html">lib/facets/core/kernel/bug.rb</a>
|
61
|
-
</td>
|
62
|
-
</tr>
|
63
|
-
<tr>
|
64
|
-
<td>Parent:</td>
|
65
|
-
<td>
|
66
|
-
Exception
|
67
|
-
</td>
|
68
|
-
</tr>
|
69
|
-
</table>
|
70
|
-
</td>
|
71
|
-
</tr>
|
72
|
-
</table>
|
73
|
-
<!-- banner header -->
|
74
|
-
|
75
|
-
<div id="bodyContent">
|
76
|
-
<div id="content">
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
</div>
|
88
|
-
|
89
|
-
</div>
|
90
|
-
|
91
|
-
</body>
|
92
|
-
</html>
|
@@ -1,3286 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
-
<!DOCTYPE html
|
3
|
-
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
-
<html>
|
6
|
-
<head>
|
7
|
-
<title>Class: String</title>
|
8
|
-
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
9
|
-
<link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
|
10
|
-
|
11
|
-
<script language="JavaScript" type="text/javascript">
|
12
|
-
// <![CDATA[
|
13
|
-
|
14
|
-
function toggleSource( id )
|
15
|
-
{
|
16
|
-
var elem
|
17
|
-
var link
|
18
|
-
|
19
|
-
if( document.getElementById )
|
20
|
-
{
|
21
|
-
elem = document.getElementById( id )
|
22
|
-
link = document.getElementById( "l_" + id )
|
23
|
-
}
|
24
|
-
else if ( document.all )
|
25
|
-
{
|
26
|
-
elem = eval( "document.all." + id )
|
27
|
-
link = eval( "document.all.l_" + id )
|
28
|
-
}
|
29
|
-
else
|
30
|
-
return false;
|
31
|
-
|
32
|
-
if( elem.style.display == "block" )
|
33
|
-
{
|
34
|
-
elem.style.display = "none"
|
35
|
-
link.innerHTML = "show source"
|
36
|
-
}
|
37
|
-
else
|
38
|
-
{
|
39
|
-
elem.style.display = "block"
|
40
|
-
link.innerHTML = "hide source"
|
41
|
-
}
|
42
|
-
}
|
43
|
-
|
44
|
-
function openCode( url )
|
45
|
-
{
|
46
|
-
window.open( url, "SOURCE_CODE", "width=400,height=400,scrollbars=yes" )
|
47
|
-
}
|
48
|
-
// ]]>
|
49
|
-
</script>
|
50
|
-
</head>
|
51
|
-
|
52
|
-
<body>
|
53
|
-
<table width="100%" border='0' cellpadding='0' cellspacing='0' class='banner'><tr>
|
54
|
-
<td class="file-title"><span class="file-title-prefix">Class</span><br />String</td>
|
55
|
-
<td align="right">
|
56
|
-
<table cellspacing=0 cellpadding=2>
|
57
|
-
<tr valign="top">
|
58
|
-
<td>In:</td>
|
59
|
-
<td>
|
60
|
-
<a href="../files/lib/facets/core/enumerable/entropy_rb.html">lib/facets/core/enumerable/entropy.rb</a>
|
61
|
-
<a href="../files/lib/facets/core/string/pull_rb.html">lib/facets/core/string/pull.rb</a>
|
62
|
-
<a href="../files/lib/facets/core/string/push_rb.html">lib/facets/core/string/push.rb</a>
|
63
|
-
<a href="../files/lib/facets/core/string/shift_rb.html">lib/facets/core/string/shift.rb</a>
|
64
|
-
<a href="../files/lib/facets/core/string/dresner_rb.html">lib/facets/core/string/dresner.rb</a>
|
65
|
-
<a href="../files/lib/facets/core/string/word_filter_rb.html">lib/facets/core/string/word_filter.rb</a>
|
66
|
-
<a href="../files/lib/facets/core/string/unix_crypt_rb.html">lib/facets/core/string/unix_crypt.rb</a>
|
67
|
-
<a href="../files/lib/facets/core/string/camelcase_rb.html">lib/facets/core/string/camelcase.rb</a>
|
68
|
-
<a href="../files/lib/facets/core/string/humanize_rb.html">lib/facets/core/string/humanize.rb</a>
|
69
|
-
<a href="../files/lib/facets/core/string/at_rb.html">lib/facets/core/string/at.rb</a>
|
70
|
-
<a href="../files/lib/facets/core/string/margin_rb.html">lib/facets/core/string/margin.rb</a>
|
71
|
-
<a href="../files/lib/facets/core/string/dequote_rb.html">lib/facets/core/string/dequote.rb</a>
|
72
|
-
<a href="../files/lib/facets/core/string/word_wrap_rb.html">lib/facets/core/string/word_wrap.rb</a>
|
73
|
-
<a href="../files/lib/facets/core/string/last_rb.html">lib/facets/core/string/last.rb</a>
|
74
|
-
<a href="../files/lib/facets/core/string/unpack_rb.html">lib/facets/core/string/unpack.rb</a>
|
75
|
-
<a href="../files/lib/facets/core/string/rand_index_rb.html">lib/facets/core/string/rand_index.rb</a>
|
76
|
-
<a href="../files/lib/facets/core/string/nchar_rb.html">lib/facets/core/string/nchar.rb</a>
|
77
|
-
<a href="../files/lib/facets/core/string/singular_rb.html">lib/facets/core/string/singular.rb</a>
|
78
|
-
<a href="../files/lib/facets/core/string/brief_rb.html">lib/facets/core/string/brief.rb</a>
|
79
|
-
<a href="../files/lib/facets/core/string/similarity_rb.html">lib/facets/core/string/similarity.rb</a>
|
80
|
-
<a href="../files/lib/facets/core/string/rand_byte_rb.html">lib/facets/core/string/rand_byte.rb</a>
|
81
|
-
<a href="../files/lib/facets/core/string/to_proc_rb.html">lib/facets/core/string/to_proc.rb</a>
|
82
|
-
<a href="../files/lib/facets/core/string/blank_rb.html">lib/facets/core/string/blank.rb</a>
|
83
|
-
<a href="../files/lib/facets/core/string/demodulize_rb.html">lib/facets/core/string/demodulize.rb</a>
|
84
|
-
<a href="../files/lib/facets/core/string/to_date_rb.html">lib/facets/core/string/to_date.rb</a>
|
85
|
-
<a href="../files/lib/facets/core/string/chars_rb.html">lib/facets/core/string/chars.rb</a>
|
86
|
-
<a href="../files/lib/facets/core/string/pot_rb.html">lib/facets/core/string/pot.rb</a>
|
87
|
-
<a href="../files/lib/facets/core/string/starts_with_rb.html">lib/facets/core/string/starts_with.rb</a>
|
88
|
-
<a href="../files/lib/facets/core/string/first_char_rb.html">lib/facets/core/string/first_char.rb</a>
|
89
|
-
<a href="../files/lib/facets/core/string/capitalized_rb.html">lib/facets/core/string/capitalized.rb</a>
|
90
|
-
<a href="../files/lib/facets/core/string/bytes_rb.html">lib/facets/core/string/bytes.rb</a>
|
91
|
-
<a href="../files/lib/facets/core/string/basename_rb.html">lib/facets/core/string/basename.rb</a>
|
92
|
-
<a href="../files/lib/facets/core/string/downcase_rb.html">lib/facets/core/string/downcase.rb</a>
|
93
|
-
<a href="../files/lib/facets/core/string/succ_rb.html">lib/facets/core/string/succ.rb</a>
|
94
|
-
<a href="../files/lib/facets/core/string/probability_rb.html">lib/facets/core/string/probability.rb</a>
|
95
|
-
<a href="../files/lib/facets/core/string/cmp_rb.html">lib/facets/core/string/cmp.rb</a>
|
96
|
-
<a href="../files/lib/facets/core/string/whitespace_rb.html">lib/facets/core/string/whitespace.rb</a>
|
97
|
-
<a href="../files/lib/facets/core/string/at_rand_rb.html">lib/facets/core/string/at_rand.rb</a>
|
98
|
-
<a href="../files/lib/facets/core/string/first_rb.html">lib/facets/core/string/first.rb</a>
|
99
|
-
<a href="../files/lib/facets/core/string/fold_rb.html">lib/facets/core/string/fold.rb</a>
|
100
|
-
<a href="../files/lib/facets/core/string/camelize_rb.html">lib/facets/core/string/camelize.rb</a>
|
101
|
-
<a href="../files/lib/facets/core/string/unbracket_rb.html">lib/facets/core/string/unbracket.rb</a>
|
102
|
-
<a href="../files/lib/facets/core/string/range_rb.html">lib/facets/core/string/range.rb</a>
|
103
|
-
<a href="../files/lib/facets/core/string/to_a_rb.html">lib/facets/core/string/to_a.rb</a>
|
104
|
-
<a href="../files/lib/facets/core/string/to_b_rb.html">lib/facets/core/string/to_b.rb</a>
|
105
|
-
<a href="../files/lib/facets/core/string/to_re_rb.html">lib/facets/core/string/to_re.rb</a>
|
106
|
-
<a href="../files/lib/facets/core/string/last_char_rb.html">lib/facets/core/string/last_char.rb</a>
|
107
|
-
<a href="../files/lib/facets/core/string/line_wrap_rb.html">lib/facets/core/string/line_wrap.rb</a>
|
108
|
-
<a href="../files/lib/facets/core/string/align_center_rb.html">lib/facets/core/string/align_center.rb</a>
|
109
|
-
<a href="../files/lib/facets/core/string/words_rb.html">lib/facets/core/string/words.rb</a>
|
110
|
-
<a href="../files/lib/facets/core/string/indent_rb.html">lib/facets/core/string/indent.rb</a>
|
111
|
-
<a href="../files/lib/facets/core/string/upcase_rb.html">lib/facets/core/string/upcase.rb</a>
|
112
|
-
<a href="../files/lib/facets/core/string/format_rb.html">lib/facets/core/string/format.rb</a>
|
113
|
-
<a href="../files/lib/facets/core/string/to_const_rb.html">lib/facets/core/string/to_const.rb</a>
|
114
|
-
<a href="../files/lib/facets/core/string/pop_rb.html">lib/facets/core/string/pop.rb</a>
|
115
|
-
<a href="../files/lib/facets/core/string/range_of_line_rb.html">lib/facets/core/string/range_of_line.rb</a>
|
116
|
-
<a href="../files/lib/facets/core/string/frequency_rb.html">lib/facets/core/string/frequency.rb</a>
|
117
|
-
<a href="../files/lib/facets/core/string/lowercase_rb.html">lib/facets/core/string/lowercase.rb</a>
|
118
|
-
<a href="../files/lib/facets/core/string/to_time_rb.html">lib/facets/core/string/to_time.rb</a>
|
119
|
-
<a href="../files/lib/facets/core/string/ordinal_rb.html">lib/facets/core/string/ordinal.rb</a>
|
120
|
-
<a href="../files/lib/facets/core/string/shuffle_rb.html">lib/facets/core/string/shuffle.rb</a>
|
121
|
-
<a href="../files/lib/facets/core/string/each_char_rb.html">lib/facets/core/string/each_char.rb</a>
|
122
|
-
<a href="../files/lib/facets/core/string/unshift_rb.html">lib/facets/core/string/unshift.rb</a>
|
123
|
-
<a href="../files/lib/facets/core/string/each_word_rb.html">lib/facets/core/string/each_word.rb</a>
|
124
|
-
<a href="../files/lib/facets/core/string/bracket_rb.html">lib/facets/core/string/bracket.rb</a>
|
125
|
-
<a href="../files/lib/facets/core/string/index_all_rb.html">lib/facets/core/string/index_all.rb</a>
|
126
|
-
<a href="../files/lib/facets/core/string/quote_rb.html">lib/facets/core/string/quote.rb</a>
|
127
|
-
<a href="../files/lib/facets/core/string/regesc_rb.html">lib/facets/core/string/regesc.rb</a>
|
128
|
-
<a href="../files/lib/facets/core/string/soundex_rb.html">lib/facets/core/string/soundex.rb</a>
|
129
|
-
<a href="../files/lib/facets/core/string/range_all_rb.html">lib/facets/core/string/range_all.rb</a>
|
130
|
-
<a href="../files/lib/facets/core/string/mscan_rb.html">lib/facets/core/string/mscan.rb</a>
|
131
|
-
<a href="../files/lib/facets/core/string/shatter_rb.html">lib/facets/core/string/shatter.rb</a>
|
132
|
-
<a href="../files/lib/facets/core/string/underscore_rb.html">lib/facets/core/string/underscore.rb</a>
|
133
|
-
<a href="../files/lib/facets/core/string/natcmp_rb.html">lib/facets/core/string/natcmp.rb</a>
|
134
|
-
<a href="../files/lib/facets/core/string/lines_rb.html">lib/facets/core/string/lines.rb</a>
|
135
|
-
<a href="../files/lib/facets/core/string/modulize_rb.html">lib/facets/core/string/modulize.rb</a>
|
136
|
-
<a href="../files/lib/facets/core/string/pathize_rb.html">lib/facets/core/string/pathize.rb</a>
|
137
|
-
<a href="../files/lib/facets/core/string/methodize_rb.html">lib/facets/core/string/methodize.rb</a>
|
138
|
-
<a href="../files/lib/facets/core/string/shell_escape_rb.html">lib/facets/core/string/shell_escape.rb</a>
|
139
|
-
<a href="../files/lib/facets/core/string/self/patterns_rb.html">lib/facets/core/string/self/patterns.rb</a>
|
140
|
-
<a href="../files/lib/facets/core/string/self/rand_letter_rb.html">lib/facets/core/string/self/rand_letter.rb</a>
|
141
|
-
<a href="../files/lib/facets/core/string/self/interpolate_rb.html">lib/facets/core/string/self/interpolate.rb</a>
|
142
|
-
</td>
|
143
|
-
</tr>
|
144
|
-
<tr>
|
145
|
-
<td>Parent:</td>
|
146
|
-
<td>
|
147
|
-
<a href="Object.html">
|
148
|
-
Object
|
149
|
-
</a>
|
150
|
-
</td>
|
151
|
-
</tr>
|
152
|
-
</table>
|
153
|
-
</td>
|
154
|
-
</tr>
|
155
|
-
</table>
|
156
|
-
<!-- banner header -->
|
157
|
-
|
158
|
-
<div id="bodyContent">
|
159
|
-
<div id="content">
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
<div class="sectiontitle">Methods</div>
|
165
|
-
<ul>
|
166
|
-
<li><a href="#M000345">align_center</a></li>
|
167
|
-
<li><a href="#M000344">align_left</a></li>
|
168
|
-
<li><a href="#M000343">align_right</a></li>
|
169
|
-
<li><a href="#M000327">at_rand</a></li>
|
170
|
-
<li><a href="#M000328">at_rand!</a></li>
|
171
|
-
<li><a href="#M000321">basename</a></li>
|
172
|
-
<li><a href="#M000311">blank?</a></li>
|
173
|
-
<li><a href="#M000365">bra2ket</a></li>
|
174
|
-
<li><a href="#M000366">bracket</a></li>
|
175
|
-
<li><a href="#M000367">bracket!</a></li>
|
176
|
-
<li><a href="#M000305">brief</a></li>
|
177
|
-
<li><a href="#M000320">bytes</a></li>
|
178
|
-
<li><a href="#M000289">camelcase</a></li>
|
179
|
-
<li><a href="#M000333">camelize</a></li>
|
180
|
-
<li><a href="#M000319">capitalized?</a></li>
|
181
|
-
<li><a href="#M000314">chars</a></li>
|
182
|
-
<li><a href="#M000325">cmp</a></li>
|
183
|
-
<li><a href="#M000292">dequote</a></li>
|
184
|
-
<li><a href="#M000322">downcase?</a></li>
|
185
|
-
<li><a href="#M000283">dresner</a></li>
|
186
|
-
<li><a href="#M000284">dresner!</a></li>
|
187
|
-
<li><a href="#M000362">each_char</a></li>
|
188
|
-
<li><a href="#M000364">each_word</a></li>
|
189
|
-
<li><a href="#M000317">ends_with?</a></li>
|
190
|
-
<li><a href="#M000279">entropy</a></li>
|
191
|
-
<li><a href="#M000329">first</a></li>
|
192
|
-
<li><a href="#M000330">first!</a></li>
|
193
|
-
<li><a href="#M000331">first=</a></li>
|
194
|
-
<li><a href="#M000318">first_char</a></li>
|
195
|
-
<li><a href="#M000332">fold</a></li>
|
196
|
-
<li><a href="#M000352">format</a></li>
|
197
|
-
<li><a href="#M000386">format</a></li>
|
198
|
-
<li><a href="#M000356">frequency</a></li>
|
199
|
-
<li><a href="#M000307">fuzzy_match</a></li>
|
200
|
-
<li><a href="#M000290">humanize</a></li>
|
201
|
-
<li><a href="#M000349">indent</a></li>
|
202
|
-
<li><a href="#M000368">index_all</a></li>
|
203
|
-
<li><a href="#M000388">interpolate</a></li>
|
204
|
-
<li><a href="#M000295">last</a></li>
|
205
|
-
<li><a href="#M000297">last!</a></li>
|
206
|
-
<li><a href="#M000296">last=</a></li>
|
207
|
-
<li><a href="#M000341">last_char</a></li>
|
208
|
-
<li><a href="#M000342">line_wrap</a></li>
|
209
|
-
<li><a href="#M000378">lines</a></li>
|
210
|
-
<li><a href="#M000357">lowercase?</a></li>
|
211
|
-
<li><a href="#M000291">margin</a></li>
|
212
|
-
<li><a href="#M000381">methodize</a></li>
|
213
|
-
<li><a href="#M000379">modulize</a></li>
|
214
|
-
<li><a href="#M000374">mscan</a></li>
|
215
|
-
<li><a href="#M000377">natcmp</a></li>
|
216
|
-
<li><a href="#M000300">nchar</a></li>
|
217
|
-
<li><a href="#M000359">ordinal</a></li>
|
218
|
-
<li><a href="#M000380">pathize</a></li>
|
219
|
-
<li><a href="#M000383">patterns</a></li>
|
220
|
-
<li><a href="#M000302">plural</a></li>
|
221
|
-
<li><a href="#M000304">pluralize</a></li>
|
222
|
-
<li><a href="#M000354">pop</a></li>
|
223
|
-
<li><a href="#M000315">pot</a></li>
|
224
|
-
<li><a href="#M000324">probability</a></li>
|
225
|
-
<li><a href="#M000280">pull</a></li>
|
226
|
-
<li><a href="#M000281">push</a></li>
|
227
|
-
<li><a href="#M000369">quote</a></li>
|
228
|
-
<li><a href="#M000308">rand_byte</a></li>
|
229
|
-
<li><a href="#M000309">rand_byte!</a></li>
|
230
|
-
<li><a href="#M000299">rand_index</a></li>
|
231
|
-
<li><a href="#M000384">rand_letter</a></li>
|
232
|
-
<li><a href="#M000385">random</a></li>
|
233
|
-
<li><a href="#M000336">range</a></li>
|
234
|
-
<li><a href="#M000373">range_all</a></li>
|
235
|
-
<li><a href="#M000355">range_of_line</a></li>
|
236
|
-
<li><a href="#M000370">regesc</a></li>
|
237
|
-
<li><a href="#M000375">shatter</a></li>
|
238
|
-
<li><a href="#M000382">shell_escape</a></li>
|
239
|
-
<li><a href="#M000282">shift</a></li>
|
240
|
-
<li><a href="#M000360">shuffle</a></li>
|
241
|
-
<li><a href="#M000361">shuffle!</a></li>
|
242
|
-
<li><a href="#M000306">similarity</a></li>
|
243
|
-
<li><a href="#M000301">singular</a></li>
|
244
|
-
<li><a href="#M000303">singularize</a></li>
|
245
|
-
<li><a href="#M000371">soundex</a></li>
|
246
|
-
<li><a href="#M000372">soundex_code</a></li>
|
247
|
-
<li><a href="#M000387">sprintf</a></li>
|
248
|
-
<li><a href="#M000316">starts_with?</a></li>
|
249
|
-
<li><a href="#M000323">succ</a></li>
|
250
|
-
<li><a href="#M000347">tab</a></li>
|
251
|
-
<li><a href="#M000348">tabto</a></li>
|
252
|
-
<li><a href="#M000337">to_a</a></li>
|
253
|
-
<li><a href="#M000338">to_b</a></li>
|
254
|
-
<li><a href="#M000353">to_const</a></li>
|
255
|
-
<li><a href="#M000313">to_date</a></li>
|
256
|
-
<li><a href="#M000310">to_proc</a></li>
|
257
|
-
<li><a href="#M000339">to_re</a></li>
|
258
|
-
<li><a href="#M000340">to_rx</a></li>
|
259
|
-
<li><a href="#M000358">to_time</a></li>
|
260
|
-
<li><a href="#M000334">unbracket</a></li>
|
261
|
-
<li><a href="#M000335">unbracket!</a></li>
|
262
|
-
<li><a href="#M000376">underscore</a></li>
|
263
|
-
<li><a href="#M000287">unix_crypt</a></li>
|
264
|
-
<li><a href="#M000288">unix_crypt!</a></li>
|
265
|
-
<li><a href="#M000298">unpack</a></li>
|
266
|
-
<li><a href="#M000363">unshift</a></li>
|
267
|
-
<li><a href="#M000350">upcase?</a></li>
|
268
|
-
<li><a href="#M000351">uppercase?</a></li>
|
269
|
-
<li><a href="#M000312">whitespace?</a></li>
|
270
|
-
<li><a href="#M000326">whitespace?</a></li>
|
271
|
-
<li><a href="#M000285">word_filter</a></li>
|
272
|
-
<li><a href="#M000286">word_filter!</a></li>
|
273
|
-
<li><a href="#M000293">word_wrap</a></li>
|
274
|
-
<li><a href="#M000294">word_wrap!</a></li>
|
275
|
-
<li><a href="#M000346">words</a></li>
|
276
|
-
</ul>
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
<div class="sectiontitle">Constants</div>
|
282
|
-
<table border='0' cellpadding='5'>
|
283
|
-
<tr valign='top'>
|
284
|
-
<td class="attr-name">SINGULAR_RULES</td>
|
285
|
-
<td>=</td>
|
286
|
-
<td class="attr-value">[ [/(matr)ices$/i, '\1ix'], [/(vert)ices$/i, '\1ex'], [/^(ox)en/i, '\1'], [/(alias)es$/i, '\1'], [/([octop|vir])i$/i, '\1us'], [/(cris|ax|test)es$/i, '\1is'], [/(shoe)s$/i, '\1'], [/(o)es$/i, '\1'], [/(bus)es$/i, '\1'], [/([m|l])ice$/i, '\1ouse'], [/(x|ch|ss|sh)es$/i, '\1'], [/(m)ovies$/i, '\1\2ovie'], [/(s)eries$/i, '\1\2eries'], [/([^aeiouy]|qu)ies$/i, '\1y'], [/([lr])ves$/i, '\1f'], [/(tive)s$/i, '\1'], [/(hive)s$/i, '\1'], [/([^f])ves$/i, '\1fe'], [/(^analy)ses$/i, '\1sis'], [/((a)naly|(b)a|(d)iagno|(p)arenthe|(p)rogno|(s)ynop|(t)he)ses$/i, '\1\2sis'], [/([ti])a$/i, '\1um'], [/(p)eople$/i, '\1\2erson'], [/(m)en$/i, '\1an'], [/(s)tatus$/i, '\1\2tatus'], [/(c)hildren$/i, '\1\2hild'], [/(n)ews$/i, '\1\2ews'], [/s$/i, '']</td>
|
287
|
-
</tr>
|
288
|
-
<tr valign='top'>
|
289
|
-
<td class="attr-name">PLURAL_RULES</td>
|
290
|
-
<td>=</td>
|
291
|
-
<td class="attr-value">[ [/^(ox)$/i, '\1\2en'], # ox [/([m|l])ouse$/i, '\1ice'], # mouse, louse [/(matr|vert)ix|ex$/i, '\1ices'], # matrix, vertex, index [/(x|ch|ss|sh)$/i, '\1es'], # search, switch, fix, box, process, address [/([^aeiouy]|qu)ies$/i, '\1y'], [/([^aeiouy]|qu)y$/i, '\1ies'], # query, ability, agency [/(hive)$/i, '\1s'], # archive, hive [/(?:([^f])fe|([lr])f)$/i, '\1\2ves'], # half, safe, wife [/sis$/i, 'ses'], # basis, diagnosis [/([ti])um$/i, '\1a'], # datum, medium [/(p)erson$/i, '\1eople'], # person, salesperson [/(m)an$/i, '\1en'], # man, woman, spokesman [/(c)hild$/i, '\1hildren'], # child [/(buffal|tomat|potat)o$/i, '\1\2oes'], # buffalo, tomato [/(bu)s$/i, '\1\2ses'], # bus [/(alias)/i, '\1es'], # alias [/(octop|vir)us$/i, '\1i'], # octopus, virus - virus has no defined plural, but viri is better than viruses/viruss [/(ax|cri|test)is$/i, '\1es'], # axis, crisis [/s$/i, 's'], # no change (compatibility) [/$/, 's']</td>
|
292
|
-
</tr>
|
293
|
-
</table>
|
294
|
-
|
295
|
-
|
296
|
-
<div class="sectiontitle">Public Class methods</div>
|
297
|
-
<div class="method">
|
298
|
-
<div class="title">
|
299
|
-
<a name="M000365"></a><b>bra2ket</b>()
|
300
|
-
</div>
|
301
|
-
<div class="sourcecode">
|
302
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000365_source')" id="l_M000365_source">show source</a> ]</p>
|
303
|
-
<div id="M000365_source" class="dyn-source">
|
304
|
-
<pre>
|
305
|
-
<span class="ruby-comment cmt"># File lib/facets/core/string/bracket.rb, line 4</span>
|
306
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">bra2ket</span>
|
307
|
-
<span class="ruby-ivar">@bra2ket</span> <span class="ruby-operator">||=</span> { <span class="ruby-value str">'['</span>=<span class="ruby-operator">></span><span class="ruby-value str">']'</span>, <span class="ruby-value str">'('</span>=<span class="ruby-operator">></span><span class="ruby-value str">')'</span>, <span class="ruby-value str">'{'</span>=<span class="ruby-operator">></span><span class="ruby-value str">'}'</span>, <span class="ruby-value str">'<'</span>=<span class="ruby-operator">></span><span class="ruby-value str">'>'</span> }
|
308
|
-
<span class="ruby-keyword kw">end</span>
|
309
|
-
</pre>
|
310
|
-
</div>
|
311
|
-
</div>
|
312
|
-
</div>
|
313
|
-
<div class="method">
|
314
|
-
<div class="title">
|
315
|
-
<a name="M000386"></a><b>format</b>(*args)
|
316
|
-
</div>
|
317
|
-
<div class="sourcecode">
|
318
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000386_source')" id="l_M000386_source">show source</a> ]</p>
|
319
|
-
<div id="M000386_source" class="dyn-source">
|
320
|
-
<pre>
|
321
|
-
<span class="ruby-comment cmt"># File lib/facets/core/string/self/format.rb, line 2</span>
|
322
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-constant">String</span>.<span class="ruby-identifier">format</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
|
323
|
-
<span class="ruby-constant">Kernel</span>.<span class="ruby-identifier">format</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
|
324
|
-
<span class="ruby-keyword kw">end</span>
|
325
|
-
</pre>
|
326
|
-
</div>
|
327
|
-
</div>
|
328
|
-
</div>
|
329
|
-
<div class="method">
|
330
|
-
<div class="title">
|
331
|
-
<a name="M000388"></a><b>interpolate</b>(&str)
|
332
|
-
</div>
|
333
|
-
<div class="sourcecode">
|
334
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000388_source')" id="l_M000388_source">show source</a> ]</p>
|
335
|
-
<div id="M000388_source" class="dyn-source">
|
336
|
-
<pre>
|
337
|
-
<span class="ruby-comment cmt"># File lib/facets/core/string/self/interpolate.rb, line 4</span>
|
338
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">interpolate</span>(<span class="ruby-operator">&</span><span class="ruby-identifier">str</span>)
|
339
|
-
<span class="ruby-identifier">eval</span> <span class="ruby-node">"%{#{str.call}}"</span>, <span class="ruby-identifier">str</span>.<span class="ruby-identifier">binding</span>
|
340
|
-
<span class="ruby-keyword kw">end</span>
|
341
|
-
</pre>
|
342
|
-
</div>
|
343
|
-
</div>
|
344
|
-
</div>
|
345
|
-
<div class="method">
|
346
|
-
<div class="title">
|
347
|
-
<a name="M000383"></a><b>patterns</b>( pattern )
|
348
|
-
</div>
|
349
|
-
<div class="description">
|
350
|
-
<p>
|
351
|
-
Returns a <a href="Regexp.html">Regexp</a> pattern based on the given
|
352
|
-
pattern string or symbolic name.
|
353
|
-
</p>
|
354
|
-
<p>
|
355
|
-
Recognized names are:
|
356
|
-
</p>
|
357
|
-
<ul>
|
358
|
-
<li>:char
|
359
|
-
|
360
|
-
</li>
|
361
|
-
<li>:word
|
362
|
-
|
363
|
-
</li>
|
364
|
-
<li>:line
|
365
|
-
|
366
|
-
</li>
|
367
|
-
</ul>
|
368
|
-
<p>
|
369
|
-
They are also recognizied in plural form.
|
370
|
-
</p>
|
371
|
-
</div>
|
372
|
-
<div class="sourcecode">
|
373
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000383_source')" id="l_M000383_source">show source</a> ]</p>
|
374
|
-
<div id="M000383_source" class="dyn-source">
|
375
|
-
<pre>
|
376
|
-
<span class="ruby-comment cmt"># File lib/facets/core/string/self/patterns.rb, line 14</span>
|
377
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">patterns</span>( <span class="ruby-identifier">pattern</span> )
|
378
|
-
<span class="ruby-keyword kw">case</span> <span class="ruby-identifier">pattern</span>
|
379
|
-
<span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:char</span>, <span class="ruby-identifier">:chars</span>, <span class="ruby-identifier">:character</span>, <span class="ruby-identifier">:characters</span>
|
380
|
-
<span class="ruby-identifier">pattern</span> = <span class="ruby-regexp re">//</span>
|
381
|
-
<span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:word</span>, <span class="ruby-identifier">:words</span>
|
382
|
-
<span class="ruby-identifier">pattern</span> = <span class="ruby-regexp re">/\s+|\Z/</span>
|
383
|
-
<span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:line</span>, <span class="ruby-identifier">:lines</span>
|
384
|
-
<span class="ruby-identifier">pattern</span> = <span class="ruby-regexp re">/\Z/</span>
|
385
|
-
<span class="ruby-keyword kw">when</span> <span class="ruby-constant">String</span>
|
386
|
-
<span class="ruby-identifier">pattern</span> = <span class="ruby-constant">Regexp</span>.<span class="ruby-identifier">new</span>(<span class="ruby-constant">Regexp</span>.<span class="ruby-identifier">escape</span>(<span class="ruby-identifier">pattern</span>))
|
387
|
-
<span class="ruby-keyword kw">end</span>
|
388
|
-
<span class="ruby-identifier">pattern</span>
|
389
|
-
<span class="ruby-keyword kw">end</span>
|
390
|
-
</pre>
|
391
|
-
</div>
|
392
|
-
</div>
|
393
|
-
</div>
|
394
|
-
<div class="method">
|
395
|
-
<div class="title">
|
396
|
-
<a name="M000384"></a><b>rand_letter</b>()
|
397
|
-
</div>
|
398
|
-
<div class="description">
|
399
|
-
<p>
|
400
|
-
<a href="Module.html">Module</a> method to generate a random letter.
|
401
|
-
</p>
|
402
|
-
<pre>
|
403
|
-
String::Random.rand_letter #=> "q"
|
404
|
-
String::Random.rand_letter #=> "r"
|
405
|
-
String::Random.rand_letter #=> "a"
|
406
|
-
</pre>
|
407
|
-
</div>
|
408
|
-
<div class="sourcecode">
|
409
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000384_source')" id="l_M000384_source">show source</a> ]</p>
|
410
|
-
<div id="M000384_source" class="dyn-source">
|
411
|
-
<pre>
|
412
|
-
<span class="ruby-comment cmt"># File lib/facets/core/string/self/rand_letter.rb, line 9</span>
|
413
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">rand_letter</span>
|
414
|
-
(<span class="ruby-identifier">rand</span>(<span class="ruby-value">26</span>) <span class="ruby-operator">+</span> (<span class="ruby-identifier">rand</span>(<span class="ruby-value">2</span>) <span class="ruby-operator">==</span> <span class="ruby-value">0</span> <span class="ruby-operator">?</span> <span class="ruby-value">65</span> <span class="ruby-operator">:</span> <span class="ruby-value">97</span>) ).<span class="ruby-identifier">chr</span>
|
415
|
-
<span class="ruby-keyword kw">end</span>
|
416
|
-
</pre>
|
417
|
-
</div>
|
418
|
-
</div>
|
419
|
-
</div>
|
420
|
-
<div class="method">
|
421
|
-
<div class="title">
|
422
|
-
<a name="M000385"></a><b>random</b>(max_length = 8, char_re = /[\w\d]/)
|
423
|
-
</div>
|
424
|
-
<div class="description">
|
425
|
-
<p>
|
426
|
-
Returns a randomly generated string. One possible use is password
|
427
|
-
initialization. Takes a max legnth of characters (default 8) and an
|
428
|
-
optional valid char <a href="Regexp.html">Regexp</a> (default /\w\d/).
|
429
|
-
</p>
|
430
|
-
</div>
|
431
|
-
<div class="sourcecode">
|
432
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000385_source')" id="l_M000385_source">show source</a> ]</p>
|
433
|
-
<div id="M000385_source" class="dyn-source">
|
434
|
-
<pre>
|
435
|
-
<span class="ruby-comment cmt"># File lib/facets/core/string/self/random.rb, line 14</span>
|
436
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-constant">String</span>.<span class="ruby-identifier">random</span>(<span class="ruby-identifier">max_length</span> = <span class="ruby-value">8</span>, <span class="ruby-identifier">char_re</span> = <span class="ruby-regexp re">/[\w\d]/</span>)
|
437
|
-
<span class="ruby-comment cmt"># gmosx: this is a nice example of input parameter checking.</span>
|
438
|
-
<span class="ruby-comment cmt"># this is NOT a real time called method so we can add this</span>
|
439
|
-
<span class="ruby-comment cmt"># check. Congrats to the author.</span>
|
440
|
-
<span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">'char_re must be a regular expression!'</span>) <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">char_re</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Regexp</span>)
|
441
|
-
|
442
|
-
<span class="ruby-identifier">string</span> = <span class="ruby-value str">""</span>
|
443
|
-
|
444
|
-
<span class="ruby-keyword kw">while</span> <span class="ruby-identifier">string</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator"><</span> <span class="ruby-identifier">max_length</span>
|
445
|
-
<span class="ruby-identifier">ch</span> = <span class="ruby-identifier">rand</span>(<span class="ruby-value">255</span>).<span class="ruby-identifier">chr</span>
|
446
|
-
<span class="ruby-identifier">string</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">ch</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">ch</span> <span class="ruby-operator">=~</span> <span class="ruby-identifier">char_re</span>
|
447
|
-
<span class="ruby-keyword kw">end</span>
|
448
|
-
|
449
|
-
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">string</span>
|
450
|
-
<span class="ruby-keyword kw">end</span>
|
451
|
-
</pre>
|
452
|
-
</div>
|
453
|
-
</div>
|
454
|
-
</div>
|
455
|
-
<div class="method">
|
456
|
-
<div class="title">
|
457
|
-
<a name="M000372"></a><b>soundex_code</b>(character)
|
458
|
-
</div>
|
459
|
-
<div class="description">
|
460
|
-
<p>
|
461
|
-
Support function for <a href="String.html#M000371">String#soundex</a>.
|
462
|
-
Returns code for a single character.
|
463
|
-
</p>
|
464
|
-
</div>
|
465
|
-
<div class="sourcecode">
|
466
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000372_source')" id="l_M000372_source">show source</a> ]</p>
|
467
|
-
<div id="M000372_source" class="dyn-source">
|
468
|
-
<pre>
|
469
|
-
<span class="ruby-comment cmt"># File lib/facets/core/string/soundex.rb, line 40</span>
|
470
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-constant">String</span>.<span class="ruby-identifier">soundex_code</span>(<span class="ruby-identifier">character</span>)
|
471
|
-
<span class="ruby-identifier">character</span>.<span class="ruby-identifier">tr!</span> <span class="ruby-value str">"AEIOUYWHBPFVCSKGJQXZDTLMNR"</span>, <span class="ruby-value str">"00000000111122222222334556"</span>
|
472
|
-
<span class="ruby-keyword kw">end</span>
|
473
|
-
</pre>
|
474
|
-
</div>
|
475
|
-
</div>
|
476
|
-
</div>
|
477
|
-
<div class="method">
|
478
|
-
<div class="title">
|
479
|
-
<a name="M000387"></a><b>sprintf</b>(*args)
|
480
|
-
</div>
|
481
|
-
<div class="sourcecode">
|
482
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000387_source')" id="l_M000387_source">show source</a> ]</p>
|
483
|
-
<div id="M000387_source" class="dyn-source">
|
484
|
-
<pre>
|
485
|
-
<span class="ruby-comment cmt"># File lib/facets/core/string/self/format.rb, line 6</span>
|
486
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-constant">String</span>.<span class="ruby-identifier">sprintf</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
|
487
|
-
<span class="ruby-constant">Kernel</span>.<span class="ruby-identifier">format</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
|
488
|
-
<span class="ruby-keyword kw">end</span>
|
489
|
-
</pre>
|
490
|
-
</div>
|
491
|
-
</div>
|
492
|
-
</div>
|
493
|
-
<div class="sectiontitle">Public Instance methods</div>
|
494
|
-
<div class="method">
|
495
|
-
<div class="title">
|
496
|
-
<a name="M000345"></a><b>align_center</b>( n, sep="\n", c=' ' )
|
497
|
-
</div>
|
498
|
-
<div class="description">
|
499
|
-
<p>
|
500
|
-
Centers each line of a string.
|
501
|
-
</p>
|
502
|
-
<pre>
|
503
|
-
s = <<-EOS
|
504
|
-
This is a test
|
505
|
-
and
|
506
|
-
so on
|
507
|
-
EOS
|
508
|
-
puts s.align_center(14)
|
509
|
-
</pre>
|
510
|
-
<p>
|
511
|
-
<em>produces</em>
|
512
|
-
</p>
|
513
|
-
<pre>
|
514
|
-
This is a test
|
515
|
-
and
|
516
|
-
so on
|
517
|
-
</pre>
|
518
|
-
<p>
|
519
|
-
Align a string to the center. The defualt alignment seperation is a new
|
520
|
-
line ("/n") This can be changed as can be the padding string
|
521
|
-
which defaults to a single space (’ ’).
|
522
|
-
</p>
|
523
|
-
</div>
|
524
|
-
<div class="sourcecode">
|
525
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000345_source')" id="l_M000345_source">show source</a> ]</p>
|
526
|
-
<div id="M000345_source" class="dyn-source">
|
527
|
-
<pre>
|
528
|
-
<span class="ruby-comment cmt"># File lib/facets/core/string/align_center.rb, line 47</span>
|
529
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">align_center</span>( <span class="ruby-identifier">n</span>, <span class="ruby-identifier">sep</span>=<span class="ruby-value str">"\n"</span>, <span class="ruby-identifier">c</span>=<span class="ruby-value str">' '</span> )
|
530
|
-
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">center</span>(<span class="ruby-identifier">n</span>.<span class="ruby-identifier">to_i</span>,<span class="ruby-identifier">c</span>.<span class="ruby-identifier">to_s</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">sep</span><span class="ruby-operator">==</span><span class="ruby-keyword kw">nil</span>
|
531
|
-
<span class="ruby-identifier">q</span> = <span class="ruby-identifier">split</span>(<span class="ruby-identifier">sep</span>.<span class="ruby-identifier">to_s</span>).<span class="ruby-identifier">collect</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">line</span><span class="ruby-operator">|</span>
|
532
|
-
<span class="ruby-identifier">line</span>.<span class="ruby-identifier">center</span>(<span class="ruby-identifier">n</span>.<span class="ruby-identifier">to_i</span>,<span class="ruby-identifier">c</span>.<span class="ruby-identifier">to_s</span>)
|
533
|
-
}
|
534
|
-
<span class="ruby-identifier">q</span>.<span class="ruby-identifier">join</span>(<span class="ruby-identifier">sep</span>.<span class="ruby-identifier">to_s</span>)
|
535
|
-
<span class="ruby-keyword kw">end</span>
|
536
|
-
</pre>
|
537
|
-
</div>
|
538
|
-
</div>
|
539
|
-
</div>
|
540
|
-
<div class="method">
|
541
|
-
<div class="title">
|
542
|
-
<a name="M000344"></a><b>align_left</b>( n, sep="\n", c=' ' )
|
543
|
-
</div>
|
544
|
-
<div class="description">
|
545
|
-
<p>
|
546
|
-
Align a string to the left. The defualt alignment seperation is a new line
|
547
|
-
("/n") This can be changes as can be the padding string which
|
548
|
-
defaults to a single space (’ ’).
|
549
|
-
</p>
|
550
|
-
</div>
|
551
|
-
<div class="sourcecode">
|
552
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000344_source')" id="l_M000344_source">show source</a> ]</p>
|
553
|
-
<div id="M000344_source" class="dyn-source">
|
554
|
-
<pre>
|
555
|
-
<span class="ruby-comment cmt"># File lib/facets/core/string/align_center.rb, line 20</span>
|
556
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">align_left</span>( <span class="ruby-identifier">n</span>, <span class="ruby-identifier">sep</span>=<span class="ruby-value str">"\n"</span>, <span class="ruby-identifier">c</span>=<span class="ruby-value str">' '</span> )
|
557
|
-
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">ljust</span>(<span class="ruby-identifier">n</span>.<span class="ruby-identifier">to_i</span>,<span class="ruby-identifier">c</span>.<span class="ruby-identifier">to_s</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">sep</span><span class="ruby-operator">==</span><span class="ruby-keyword kw">nil</span>
|
558
|
-
<span class="ruby-identifier">q</span> = <span class="ruby-identifier">split</span>(<span class="ruby-identifier">sep</span>.<span class="ruby-identifier">to_s</span>).<span class="ruby-identifier">collect</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">line</span><span class="ruby-operator">|</span>
|
559
|
-
<span class="ruby-identifier">line</span>.<span class="ruby-identifier">ljust</span>(<span class="ruby-identifier">n</span>.<span class="ruby-identifier">to_i</span>,<span class="ruby-identifier">c</span>.<span class="ruby-identifier">to_s</span>)
|
560
|
-
}
|
561
|
-
<span class="ruby-identifier">q</span>.<span class="ruby-identifier">join</span>(<span class="ruby-identifier">sep</span>.<span class="ruby-identifier">to_s</span>)
|
562
|
-
<span class="ruby-keyword kw">end</span>
|
563
|
-
</pre>
|
564
|
-
</div>
|
565
|
-
</div>
|
566
|
-
</div>
|
567
|
-
<div class="method">
|
568
|
-
<div class="title">
|
569
|
-
<a name="M000343"></a><b>align_right</b>( n, sep="\n", c=' ' )
|
570
|
-
</div>
|
571
|
-
<div class="description">
|
572
|
-
<p>
|
573
|
-
Align a string to the right. The defualt alignment seperation is a new line
|
574
|
-
("/n") This can be changes as can be the padding string which
|
575
|
-
defaults to a single space (’ ’).
|
576
|
-
</p>
|
577
|
-
</div>
|
578
|
-
<div class="sourcecode">
|
579
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000343_source')" id="l_M000343_source">show source</a> ]</p>
|
580
|
-
<div id="M000343_source" class="dyn-source">
|
581
|
-
<pre>
|
582
|
-
<span class="ruby-comment cmt"># File lib/facets/core/string/align_center.rb, line 8</span>
|
583
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">align_right</span>( <span class="ruby-identifier">n</span>, <span class="ruby-identifier">sep</span>=<span class="ruby-value str">"\n"</span>, <span class="ruby-identifier">c</span>=<span class="ruby-value str">' '</span> )
|
584
|
-
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">rjust</span>(<span class="ruby-identifier">n</span>.<span class="ruby-identifier">to_i</span>,<span class="ruby-identifier">c</span>.<span class="ruby-identifier">to_s</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">sep</span><span class="ruby-operator">==</span><span class="ruby-keyword kw">nil</span>
|
585
|
-
<span class="ruby-identifier">q</span> = <span class="ruby-identifier">split</span>(<span class="ruby-identifier">sep</span>.<span class="ruby-identifier">to_s</span>).<span class="ruby-identifier">collect</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">line</span><span class="ruby-operator">|</span>
|
586
|
-
<span class="ruby-identifier">line</span>.<span class="ruby-identifier">rjust</span>(<span class="ruby-identifier">n</span>.<span class="ruby-identifier">to_i</span>,<span class="ruby-identifier">c</span>.<span class="ruby-identifier">to_s</span>)
|
587
|
-
}
|
588
|
-
<span class="ruby-identifier">q</span>.<span class="ruby-identifier">join</span>(<span class="ruby-identifier">sep</span>.<span class="ruby-identifier">to_s</span>)
|
589
|
-
<span class="ruby-keyword kw">end</span>
|
590
|
-
</pre>
|
591
|
-
</div>
|
592
|
-
</div>
|
593
|
-
</div>
|
594
|
-
<div class="method">
|
595
|
-
<div class="title">
|
596
|
-
<a name="M000327"></a><b>at_rand</b>( separator=// )
|
597
|
-
</div>
|
598
|
-
<div class="description">
|
599
|
-
<p>
|
600
|
-
Return a random separation of the string. Default separation is by
|
601
|
-
charaacter.
|
602
|
-
</p>
|
603
|
-
<pre>
|
604
|
-
"Ruby rules".at_rand(' ') #=> ["Ruby"]
|
605
|
-
</pre>
|
606
|
-
</div>
|
607
|
-
<div class="sourcecode">
|
608
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000327_source')" id="l_M000327_source">show source</a> ]</p>
|
609
|
-
<div id="M000327_source" class="dyn-source">
|
610
|
-
<pre>
|
611
|
-
<span class="ruby-comment cmt"># File lib/facets/core/string/at_rand.rb, line 13</span>
|
612
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">at_rand</span>( <span class="ruby-identifier">separator</span>=<span class="ruby-regexp re">//</span> )
|
613
|
-
<span class="ruby-identifier">separator</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">patterns</span>( <span class="ruby-identifier">separator</span> )
|
614
|
-
<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">split</span>(<span class="ruby-identifier">separator</span>,<span class="ruby-value">-1</span>).<span class="ruby-identifier">at_rand</span>
|
615
|
-
<span class="ruby-keyword kw">end</span>
|
616
|
-
</pre>
|
617
|
-
</div>
|
618
|
-
</div>
|
619
|
-
</div>
|
620
|
-
<div class="method">
|
621
|
-
<div class="title">
|
622
|
-
<a name="M000328"></a><b>at_rand!</b>( separator=// )
|
623
|
-
</div>
|
624
|
-
<div class="description">
|
625
|
-
<p>
|
626
|
-
Return a random separation while removing it from the string. Default
|
627
|
-
separation is by character.
|
628
|
-
</p>
|
629
|
-
<pre>
|
630
|
-
s = "Ruby rules"
|
631
|
-
s = at_rand!(' ') #=> "Ruby"
|
632
|
-
s #=> "rules"
|
633
|
-
</pre>
|
634
|
-
</div>
|
635
|
-
<div class="sourcecode">
|
636
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000328_source')" id="l_M000328_source">show source</a> ]</p>
|
637
|
-
<div id="M000328_source" class="dyn-source">
|
638
|
-
<pre>
|
639
|
-
<span class="ruby-comment cmt"># File lib/facets/core/string/at_rand.rb, line 25</span>
|
640
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">at_rand!</span>( <span class="ruby-identifier">separator</span>=<span class="ruby-regexp re">//</span> )
|
641
|
-
<span class="ruby-identifier">separator</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">patterns</span>( <span class="ruby-identifier">separator</span> )
|
642
|
-
<span class="ruby-identifier">a</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">shatter</span>( <span class="ruby-identifier">separator</span> )
|
643
|
-
<span class="ruby-identifier">w</span> = []; <span class="ruby-identifier">a</span>.<span class="ruby-identifier">each_with_index</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">s</span>,<span class="ruby-identifier">i</span><span class="ruby-operator">|</span> <span class="ruby-identifier">i</span> <span class="ruby-operator">%</span> <span class="ruby-value">2</span> <span class="ruby-operator">==</span> <span class="ruby-value">0</span> <span class="ruby-operator">?</span> <span class="ruby-identifier">w</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">s</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">w</span>.<span class="ruby-identifier">last</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">s</span> }
|
644
|
-
<span class="ruby-identifier">i</span> = <span class="ruby-identifier">rand</span>( <span class="ruby-identifier">w</span>.<span class="ruby-identifier">size</span> )
|
645
|
-
<span class="ruby-identifier">r</span> = <span class="ruby-identifier">w</span>.<span class="ruby-identifier">delete_at</span>( <span class="ruby-identifier">i</span> )
|
646
|
-
<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">replace</span>( <span class="ruby-identifier">w</span>.<span class="ruby-identifier">join</span>(<span class="ruby-value str">''</span>) )
|
647
|
-
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">r</span>
|
648
|
-
<span class="ruby-keyword kw">end</span>
|
649
|
-
</pre>
|
650
|
-
</div>
|
651
|
-
</div>
|
652
|
-
</div>
|
653
|
-
<div class="method">
|
654
|
-
<div class="title">
|
655
|
-
<a name="M000321"></a><b>basename</b>()
|
656
|
-
</div>
|
657
|
-
<div class="description">
|
658
|
-
<p>
|
659
|
-
Removes prepend module namespace.
|
660
|
-
</p>
|
661
|
-
<pre>
|
662
|
-
"Test::Unit".basename #=> "Unit"
|
663
|
-
</pre>
|
664
|
-
</div>
|
665
|
-
<div class="sourcecode">
|
666
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000321_source')" id="l_M000321_source">show source</a> ]</p>
|
667
|
-
<div id="M000321_source" class="dyn-source">
|
668
|
-
<pre>
|
669
|
-
<span class="ruby-comment cmt"># File lib/facets/core/string/basename.rb, line 8</span>
|
670
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">basename</span>
|
671
|
-
<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/^.*::/</span>, <span class="ruby-value str">''</span>)
|
672
|
-
<span class="ruby-keyword kw">end</span>
|
673
|
-
</pre>
|
674
|
-
</div>
|
675
|
-
</div>
|
676
|
-
</div>
|
677
|
-
<div class="method">
|
678
|
-
<div class="title">
|
679
|
-
<a name="M000311"></a><b>blank?</b>()
|
680
|
-
</div>
|
681
|
-
<div class="description">
|
682
|
-
<p>
|
683
|
-
Is this string just whitespace?
|
684
|
-
</p>
|
685
|
-
<pre>
|
686
|
-
"abc".blank? #=> false
|
687
|
-
" ".blank? #=> true
|
688
|
-
</pre>
|
689
|
-
</div>
|
690
|
-
<div class="aka">
|
691
|
-
This method is also aliased as
|
692
|
-
<a href="String.html#M000312">whitespace?</a>
|
693
|
-
<a href="String.html#M000326">whitespace?</a>
|
694
|
-
</div>
|
695
|
-
<div class="sourcecode">
|
696
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000311_source')" id="l_M000311_source">show source</a> ]</p>
|
697
|
-
<div id="M000311_source" class="dyn-source">
|
698
|
-
<pre>
|
699
|
-
<span class="ruby-comment cmt"># File lib/facets/core/string/blank.rb, line 9</span>
|
700
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">blank?</span>
|
701
|
-
<span class="ruby-keyword kw">self</span> <span class="ruby-operator">!~</span> <span class="ruby-regexp re">/\S/</span>
|
702
|
-
<span class="ruby-keyword kw">end</span>
|
703
|
-
</pre>
|
704
|
-
</div>
|
705
|
-
</div>
|
706
|
-
</div>
|
707
|
-
<div class="method">
|
708
|
-
<div class="title">
|
709
|
-
<a name="M000366"></a><b>bracket</b>(bra, ket=nil)
|
710
|
-
</div>
|
711
|
-
<div class="description">
|
712
|
-
<p>
|
713
|
-
Return a new string embraced by given brakets. If only one bracket char is
|
714
|
-
given it will be placed on either side.
|
715
|
-
</p>
|
716
|
-
<pre>
|
717
|
-
"wrap me".bracket('{') #=> "{wrap me}"
|
718
|
-
"wrap me".bracket('--','!') #=> "--wrap me!"
|
719
|
-
</pre>
|
720
|
-
</div>
|
721
|
-
<div class="sourcecode">
|
722
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000366_source')" id="l_M000366_source">show source</a> ]</p>
|
723
|
-
<div id="M000366_source" class="dyn-source">
|
724
|
-
<pre>
|
725
|
-
<span class="ruby-comment cmt"># File lib/facets/core/string/bracket.rb, line 15</span>
|
726
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">bracket</span>(<span class="ruby-identifier">bra</span>, <span class="ruby-identifier">ket</span>=<span class="ruby-keyword kw">nil</span>)
|
727
|
-
<span class="ruby-comment cmt">#ket = String.bra2ket[$&] if ! ket && /^[\[({<]$/ =~ bra</span>
|
728
|
-
<span class="ruby-identifier">ket</span> = <span class="ruby-constant">String</span>.<span class="ruby-identifier">bra2ket</span>[<span class="ruby-identifier">bra</span>] <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">ket</span>
|
729
|
-
<span class="ruby-node">"#{bra}#{self}#{ket ? ket : bra}"</span>
|
730
|
-
<span class="ruby-keyword kw">end</span>
|
731
|
-
</pre>
|
732
|
-
</div>
|
733
|
-
</div>
|
734
|
-
</div>
|
735
|
-
<div class="method">
|
736
|
-
<div class="title">
|
737
|
-
<a name="M000367"></a><b>bracket!</b>(bra, ket=nil)
|
738
|
-
</div>
|
739
|
-
<div class="description">
|
740
|
-
<p>
|
741
|
-
Inplace version of braket.
|
742
|
-
</p>
|
743
|
-
</div>
|
744
|
-
<div class="sourcecode">
|
745
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000367_source')" id="l_M000367_source">show source</a> ]</p>
|
746
|
-
<div id="M000367_source" class="dyn-source">
|
747
|
-
<pre>
|
748
|
-
<span class="ruby-comment cmt"># File lib/facets/core/string/bracket.rb, line 22</span>
|
749
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">bracket!</span>(<span class="ruby-identifier">bra</span>, <span class="ruby-identifier">ket</span>=<span class="ruby-keyword kw">nil</span>)
|
750
|
-
<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">replace</span>( <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">bracket</span>(<span class="ruby-identifier">bra</span>, <span class="ruby-identifier">ket</span>) )
|
751
|
-
<span class="ruby-keyword kw">end</span>
|
752
|
-
</pre>
|
753
|
-
</div>
|
754
|
-
</div>
|
755
|
-
</div>
|
756
|
-
<div class="method">
|
757
|
-
<div class="title">
|
758
|
-
<a name="M000305"></a><b>brief</b>(string, count = 128, force_cutoff = false, ellipsis="...")
|
759
|
-
</div>
|
760
|
-
<div class="description">
|
761
|
-
<p>
|
762
|
-
Returns short abstract of long strings (first ‘count’
|
763
|
-
characters, chopped at the nearest word, appended by ’…’)
|
764
|
-
force_cutoff: break forcibly at ‘count’ chars. Does not accept
|
765
|
-
count < 2.
|
766
|
-
</p>
|
767
|
-
</div>
|
768
|
-
<div class="sourcecode">
|
769
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000305_source')" id="l_M000305_source">show source</a> ]</p>
|
770
|
-
<div id="M000305_source" class="dyn-source">
|
771
|
-
<pre>
|
772
|
-
<span class="ruby-comment cmt"># File lib/facets/core/string/brief.rb, line 10</span>
|
773
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">brief</span>(<span class="ruby-identifier">string</span>, <span class="ruby-identifier">count</span> = <span class="ruby-value">128</span>, <span class="ruby-identifier">force_cutoff</span> = <span class="ruby-keyword kw">false</span>, <span class="ruby-identifier">ellipsis</span>=<span class="ruby-value str">"..."</span>)
|
774
|
-
<span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">nil</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">string</span>
|
775
|
-
<span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">nil</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">count</span> <span class="ruby-operator"><</span> <span class="ruby-value">2</span>
|
776
|
-
|
777
|
-
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">string</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">></span> <span class="ruby-identifier">count</span>
|
778
|
-
<span class="ruby-identifier">cut_at</span> = <span class="ruby-identifier">force_cutoff</span> <span class="ruby-value">? </span><span class="ruby-identifier">count</span> <span class="ruby-operator">:</span> (<span class="ruby-identifier">string</span>.<span class="ruby-identifier">index</span>(<span class="ruby-value str">' '</span>, <span class="ruby-identifier">count</span><span class="ruby-operator">-</span><span class="ruby-value">1</span>) <span class="ruby-operator">||</span> <span class="ruby-identifier">count</span>)
|
779
|
-
<span class="ruby-identifier">xstring</span> = <span class="ruby-identifier">string</span>.<span class="ruby-identifier">slice</span>(<span class="ruby-value">0</span>, <span class="ruby-identifier">cut_at</span>)
|
780
|
-
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">xstring</span>.<span class="ruby-identifier">chomp</span>(<span class="ruby-value str">" "</span>) <span class="ruby-operator">+</span> <span class="ruby-identifier">ellipsis</span>
|
781
|
-
<span class="ruby-keyword kw">else</span>
|
782
|
-
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">string</span>
|
783
|
-
<span class="ruby-keyword kw">end</span>
|
784
|
-
<span class="ruby-keyword kw">end</span>
|
785
|
-
</pre>
|
786
|
-
</div>
|
787
|
-
</div>
|
788
|
-
</div>
|
789
|
-
<div class="method">
|
790
|
-
<div class="title">
|
791
|
-
<a name="M000320"></a><b>bytes</b>()
|
792
|
-
</div>
|
793
|
-
<div class="description">
|
794
|
-
<p>
|
795
|
-
Upacks string ginto bytes.
|
796
|
-
</p>
|
797
|
-
</div>
|
798
|
-
<div class="sourcecode">
|
799
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000320_source')" id="l_M000320_source">show source</a> ]</p>
|
800
|
-
<div id="M000320_source" class="dyn-source">
|
801
|
-
<pre>
|
802
|
-
<span class="ruby-comment cmt"># File lib/facets/core/string/bytes.rb, line 6</span>
|
803
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">bytes</span>
|
804
|
-
<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">unpack</span>(<span class="ruby-value str">'C*'</span>)
|
805
|
-
<span class="ruby-keyword kw">end</span>
|
806
|
-
</pre>
|
807
|
-
</div>
|
808
|
-
</div>
|
809
|
-
</div>
|
810
|
-
<div class="method">
|
811
|
-
<div class="title">
|
812
|
-
<a name="M000289"></a><b>camelcase</b>( first=false, on='_\s' )
|
813
|
-
</div>
|
814
|
-
<div class="description">
|
815
|
-
<p>
|
816
|
-
Converts a string to camelcase. By default capitalization occurs on
|
817
|
-
whitespace and underscores. By setting the first parameter to <tt>true</tt>
|
818
|
-
the first character can also be captizlized. The second parameter can be
|
819
|
-
assigned a valid Regualr Expression characeter set to determine which
|
820
|
-
characters to match for capitalizing subsequent parts of the string.
|
821
|
-
</p>
|
822
|
-
<pre>
|
823
|
-
"this_is a test".camelcase #=> "thisIsATest"
|
824
|
-
"this_is a test".camelcase(true) #=> "ThisIsATest"
|
825
|
-
"this_is a test".camelcase(true, ' ') #=> "This_isATest"
|
826
|
-
</pre>
|
827
|
-
</div>
|
828
|
-
<div class="sourcecode">
|
829
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000289_source')" id="l_M000289_source">show source</a> ]</p>
|
830
|
-
<div id="M000289_source" class="dyn-source">
|
831
|
-
<pre>
|
832
|
-
<span class="ruby-comment cmt"># File lib/facets/core/string/camelcase.rb, line 16</span>
|
833
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">camelcase</span>( <span class="ruby-identifier">first</span>=<span class="ruby-keyword kw">false</span>, <span class="ruby-identifier">on</span>=<span class="ruby-value str">'_\s'</span> )
|
834
|
-
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">first</span>
|
835
|
-
<span class="ruby-identifier">gsub</span>(<span class="ruby-node">/(^|[#{on}]+)([A-Za-z])/</span>){ <span class="ruby-identifier">$2</span>.<span class="ruby-identifier">upcase</span> }
|
836
|
-
<span class="ruby-keyword kw">else</span>
|
837
|
-
<span class="ruby-identifier">gsub</span>(<span class="ruby-node">/([#{on}]+)([A-Za-z])/</span>){ <span class="ruby-identifier">$2</span>.<span class="ruby-identifier">upcase</span> }
|
838
|
-
<span class="ruby-keyword kw">end</span>
|
839
|
-
<span class="ruby-keyword kw">end</span>
|
840
|
-
</pre>
|
841
|
-
</div>
|
842
|
-
</div>
|
843
|
-
</div>
|
844
|
-
<div class="method">
|
845
|
-
<div class="title">
|
846
|
-
<a name="M000333"></a><b>camelize</b>()
|
847
|
-
</div>
|
848
|
-
<div class="description">
|
849
|
-
<p>
|
850
|
-
Variation of coverting a string to camelcase. This is unlike <a
|
851
|
-
href="String.html#M000289">camelcase</a> in that it is geared toward code
|
852
|
-
reflection use.
|
853
|
-
</p>
|
854
|
-
<pre>
|
855
|
-
"this/is_a_test".camelize #=> This::IsATest
|
856
|
-
</pre>
|
857
|
-
</div>
|
858
|
-
<div class="sourcecode">
|
859
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000333_source')" id="l_M000333_source">show source</a> ]</p>
|
860
|
-
<div id="M000333_source" class="dyn-source">
|
861
|
-
<pre>
|
862
|
-
<span class="ruby-comment cmt"># File lib/facets/core/string/camelize.rb, line 9</span>
|
863
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">camelize</span>
|
864
|
-
<span class="ruby-comment cmt">#to_s.gsub(/(^|_)(.)/){$2.upcase}</span>
|
865
|
-
<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/\/(.?)/</span>){ <span class="ruby-value str">"::"</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">$1</span>.<span class="ruby-identifier">upcase</span> }.<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/(^|_)(.)/</span>){ <span class="ruby-identifier">$2</span>.<span class="ruby-identifier">upcase</span> }
|
866
|
-
<span class="ruby-keyword kw">end</span>
|
867
|
-
</pre>
|
868
|
-
</div>
|
869
|
-
</div>
|
870
|
-
</div>
|
871
|
-
<div class="method">
|
872
|
-
<div class="title">
|
873
|
-
<a name="M000319"></a><b>capitalized?</b>()
|
874
|
-
</div>
|
875
|
-
<div class="description">
|
876
|
-
<p>
|
877
|
-
Return true if the string is capitalized, otherwise false.
|
878
|
-
</p>
|
879
|
-
<pre>
|
880
|
-
"THIS".capitalized? #=> true
|
881
|
-
"This".capitalized? #=> true
|
882
|
-
"this".capitalized? #=> false
|
883
|
-
</pre>
|
884
|
-
</div>
|
885
|
-
<div class="sourcecode">
|
886
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000319_source')" id="l_M000319_source">show source</a> ]</p>
|
887
|
-
<div id="M000319_source" class="dyn-source">
|
888
|
-
<pre>
|
889
|
-
<span class="ruby-comment cmt"># File lib/facets/core/string/capitalized.rb, line 13</span>
|
890
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">capitalized?</span>
|
891
|
-
<span class="ruby-keyword kw">self</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/^[A-Z]/</span>
|
892
|
-
<span class="ruby-keyword kw">end</span>
|
893
|
-
</pre>
|
894
|
-
</div>
|
895
|
-
</div>
|
896
|
-
</div>
|
897
|
-
<div class="method">
|
898
|
-
<div class="title">
|
899
|
-
<a name="M000314"></a><b>chars</b>()
|
900
|
-
</div>
|
901
|
-
<div class="description">
|
902
|
-
<p>
|
903
|
-
Returns an array of characters.
|
904
|
-
</p>
|
905
|
-
<pre>
|
906
|
-
"abc".chars #=> ["a","b","c"]
|
907
|
-
</pre>
|
908
|
-
</div>
|
909
|
-
<div class="sourcecode">
|
910
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000314_source')" id="l_M000314_source">show source</a> ]</p>
|
911
|
-
<div id="M000314_source" class="dyn-source">
|
912
|
-
<pre>
|
913
|
-
<span class="ruby-comment cmt"># File lib/facets/core/string/chars.rb, line 8</span>
|
914
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">chars</span>
|
915
|
-
<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">split</span>(<span class="ruby-regexp re">//</span>)
|
916
|
-
<span class="ruby-keyword kw">end</span>
|
917
|
-
</pre>
|
918
|
-
</div>
|
919
|
-
</div>
|
920
|
-
</div>
|
921
|
-
<div class="method">
|
922
|
-
<div class="title">
|
923
|
-
<a name="M000325"></a><b>cmp</b>(other)
|
924
|
-
</div>
|
925
|
-
<div class="description">
|
926
|
-
<p>
|
927
|
-
Compare method that takes length into account. Unlike #<=>, this is
|
928
|
-
compatible with <a href="String.html#M000323">succ</a>.
|
929
|
-
</p>
|
930
|
-
<pre>
|
931
|
-
"abc".cmp("abc") #=> 0
|
932
|
-
"abcd".cmp("abc") #=> 1
|
933
|
-
"abc".cmp("abcd") #=> -1
|
934
|
-
"xyz".cmp("abc") #=> 1
|
935
|
-
</pre>
|
936
|
-
</div>
|
937
|
-
<div class="sourcecode">
|
938
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000325_source')" id="l_M000325_source">show source</a> ]</p>
|
939
|
-
<div id="M000325_source" class="dyn-source">
|
940
|
-
<pre>
|
941
|
-
<span class="ruby-comment cmt"># File lib/facets/core/string/cmp.rb, line 12</span>
|
942
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">cmp</span>(<span class="ruby-identifier">other</span>)
|
943
|
-
<span class="ruby-keyword kw">return</span> <span class="ruby-value">-1</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">length</span> <span class="ruby-operator"><</span> <span class="ruby-identifier">other</span>.<span class="ruby-identifier">length</span>
|
944
|
-
<span class="ruby-keyword kw">return</span> <span class="ruby-value">1</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">length</span> <span class="ruby-operator">></span> <span class="ruby-identifier">other</span>.<span class="ruby-identifier">length</span>
|
945
|
-
<span class="ruby-keyword kw">self</span> <span class="ruby-operator"><=></span> <span class="ruby-identifier">other</span> <span class="ruby-comment cmt"># alphabetic compare</span>
|
946
|
-
<span class="ruby-keyword kw">end</span>
|
947
|
-
</pre>
|
948
|
-
</div>
|
949
|
-
</div>
|
950
|
-
</div>
|
951
|
-
<div class="method">
|
952
|
-
<div class="title">
|
953
|
-
<a name="M000292"></a><b>dequote</b>()
|
954
|
-
</div>
|
955
|
-
<div class="sourcecode">
|
956
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000292_source')" id="l_M000292_source">show source</a> ]</p>
|
957
|
-
<div id="M000292_source" class="dyn-source">
|
958
|
-
<pre>
|
959
|
-
<span class="ruby-comment cmt"># File lib/facets/core/string/dequote.rb, line 3</span>
|
960
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">dequote</span>
|
961
|
-
<span class="ruby-identifier">s</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">dup</span>
|
962
|
-
|
963
|
-
<span class="ruby-keyword kw">case</span> <span class="ruby-keyword kw">self</span>[<span class="ruby-value">0</span>,<span class="ruby-value">1</span>]
|
964
|
-
<span class="ruby-keyword kw">when</span> <span class="ruby-value str">"'"</span>, <span class="ruby-value str">'"'</span>, <span class="ruby-value str">'`'</span>
|
965
|
-
<span class="ruby-identifier">s</span>[<span class="ruby-value">0</span>] = <span class="ruby-value str">''</span>
|
966
|
-
<span class="ruby-keyword kw">end</span>
|
967
|
-
|
968
|
-
<span class="ruby-keyword kw">case</span> <span class="ruby-keyword kw">self</span>[<span class="ruby-value">-1</span>,<span class="ruby-value">1</span>]
|
969
|
-
<span class="ruby-keyword kw">when</span> <span class="ruby-value str">"'"</span>, <span class="ruby-value str">'"'</span>, <span class="ruby-value str">'`'</span>
|
970
|
-
<span class="ruby-identifier">s</span>[<span class="ruby-value">-1</span>] = <span class="ruby-value str">''</span>
|
971
|
-
<span class="ruby-keyword kw">end</span>
|
972
|
-
|
973
|
-
<span class="ruby-identifier">s</span>
|
974
|
-
<span class="ruby-keyword kw">end</span>
|
975
|
-
</pre>
|
976
|
-
</div>
|
977
|
-
</div>
|
978
|
-
</div>
|
979
|
-
<div class="method">
|
980
|
-
<div class="title">
|
981
|
-
<a name="M000322"></a><b>downcase?</b>()
|
982
|
-
</div>
|
983
|
-
<div class="description">
|
984
|
-
<p>
|
985
|
-
Return true if the string is lowercase (downcase), otherwise false.
|
986
|
-
</p>
|
987
|
-
<pre>
|
988
|
-
"THIS".downcase? #=> false
|
989
|
-
"This".downcase? #=> false
|
990
|
-
"this".downcase? #=> true
|
991
|
-
</pre>
|
992
|
-
</div>
|
993
|
-
<div class="aka">
|
994
|
-
This method is also aliased as
|
995
|
-
<a href="String.html#M000357">lowercase?</a>
|
996
|
-
</div>
|
997
|
-
<div class="sourcecode">
|
998
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000322_source')" id="l_M000322_source">show source</a> ]</p>
|
999
|
-
<div id="M000322_source" class="dyn-source">
|
1000
|
-
<pre>
|
1001
|
-
<span class="ruby-comment cmt"># File lib/facets/core/string/downcase.rb, line 12</span>
|
1002
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">downcase?</span>
|
1003
|
-
<span class="ruby-identifier">downcase</span> <span class="ruby-operator">==</span> <span class="ruby-keyword kw">self</span>
|
1004
|
-
<span class="ruby-keyword kw">end</span>
|
1005
|
-
</pre>
|
1006
|
-
</div>
|
1007
|
-
</div>
|
1008
|
-
</div>
|
1009
|
-
<div class="method">
|
1010
|
-
<div class="title">
|
1011
|
-
<a name="M000283"></a><b>dresner</b>()
|
1012
|
-
</div>
|
1013
|
-
<div class="description">
|
1014
|
-
<p>
|
1015
|
-
Scramble the inner characters of words leaving the text still readable
|
1016
|
-
(research at Cambridge University, code by KurtDresner).
|
1017
|
-
</p>
|
1018
|
-
<p>
|
1019
|
-
For example, the above text may result in:
|
1020
|
-
</p>
|
1021
|
-
<pre>
|
1022
|
-
Srblamce the iennr cchrteaars of wodrs lvenaig the txet stlil rbeaadle
|
1023
|
-
(rreceash at Cbamigdre Uverintisy, cdoe by KrneruestDr?)
|
1024
|
-
</pre>
|
1025
|
-
</div>
|
1026
|
-
<div class="sourcecode">
|
1027
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000283_source')" id="l_M000283_source">show source</a> ]</p>
|
1028
|
-
<div id="M000283_source" class="dyn-source">
|
1029
|
-
<pre>
|
1030
|
-
<span class="ruby-comment cmt"># File lib/facets/core/string/dresner.rb, line 12</span>
|
1031
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">dresner</span>
|
1032
|
-
<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/\B\w+\B/</span>){<span class="ruby-identifier">$&</span>.<span class="ruby-identifier">split</span>(<span class="ruby-regexp re">//</span>).<span class="ruby-identifier">sort_by</span>{<span class="ruby-identifier">rand</span>}}
|
1033
|
-
<span class="ruby-keyword kw">end</span>
|
1034
|
-
</pre>
|
1035
|
-
</div>
|
1036
|
-
</div>
|
1037
|
-
</div>
|
1038
|
-
<div class="method">
|
1039
|
-
<div class="title">
|
1040
|
-
<a name="M000284"></a><b>dresner!</b>()
|
1041
|
-
</div>
|
1042
|
-
<div class="description">
|
1043
|
-
<p>
|
1044
|
-
Inplace version of <a href="String.html#M000283">dresner</a> method.
|
1045
|
-
</p>
|
1046
|
-
</div>
|
1047
|
-
<div class="sourcecode">
|
1048
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000284_source')" id="l_M000284_source">show source</a> ]</p>
|
1049
|
-
<div id="M000284_source" class="dyn-source">
|
1050
|
-
<pre>
|
1051
|
-
<span class="ruby-comment cmt"># File lib/facets/core/string/dresner.rb, line 18</span>
|
1052
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">dresner!</span>
|
1053
|
-
<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">replace</span>(<span class="ruby-identifier">dresner</span>)
|
1054
|
-
<span class="ruby-keyword kw">end</span>
|
1055
|
-
</pre>
|
1056
|
-
</div>
|
1057
|
-
</div>
|
1058
|
-
</div>
|
1059
|
-
<div class="method">
|
1060
|
-
<div class="title">
|
1061
|
-
<a name="M000362"></a><b>each_char</b>( {|| ...}
|
1062
|
-
</div>
|
1063
|
-
<div class="description">
|
1064
|
-
<p>
|
1065
|
-
Iterates through each character.
|
1066
|
-
</p>
|
1067
|
-
</div>
|
1068
|
-
<div class="sourcecode">
|
1069
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000362_source')" id="l_M000362_source">show source</a> ]</p>
|
1070
|
-
<div id="M000362_source" class="dyn-source">
|
1071
|
-
<pre>
|
1072
|
-
<span class="ruby-comment cmt"># File lib/facets/core/string/each_char.rb, line 5</span>
|
1073
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">each_char</span> <span class="ruby-comment cmt"># :yield:</span>
|
1074
|
-
<span class="ruby-identifier">split</span>(<span class="ruby-regexp re">//</span>).<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">c</span><span class="ruby-operator">|</span>
|
1075
|
-
<span class="ruby-keyword kw">yield</span>( <span class="ruby-identifier">c</span> )
|
1076
|
-
}
|
1077
|
-
<span class="ruby-keyword kw">end</span>
|
1078
|
-
</pre>
|
1079
|
-
</div>
|
1080
|
-
</div>
|
1081
|
-
</div>
|
1082
|
-
<div class="method">
|
1083
|
-
<div class="title">
|
1084
|
-
<a name="M000364"></a><b>each_word</b>( &yld )
|
1085
|
-
</div>
|
1086
|
-
<div class="description">
|
1087
|
-
<p>
|
1088
|
-
Iterate through each word of a string.
|
1089
|
-
</p>
|
1090
|
-
<pre>
|
1091
|
-
"a string".each_word { |word, range| ... }
|
1092
|
-
</pre>
|
1093
|
-
</div>
|
1094
|
-
<div class="sourcecode">
|
1095
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000364_source')" id="l_M000364_source">show source</a> ]</p>
|
1096
|
-
<div id="M000364_source" class="dyn-source">
|
1097
|
-
<pre>
|
1098
|
-
<span class="ruby-comment cmt"># File lib/facets/core/string/each_word.rb, line 8</span>
|
1099
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">each_word</span>( <span class="ruby-operator">&</span><span class="ruby-identifier">yld</span> )
|
1100
|
-
<span class="ruby-identifier">rest_of_string</span> = <span class="ruby-keyword kw">self</span>
|
1101
|
-
<span class="ruby-identifier">wordfind</span> = <span class="ruby-regexp re">/([-'\w]+)/</span>
|
1102
|
-
<span class="ruby-identifier">arity</span> = <span class="ruby-identifier">yld</span>.<span class="ruby-identifier">arity</span>
|
1103
|
-
<span class="ruby-identifier">offset</span> = <span class="ruby-value">0</span>
|
1104
|
-
<span class="ruby-keyword kw">while</span> <span class="ruby-identifier">wmatch</span> = <span class="ruby-identifier">wordfind</span>.<span class="ruby-identifier">match</span>(<span class="ruby-identifier">rest_of_string</span>)
|
1105
|
-
<span class="ruby-identifier">word</span> = <span class="ruby-identifier">wmatch</span>[<span class="ruby-value">0</span>]
|
1106
|
-
<span class="ruby-identifier">range</span> = <span class="ruby-identifier">offset</span><span class="ruby-operator">+</span><span class="ruby-identifier">wmatch</span>.<span class="ruby-identifier">begin</span>(<span class="ruby-value">0</span>) <span class="ruby-operator">...</span> <span class="ruby-identifier">offset</span><span class="ruby-operator">+</span><span class="ruby-identifier">wmatch</span>.<span class="ruby-identifier">end</span>(<span class="ruby-value">0</span>)
|
1107
|
-
<span class="ruby-identifier">rest_of_string</span> = <span class="ruby-identifier">wmatch</span>.<span class="ruby-identifier">post_match</span>
|
1108
|
-
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">arity</span> <span class="ruby-operator">==</span> <span class="ruby-value">1</span>
|
1109
|
-
<span class="ruby-identifier">yld</span>.<span class="ruby-identifier">call</span>(<span class="ruby-identifier">word</span>)
|
1110
|
-
<span class="ruby-keyword kw">else</span>
|
1111
|
-
<span class="ruby-identifier">yld</span>.<span class="ruby-identifier">call</span>(<span class="ruby-identifier">word</span>, <span class="ruby-identifier">range</span>)
|
1112
|
-
<span class="ruby-keyword kw">end</span>
|
1113
|
-
<span class="ruby-identifier">offset</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">rest_of_string</span>.<span class="ruby-identifier">length</span>
|
1114
|
-
<span class="ruby-keyword kw">end</span>
|
1115
|
-
<span class="ruby-keyword kw">end</span>
|
1116
|
-
</pre>
|
1117
|
-
</div>
|
1118
|
-
</div>
|
1119
|
-
</div>
|
1120
|
-
<div class="method">
|
1121
|
-
<div class="title">
|
1122
|
-
<a name="M000317"></a><b>ends_with?</b>(str)
|
1123
|
-
</div>
|
1124
|
-
<div class="sourcecode">
|
1125
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000317_source')" id="l_M000317_source">show source</a> ]</p>
|
1126
|
-
<div id="M000317_source" class="dyn-source">
|
1127
|
-
<pre>
|
1128
|
-
<span class="ruby-comment cmt"># File lib/facets/core/string/starts_with.rb, line 11</span>
|
1129
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">ends_with?</span>(<span class="ruby-identifier">str</span>)
|
1130
|
-
<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">rindex</span>( <span class="ruby-identifier">str</span> ) <span class="ruby-operator">==</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">str</span>.<span class="ruby-identifier">length</span>
|
1131
|
-
<span class="ruby-keyword kw">end</span>
|
1132
|
-
</pre>
|
1133
|
-
</div>
|
1134
|
-
</div>
|
1135
|
-
</div>
|
1136
|
-
<div class="method">
|
1137
|
-
<div class="title">
|
1138
|
-
<a name="M000279"></a><b>entropy</b>()
|
1139
|
-
</div>
|
1140
|
-
<div class="sourcecode">
|
1141
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000279_source')" id="l_M000279_source">show source</a> ]</p>
|
1142
|
-
<div id="M000279_source" class="dyn-source">
|
1143
|
-
<pre>
|
1144
|
-
<span class="ruby-comment cmt"># File lib/facets/core/enumerable/entropy.rb, line 27</span>
|
1145
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">entropy</span>
|
1146
|
-
<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">split</span>(<span class="ruby-regexp re">//</span>).<span class="ruby-identifier">entropy</span>
|
1147
|
-
<span class="ruby-keyword kw">end</span>
|
1148
|
-
</pre>
|
1149
|
-
</div>
|
1150
|
-
</div>
|
1151
|
-
</div>
|
1152
|
-
<div class="method">
|
1153
|
-
<div class="title">
|
1154
|
-
<a name="M000329"></a><b>first</b>(separator_pattern=//)
|
1155
|
-
</div>
|
1156
|
-
<div class="description">
|
1157
|
-
<p>
|
1158
|
-
Returns the first separation of a string. Default seperation is by
|
1159
|
-
character.
|
1160
|
-
</p>
|
1161
|
-
<pre>
|
1162
|
-
"Hello World".first #=> "H"
|
1163
|
-
"Hello World".first(' ') #=> "Hello"
|
1164
|
-
</pre>
|
1165
|
-
</div>
|
1166
|
-
<div class="sourcecode">
|
1167
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000329_source')" id="l_M000329_source">show source</a> ]</p>
|
1168
|
-
<div id="M000329_source" class="dyn-source">
|
1169
|
-
<pre>
|
1170
|
-
<span class="ruby-comment cmt"># File lib/facets/core/string/first.rb, line 14</span>
|
1171
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">first</span>(<span class="ruby-identifier">separator_pattern</span>=<span class="ruby-regexp re">//</span>)
|
1172
|
-
<span class="ruby-identifier">pattern</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">patterns</span>(<span class="ruby-identifier">separator_pattern</span>)
|
1173
|
-
<span class="ruby-identifier">split</span>(<span class="ruby-identifier">separator_pattern</span>).<span class="ruby-identifier">at</span>(<span class="ruby-value">0</span>)
|
1174
|
-
<span class="ruby-keyword kw">end</span>
|
1175
|
-
</pre>
|
1176
|
-
</div>
|
1177
|
-
</div>
|
1178
|
-
</div>
|
1179
|
-
<div class="method">
|
1180
|
-
<div class="title">
|
1181
|
-
<a name="M000330"></a><b>first!</b>(separator_pattern=//)
|
1182
|
-
</div>
|
1183
|
-
<div class="description">
|
1184
|
-
<p>
|
1185
|
-
Removes the first separation from a string. Defualt separation is by
|
1186
|
-
characters.
|
1187
|
-
</p>
|
1188
|
-
<pre>
|
1189
|
-
a = "Hello World"
|
1190
|
-
a.first! #=> "H"
|
1191
|
-
a #=> "ello World"
|
1192
|
-
|
1193
|
-
a = "Hello World"
|
1194
|
-
a.first!(' ') #=> "Hello"
|
1195
|
-
a #=> "World"
|
1196
|
-
</pre>
|
1197
|
-
</div>
|
1198
|
-
<div class="sourcecode">
|
1199
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000330_source')" id="l_M000330_source">show source</a> ]</p>
|
1200
|
-
<div id="M000330_source" class="dyn-source">
|
1201
|
-
<pre>
|
1202
|
-
<span class="ruby-comment cmt"># File lib/facets/core/string/first.rb, line 36</span>
|
1203
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">first!</span>(<span class="ruby-identifier">separator_pattern</span>=<span class="ruby-regexp re">//</span>)
|
1204
|
-
<span class="ruby-identifier">pattern</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">patterns</span>(<span class="ruby-identifier">separator_pattern</span>)
|
1205
|
-
<span class="ruby-identifier">a</span> = <span class="ruby-identifier">shatter</span>(<span class="ruby-identifier">pattern</span>)
|
1206
|
-
<span class="ruby-identifier">r</span> = <span class="ruby-identifier">a</span>.<span class="ruby-identifier">first</span>
|
1207
|
-
<span class="ruby-identifier">a</span>.<span class="ruby-identifier">shift</span>
|
1208
|
-
<span class="ruby-identifier">a</span>.<span class="ruby-identifier">shift</span>
|
1209
|
-
<span class="ruby-identifier">replace</span>( <span class="ruby-identifier">a</span>.<span class="ruby-identifier">join</span>(<span class="ruby-value str">''</span>) )
|
1210
|
-
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">r</span>
|
1211
|
-
<span class="ruby-keyword kw">end</span>
|
1212
|
-
</pre>
|
1213
|
-
</div>
|
1214
|
-
</div>
|
1215
|
-
</div>
|
1216
|
-
<div class="method">
|
1217
|
-
<div class="title">
|
1218
|
-
<a name="M000331"></a><b>first=</b>( x )
|
1219
|
-
</div>
|
1220
|
-
<div class="description">
|
1221
|
-
<p>
|
1222
|
-
Prepends to a string.
|
1223
|
-
</p>
|
1224
|
-
<pre>
|
1225
|
-
"Hello World".first = "Hello," #=> "Hello, Hello World"
|
1226
|
-
</pre>
|
1227
|
-
</div>
|
1228
|
-
<div class="sourcecode">
|
1229
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000331_source')" id="l_M000331_source">show source</a> ]</p>
|
1230
|
-
<div id="M000331_source" class="dyn-source">
|
1231
|
-
<pre>
|
1232
|
-
<span class="ruby-comment cmt"># File lib/facets/core/string/first.rb, line 52</span>
|
1233
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">first=</span>( <span class="ruby-identifier">x</span> )
|
1234
|
-
<span class="ruby-identifier">insert</span>(<span class="ruby-value">0</span>, <span class="ruby-identifier">x</span>.<span class="ruby-identifier">to_s</span>)
|
1235
|
-
<span class="ruby-keyword kw">end</span>
|
1236
|
-
</pre>
|
1237
|
-
</div>
|
1238
|
-
</div>
|
1239
|
-
</div>
|
1240
|
-
<div class="method">
|
1241
|
-
<div class="title">
|
1242
|
-
<a name="M000318"></a><b>first_char</b>(n=1)
|
1243
|
-
</div>
|
1244
|
-
<div class="description">
|
1245
|
-
<p>
|
1246
|
-
Returns first <em>n</em> characters.
|
1247
|
-
</p>
|
1248
|
-
<pre>
|
1249
|
-
"Hello World".first_char(3) #=> "Hel"
|
1250
|
-
</pre>
|
1251
|
-
</div>
|
1252
|
-
<div class="sourcecode">
|
1253
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000318_source')" id="l_M000318_source">show source</a> ]</p>
|
1254
|
-
<div id="M000318_source" class="dyn-source">
|
1255
|
-
<pre>
|
1256
|
-
<span class="ruby-comment cmt"># File lib/facets/core/string/first_char.rb, line 8</span>
|
1257
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">first_char</span>(<span class="ruby-identifier">n</span>=<span class="ruby-value">1</span>)
|
1258
|
-
<span class="ruby-identifier">slice</span>(<span class="ruby-value">0</span>, <span class="ruby-identifier">n</span>.<span class="ruby-identifier">to_i</span>)
|
1259
|
-
<span class="ruby-keyword kw">end</span>
|
1260
|
-
</pre>
|
1261
|
-
</div>
|
1262
|
-
</div>
|
1263
|
-
</div>
|
1264
|
-
<div class="method">
|
1265
|
-
<div class="title">
|
1266
|
-
<a name="M000332"></a><b>fold</b>(ignore_indented=false)
|
1267
|
-
</div>
|
1268
|
-
<div class="description">
|
1269
|
-
<p>
|
1270
|
-
Returns a new string with all new lines removed from adjacent lines of
|
1271
|
-
text.
|
1272
|
-
</p>
|
1273
|
-
<pre>
|
1274
|
-
s = "This is\na test.\n\nIt clumps\nlines of text."
|
1275
|
-
s.fold
|
1276
|
-
</pre>
|
1277
|
-
<p>
|
1278
|
-
<em>produces</em>
|
1279
|
-
</p>
|
1280
|
-
<pre>
|
1281
|
-
"This is a test.\n\nIt clumps lines of text. "
|
1282
|
-
</pre>
|
1283
|
-
</div>
|
1284
|
-
<div class="sourcecode">
|
1285
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000332_source')" id="l_M000332_source">show source</a> ]</p>
|
1286
|
-
<div id="M000332_source" class="dyn-source">
|
1287
|
-
<pre>
|
1288
|
-
<span class="ruby-comment cmt"># File lib/facets/core/string/fold.rb, line 19</span>
|
1289
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">fold</span>(<span class="ruby-identifier">ignore_indented</span>=<span class="ruby-keyword kw">false</span>)
|
1290
|
-
<span class="ruby-identifier">ns</span> = <span class="ruby-value str">''</span>
|
1291
|
-
<span class="ruby-identifier">i</span> = <span class="ruby-value">0</span>
|
1292
|
-
<span class="ruby-identifier">br</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">scan</span>(<span class="ruby-regexp re">/(\n\s*\n|\Z)/</span><span class="ruby-identifier">m</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">m</span><span class="ruby-operator">|</span>
|
1293
|
-
<span class="ruby-identifier">b</span> = <span class="ruby-identifier">$~</span>.<span class="ruby-identifier">begin</span>(<span class="ruby-value">1</span>)
|
1294
|
-
<span class="ruby-identifier">e</span> = <span class="ruby-identifier">$~</span>.<span class="ruby-identifier">end</span>(<span class="ruby-value">1</span>)
|
1295
|
-
<span class="ruby-identifier">nl</span> = <span class="ruby-identifier">$&</span>
|
1296
|
-
<span class="ruby-identifier">tx</span> = <span class="ruby-identifier">slice</span>(<span class="ruby-identifier">i</span><span class="ruby-operator">...</span><span class="ruby-identifier">b</span>)
|
1297
|
-
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">ignore_indented</span> <span class="ruby-keyword kw">and</span> <span class="ruby-identifier">slice</span>(<span class="ruby-identifier">i</span><span class="ruby-operator">...</span><span class="ruby-identifier">b</span>) <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/^[ ]+/</span>
|
1298
|
-
<span class="ruby-identifier">ns</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">tx</span>
|
1299
|
-
<span class="ruby-keyword kw">else</span>
|
1300
|
-
<span class="ruby-identifier">ns</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">tx</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/[ ]*\n+/</span>,<span class="ruby-value str">' '</span>)
|
1301
|
-
<span class="ruby-keyword kw">end</span>
|
1302
|
-
<span class="ruby-identifier">ns</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">nl</span>
|
1303
|
-
<span class="ruby-identifier">i</span> = <span class="ruby-identifier">e</span>
|
1304
|
-
<span class="ruby-keyword kw">end</span>
|
1305
|
-
<span class="ruby-identifier">ns</span>
|
1306
|
-
<span class="ruby-keyword kw">end</span>
|
1307
|
-
</pre>
|
1308
|
-
</div>
|
1309
|
-
</div>
|
1310
|
-
</div>
|
1311
|
-
<div class="method">
|
1312
|
-
<div class="title">
|
1313
|
-
<a name="M000352"></a><b>format</b>( *args )
|
1314
|
-
</div>
|
1315
|
-
<div class="sourcecode">
|
1316
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000352_source')" id="l_M000352_source">show source</a> ]</p>
|
1317
|
-
<div id="M000352_source" class="dyn-source">
|
1318
|
-
<pre>
|
1319
|
-
<span class="ruby-comment cmt"># File lib/facets/core/string/format.rb, line 4</span>
|
1320
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">format</span>( <span class="ruby-operator">*</span><span class="ruby-identifier">args</span> )
|
1321
|
-
<span class="ruby-keyword kw">self</span>.<span class="ruby-operator">%</span>(<span class="ruby-identifier">args</span>)
|
1322
|
-
<span class="ruby-keyword kw">end</span>
|
1323
|
-
</pre>
|
1324
|
-
</div>
|
1325
|
-
</div>
|
1326
|
-
</div>
|
1327
|
-
<div class="method">
|
1328
|
-
<div class="title">
|
1329
|
-
<a name="M000356"></a><b>frequency</b>(*args)
|
1330
|
-
</div>
|
1331
|
-
<div class="sourcecode">
|
1332
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000356_source')" id="l_M000356_source">show source</a> ]</p>
|
1333
|
-
<div id="M000356_source" class="dyn-source">
|
1334
|
-
<pre>
|
1335
|
-
<span class="ruby-comment cmt"># File lib/facets/core/string/frequency.rb, line 7</span>
|
1336
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">frequency</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
|
1337
|
-
<span class="ruby-identifier">to_arr</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>).<span class="ruby-identifier">frequency</span>
|
1338
|
-
<span class="ruby-keyword kw">end</span>
|
1339
|
-
</pre>
|
1340
|
-
</div>
|
1341
|
-
</div>
|
1342
|
-
</div>
|
1343
|
-
<div class="method">
|
1344
|
-
<div class="title">
|
1345
|
-
<a name="M000307"></a><b>fuzzy_match</b>( str_in )
|
1346
|
-
</div>
|
1347
|
-
<div class="description">
|
1348
|
-
<p>
|
1349
|
-
Alias for <a href="String.html#M000306">similarity</a>
|
1350
|
-
</p>
|
1351
|
-
</div>
|
1352
|
-
</div>
|
1353
|
-
<div class="method">
|
1354
|
-
<div class="title">
|
1355
|
-
<a name="M000290"></a><b>humanize</b>()
|
1356
|
-
</div>
|
1357
|
-
<div class="description">
|
1358
|
-
<p>
|
1359
|
-
Replaces underscores with spaces and capitalizes word.
|
1360
|
-
</p>
|
1361
|
-
</div>
|
1362
|
-
<div class="sourcecode">
|
1363
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000290_source')" id="l_M000290_source">show source</a> ]</p>
|
1364
|
-
<div id="M000290_source" class="dyn-source">
|
1365
|
-
<pre>
|
1366
|
-
<span class="ruby-comment cmt"># File lib/facets/core/string/humanize.rb, line 6</span>
|
1367
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">humanize</span>
|
1368
|
-
<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/_/</span>, <span class="ruby-value str">" "</span>).<span class="ruby-identifier">capitalize</span>
|
1369
|
-
<span class="ruby-keyword kw">end</span>
|
1370
|
-
</pre>
|
1371
|
-
</div>
|
1372
|
-
</div>
|
1373
|
-
</div>
|
1374
|
-
<div class="method">
|
1375
|
-
<div class="title">
|
1376
|
-
<a name="M000349"></a><b>indent</b>(n)
|
1377
|
-
</div>
|
1378
|
-
<div class="description">
|
1379
|
-
<p>
|
1380
|
-
Indent left or right by n spaces. (This used to be called <a
|
1381
|
-
href="String.html#M000347">tab</a> and aliased as <a
|
1382
|
-
href="String.html#M000349">indent</a>.)
|
1383
|
-
</p>
|
1384
|
-
</div>
|
1385
|
-
<div class="sourcecode">
|
1386
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000349_source')" id="l_M000349_source">show source</a> ]</p>
|
1387
|
-
<div id="M000349_source" class="dyn-source">
|
1388
|
-
<pre>
|
1389
|
-
<span class="ruby-comment cmt"># File lib/facets/core/string/indent.rb, line 25</span>
|
1390
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">indent</span>(<span class="ruby-identifier">n</span>)
|
1391
|
-
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">n</span> <span class="ruby-operator">>=</span> <span class="ruby-value">0</span>
|
1392
|
-
<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/^/</span>, <span class="ruby-value str">' '</span> <span class="ruby-operator">*</span> <span class="ruby-identifier">n</span>)
|
1393
|
-
<span class="ruby-keyword kw">else</span>
|
1394
|
-
<span class="ruby-identifier">gsub</span>(<span class="ruby-node">/^ {0,#{-n}}/</span>, <span class="ruby-value str">""</span>)
|
1395
|
-
<span class="ruby-keyword kw">end</span>
|
1396
|
-
<span class="ruby-keyword kw">end</span>
|
1397
|
-
</pre>
|
1398
|
-
</div>
|
1399
|
-
</div>
|
1400
|
-
</div>
|
1401
|
-
<div class="method">
|
1402
|
-
<div class="title">
|
1403
|
-
<a name="M000368"></a><b>index_all</b>(s, reuse=false)
|
1404
|
-
</div>
|
1405
|
-
<div class="description">
|
1406
|
-
<p>
|
1407
|
-
Like index but returns an array of all index locations. The reuse flag
|
1408
|
-
allows the trailing portion of a match to be reused for subsquent matches.
|
1409
|
-
</p>
|
1410
|
-
<pre>
|
1411
|
-
"abcabcabc".index_all('a') #=> [0,3,6]
|
1412
|
-
</pre>
|
1413
|
-
</div>
|
1414
|
-
<div class="sourcecode">
|
1415
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000368_source')" id="l_M000368_source">show source</a> ]</p>
|
1416
|
-
<div id="M000368_source" class="dyn-source">
|
1417
|
-
<pre>
|
1418
|
-
<span class="ruby-comment cmt"># File lib/facets/core/string/index_all.rb, line 10</span>
|
1419
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">index_all</span>(<span class="ruby-identifier">s</span>, <span class="ruby-identifier">reuse</span>=<span class="ruby-keyword kw">false</span>)
|
1420
|
-
<span class="ruby-identifier">ia</span> = []; <span class="ruby-identifier">i</span> = <span class="ruby-value">0</span>
|
1421
|
-
<span class="ruby-keyword kw">while</span> (<span class="ruby-identifier">i</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">index</span>(<span class="ruby-identifier">s</span>,<span class="ruby-identifier">i</span>))
|
1422
|
-
<span class="ruby-identifier">ia</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">i</span>
|
1423
|
-
<span class="ruby-identifier">i</span> <span class="ruby-operator">+=</span> (<span class="ruby-identifier">reuse</span> <span class="ruby-value">? </span><span class="ruby-value">1</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">$~</span>.<span class="ruby-identifier">length</span>)
|
1424
|
-
<span class="ruby-keyword kw">end</span>
|
1425
|
-
<span class="ruby-identifier">ia</span>
|
1426
|
-
<span class="ruby-keyword kw">end</span>
|
1427
|
-
</pre>
|
1428
|
-
</div>
|
1429
|
-
</div>
|
1430
|
-
</div>
|
1431
|
-
<div class="method">
|
1432
|
-
<div class="title">
|
1433
|
-
<a name="M000295"></a><b>last</b>(separator_pattern=//)
|
1434
|
-
</div>
|
1435
|
-
<div class="description">
|
1436
|
-
<p>
|
1437
|
-
Returns the last separation of a string. Default separation is by
|
1438
|
-
character.
|
1439
|
-
</p>
|
1440
|
-
<pre>
|
1441
|
-
"Hello World".last(' ') #=> "World"
|
1442
|
-
</pre>
|
1443
|
-
</div>
|
1444
|
-
<div class="sourcecode">
|
1445
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000295_source')" id="l_M000295_source">show source</a> ]</p>
|
1446
|
-
<div id="M000295_source" class="dyn-source">
|
1447
|
-
<pre>
|
1448
|
-
<span class="ruby-comment cmt"># File lib/facets/core/string/last.rb, line 13</span>
|
1449
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">last</span>(<span class="ruby-identifier">separator_pattern</span>=<span class="ruby-regexp re">//</span>)
|
1450
|
-
<span class="ruby-identifier">pattern</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">patterns</span>(<span class="ruby-identifier">separator_pattern</span>)
|
1451
|
-
<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">split</span>(<span class="ruby-identifier">separator_pattern</span>).<span class="ruby-identifier">at</span>(<span class="ruby-value">-1</span>)
|
1452
|
-
<span class="ruby-keyword kw">end</span>
|
1453
|
-
</pre>
|
1454
|
-
</div>
|
1455
|
-
</div>
|
1456
|
-
</div>
|
1457
|
-
<div class="method">
|
1458
|
-
<div class="title">
|
1459
|
-
<a name="M000297"></a><b>last!</b>(separator_pattern=//)
|
1460
|
-
</div>
|
1461
|
-
<div class="description">
|
1462
|
-
<p>
|
1463
|
-
Removes the last separation from a string. Default seperation is by
|
1464
|
-
characeter.
|
1465
|
-
</p>
|
1466
|
-
<pre>
|
1467
|
-
a = "Hello World"
|
1468
|
-
a.last! #=> "d"
|
1469
|
-
a #=> "Hello Worl"
|
1470
|
-
|
1471
|
-
a = "Hello World"
|
1472
|
-
a.last!(' ') #=> "World"
|
1473
|
-
a #=> "Hello"
|
1474
|
-
</pre>
|
1475
|
-
</div>
|
1476
|
-
<div class="sourcecode">
|
1477
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000297_source')" id="l_M000297_source">show source</a> ]</p>
|
1478
|
-
<div id="M000297_source" class="dyn-source">
|
1479
|
-
<pre>
|
1480
|
-
<span class="ruby-comment cmt"># File lib/facets/core/string/last.rb, line 43</span>
|
1481
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">last!</span>(<span class="ruby-identifier">separator_pattern</span>=<span class="ruby-regexp re">//</span>)
|
1482
|
-
<span class="ruby-identifier">pattern</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">patterns</span>(<span class="ruby-identifier">separator_pattern</span>)
|
1483
|
-
<span class="ruby-identifier">a</span> = <span class="ruby-identifier">shatter</span>(<span class="ruby-identifier">pattern</span>)
|
1484
|
-
<span class="ruby-identifier">r</span> = <span class="ruby-identifier">a</span>.<span class="ruby-identifier">last</span>
|
1485
|
-
<span class="ruby-identifier">a</span>.<span class="ruby-identifier">pop</span>
|
1486
|
-
<span class="ruby-identifier">a</span>.<span class="ruby-identifier">pop</span>
|
1487
|
-
<span class="ruby-identifier">replace</span>( <span class="ruby-identifier">a</span>.<span class="ruby-identifier">join</span>(<span class="ruby-value str">''</span>) )
|
1488
|
-
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">r</span>
|
1489
|
-
<span class="ruby-keyword kw">end</span>
|
1490
|
-
</pre>
|
1491
|
-
</div>
|
1492
|
-
</div>
|
1493
|
-
</div>
|
1494
|
-
<div class="method">
|
1495
|
-
<div class="title">
|
1496
|
-
<a name="M000296"></a><b>last=</b>(str)
|
1497
|
-
</div>
|
1498
|
-
<div class="description">
|
1499
|
-
<p>
|
1500
|
-
Appends to a string.
|
1501
|
-
</p>
|
1502
|
-
<pre>
|
1503
|
-
"Hello World".last = ", Bye." #=> "Hello World, Bye."
|
1504
|
-
</pre>
|
1505
|
-
</div>
|
1506
|
-
<div class="sourcecode">
|
1507
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000296_source')" id="l_M000296_source">show source</a> ]</p>
|
1508
|
-
<div id="M000296_source" class="dyn-source">
|
1509
|
-
<pre>
|
1510
|
-
<span class="ruby-comment cmt"># File lib/facets/core/string/last.rb, line 22</span>
|
1511
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">last=</span>(<span class="ruby-identifier">str</span>)
|
1512
|
-
<span class="ruby-keyword kw">self</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">str</span>
|
1513
|
-
<span class="ruby-keyword kw">end</span>
|
1514
|
-
</pre>
|
1515
|
-
</div>
|
1516
|
-
</div>
|
1517
|
-
</div>
|
1518
|
-
<div class="method">
|
1519
|
-
<div class="title">
|
1520
|
-
<a name="M000341"></a><b>last_char</b>(n=1)
|
1521
|
-
</div>
|
1522
|
-
<div class="description">
|
1523
|
-
<p>
|
1524
|
-
Returns last <em>n</em> characters.
|
1525
|
-
</p>
|
1526
|
-
<pre>
|
1527
|
-
"Hello World".last_char(3) #=> "rld"
|
1528
|
-
</pre>
|
1529
|
-
</div>
|
1530
|
-
<div class="sourcecode">
|
1531
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000341_source')" id="l_M000341_source">show source</a> ]</p>
|
1532
|
-
<div id="M000341_source" class="dyn-source">
|
1533
|
-
<pre>
|
1534
|
-
<span class="ruby-comment cmt"># File lib/facets/core/string/last_char.rb, line 8</span>
|
1535
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">last_char</span>(<span class="ruby-identifier">n</span>=<span class="ruby-value">1</span>)
|
1536
|
-
<span class="ruby-identifier">n</span> = <span class="ruby-identifier">n</span>.<span class="ruby-identifier">to_i</span>
|
1537
|
-
<span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">self</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">n</span> <span class="ruby-operator">></span> <span class="ruby-identifier">size</span>
|
1538
|
-
<span class="ruby-identifier">slice</span>(<span class="ruby-operator">-</span><span class="ruby-identifier">n</span>, <span class="ruby-identifier">n</span>) <span class="ruby-comment cmt">#self[-n..-1]</span>
|
1539
|
-
<span class="ruby-keyword kw">end</span>
|
1540
|
-
</pre>
|
1541
|
-
</div>
|
1542
|
-
</div>
|
1543
|
-
</div>
|
1544
|
-
<div class="method">
|
1545
|
-
<div class="title">
|
1546
|
-
<a name="M000342"></a><b>line_wrap</b>(width)
|
1547
|
-
</div>
|
1548
|
-
<div class="description">
|
1549
|
-
<p>
|
1550
|
-
Line wrap at width.
|
1551
|
-
</p>
|
1552
|
-
<pre>
|
1553
|
-
puts "1234567890".line_wrap(5)
|
1554
|
-
</pre>
|
1555
|
-
<p>
|
1556
|
-
<em>produces</em>
|
1557
|
-
</p>
|
1558
|
-
<pre>
|
1559
|
-
12345
|
1560
|
-
67890
|
1561
|
-
</pre>
|
1562
|
-
</div>
|
1563
|
-
<div class="sourcecode">
|
1564
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000342_source')" id="l_M000342_source">show source</a> ]</p>
|
1565
|
-
<div id="M000342_source" class="dyn-source">
|
1566
|
-
<pre>
|
1567
|
-
<span class="ruby-comment cmt"># File lib/facets/core/string/line_wrap.rb, line 13</span>
|
1568
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">line_wrap</span>(<span class="ruby-identifier">width</span>)
|
1569
|
-
<span class="ruby-identifier">s</span> = <span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/\t/</span>,<span class="ruby-value str">' '</span><span class="ruby-operator">*</span><span class="ruby-value">4</span>) <span class="ruby-comment cmt"># tabs default to 4 spaces.</span>
|
1570
|
-
<span class="ruby-identifier">s</span> = <span class="ruby-identifier">s</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/\n/</span>,<span class="ruby-value str">' '</span>)
|
1571
|
-
<span class="ruby-identifier">r</span> = <span class="ruby-identifier">s</span>.<span class="ruby-identifier">scan</span>( <span class="ruby-node">/.{1,#{width}}/</span> )
|
1572
|
-
<span class="ruby-identifier">r</span>.<span class="ruby-identifier">join</span>(<span class="ruby-value str">"\n"</span>) <span class="ruby-operator"><<</span> <span class="ruby-value str">"\n"</span>
|
1573
|
-
<span class="ruby-keyword kw">end</span>
|
1574
|
-
</pre>
|
1575
|
-
</div>
|
1576
|
-
</div>
|
1577
|
-
</div>
|
1578
|
-
<div class="method">
|
1579
|
-
<div class="title">
|
1580
|
-
<a name="M000378"></a><b>lines</b>()
|
1581
|
-
</div>
|
1582
|
-
<div class="description">
|
1583
|
-
<p>
|
1584
|
-
Returns an array of characters.
|
1585
|
-
</p>
|
1586
|
-
<pre>
|
1587
|
-
"abc\n123".lines #=> ["abc","123"]
|
1588
|
-
</pre>
|
1589
|
-
</div>
|
1590
|
-
<div class="sourcecode">
|
1591
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000378_source')" id="l_M000378_source">show source</a> ]</p>
|
1592
|
-
<div id="M000378_source" class="dyn-source">
|
1593
|
-
<pre>
|
1594
|
-
<span class="ruby-comment cmt"># File lib/facets/core/string/lines.rb, line 8</span>
|
1595
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">lines</span>
|
1596
|
-
<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">split</span>(<span class="ruby-regexp re">/\n/</span>)
|
1597
|
-
<span class="ruby-keyword kw">end</span>
|
1598
|
-
</pre>
|
1599
|
-
</div>
|
1600
|
-
</div>
|
1601
|
-
</div>
|
1602
|
-
<div class="method">
|
1603
|
-
<div class="title">
|
1604
|
-
<a name="M000357"></a><b>lowercase?</b>()
|
1605
|
-
</div>
|
1606
|
-
<div class="description">
|
1607
|
-
<p>
|
1608
|
-
Alias for <a href="String.html#M000322">downcase?</a>
|
1609
|
-
</p>
|
1610
|
-
</div>
|
1611
|
-
</div>
|
1612
|
-
<div class="method">
|
1613
|
-
<div class="title">
|
1614
|
-
<a name="M000291"></a><b>margin</b>(n=0)
|
1615
|
-
</div>
|
1616
|
-
<div class="description">
|
1617
|
-
<p>
|
1618
|
-
Provides a margin controlled string.
|
1619
|
-
</p>
|
1620
|
-
<pre>
|
1621
|
-
x = %Q{
|
1622
|
-
| This
|
1623
|
-
| is
|
1624
|
-
| margin controlled!
|
1625
|
-
}.margin
|
1626
|
-
</pre>
|
1627
|
-
</div>
|
1628
|
-
<div class="sourcecode">
|
1629
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000291_source')" id="l_M000291_source">show source</a> ]</p>
|
1630
|
-
<div id="M000291_source" class="dyn-source">
|
1631
|
-
<pre>
|
1632
|
-
<span class="ruby-comment cmt"># File lib/facets/core/string/margin.rb, line 15</span>
|
1633
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">margin</span>(<span class="ruby-identifier">n</span>=<span class="ruby-value">0</span>)
|
1634
|
-
<span class="ruby-identifier">d</span> = <span class="ruby-regexp re">/\A.*\n\s*(.)/</span>.<span class="ruby-identifier">match</span>( <span class="ruby-keyword kw">self</span> )[<span class="ruby-value">1</span>]
|
1635
|
-
<span class="ruby-identifier">d</span> = <span class="ruby-regexp re">/\A\s*(.)/</span>.<span class="ruby-identifier">match</span>( <span class="ruby-keyword kw">self</span>)[<span class="ruby-value">1</span>] <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">d</span>
|
1636
|
-
<span class="ruby-keyword kw">return</span> <span class="ruby-value str">''</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">d</span>
|
1637
|
-
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">n</span> <span class="ruby-operator">==</span> <span class="ruby-value">0</span>
|
1638
|
-
<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/\n\s*\Z/</span>,<span class="ruby-value str">''</span>).<span class="ruby-identifier">gsub</span>(<span class="ruby-node">/^\s*[#{d}]/</span>, <span class="ruby-value str">''</span>)
|
1639
|
-
<span class="ruby-keyword kw">else</span>
|
1640
|
-
<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/\n\s*\Z/</span>,<span class="ruby-value str">''</span>).<span class="ruby-identifier">gsub</span>(<span class="ruby-node">/^\s*[#{d}]/</span>, <span class="ruby-value str">' '</span> <span class="ruby-operator">*</span> <span class="ruby-identifier">n</span>)
|
1641
|
-
<span class="ruby-keyword kw">end</span>
|
1642
|
-
<span class="ruby-keyword kw">end</span>
|
1643
|
-
</pre>
|
1644
|
-
</div>
|
1645
|
-
</div>
|
1646
|
-
</div>
|
1647
|
-
<div class="method">
|
1648
|
-
<div class="title">
|
1649
|
-
<a name="M000381"></a><b>methodize</b>()
|
1650
|
-
</div>
|
1651
|
-
<div class="description">
|
1652
|
-
<p>
|
1653
|
-
Converts a string into a valid ruby method name This method is geared
|
1654
|
-
toward code reflection.
|
1655
|
-
</p>
|
1656
|
-
<pre>
|
1657
|
-
"MyModule::MyClass".methodize #=> "my_module__my_class"
|
1658
|
-
</pre>
|
1659
|
-
<p>
|
1660
|
-
See also <a href="String.html#M000379">String#modulize</a>, <a
|
1661
|
-
href="String.html#M000380">String#pathize</a>
|
1662
|
-
</p>
|
1663
|
-
<h2>TODO</h2>
|
1664
|
-
<ul>
|
1665
|
-
<li>Make sure that all scenarios return a valid ruby class name
|
1666
|
-
|
1667
|
-
</li>
|
1668
|
-
<li>Make sure it is revertible
|
1669
|
-
|
1670
|
-
</li>
|
1671
|
-
</ul>
|
1672
|
-
</div>
|
1673
|
-
<div class="sourcecode">
|
1674
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000381_source')" id="l_M000381_source">show source</a> ]</p>
|
1675
|
-
<div id="M000381_source" class="dyn-source">
|
1676
|
-
<pre>
|
1677
|
-
<span class="ruby-comment cmt"># File lib/facets/core/string/methodize.rb, line 18</span>
|
1678
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">methodize</span>
|
1679
|
-
<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/([A-Z])/</span>, <span class="ruby-value str">'_\1'</span>).<span class="ruby-identifier">downcase</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/^_/</span>,<span class="ruby-value str">''</span>).<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/(::|\/)_?/</span>, <span class="ruby-value str">'__'</span>)
|
1680
|
-
<span class="ruby-keyword kw">end</span>
|
1681
|
-
</pre>
|
1682
|
-
</div>
|
1683
|
-
</div>
|
1684
|
-
</div>
|
1685
|
-
<div class="method">
|
1686
|
-
<div class="title">
|
1687
|
-
<a name="M000379"></a><b>modulize</b>()
|
1688
|
-
</div>
|
1689
|
-
<div class="description">
|
1690
|
-
<p>
|
1691
|
-
Converts a string into a valid ruby class or module name This method is
|
1692
|
-
geared toward code reflection.
|
1693
|
-
</p>
|
1694
|
-
<pre>
|
1695
|
-
"my_module__my_path".modulize #=> "MyModule::MyPath"
|
1696
|
-
</pre>
|
1697
|
-
<p>
|
1698
|
-
See also <a href="String.html#M000381">String#methodize</a>, <a
|
1699
|
-
href="String.html#M000380">String#pathize</a>
|
1700
|
-
</p>
|
1701
|
-
<p>
|
1702
|
-
TODO
|
1703
|
-
</p>
|
1704
|
-
<ul>
|
1705
|
-
<li>Make sure that all scenarios return a valid ruby class name
|
1706
|
-
|
1707
|
-
</li>
|
1708
|
-
<li>Make sure it is revertible
|
1709
|
-
|
1710
|
-
</li>
|
1711
|
-
</ul>
|
1712
|
-
</div>
|
1713
|
-
<div class="sourcecode">
|
1714
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000379_source')" id="l_M000379_source">show source</a> ]</p>
|
1715
|
-
<div id="M000379_source" class="dyn-source">
|
1716
|
-
<pre>
|
1717
|
-
<span class="ruby-comment cmt"># File lib/facets/core/string/modulize.rb, line 16</span>
|
1718
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">modulize</span>
|
1719
|
-
<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/(__|\/)(.?)/</span>){ <span class="ruby-value str">"::"</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">$2</span>.<span class="ruby-identifier">upcase</span> }.<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/(^|_)(.)/</span>){ <span class="ruby-identifier">$2</span>.<span class="ruby-identifier">upcase</span> }
|
1720
|
-
<span class="ruby-keyword kw">end</span>
|
1721
|
-
</pre>
|
1722
|
-
</div>
|
1723
|
-
</div>
|
1724
|
-
</div>
|
1725
|
-
<div class="method">
|
1726
|
-
<div class="title">
|
1727
|
-
<a name="M000374"></a><b>mscan</b>(re) {|| ...}
|
1728
|
-
</div>
|
1729
|
-
<div class="description">
|
1730
|
-
<p>
|
1731
|
-
Like scan but returns <a href="MatchData.html">MatchData</a> ($~) rather
|
1732
|
-
then matched string ($&).
|
1733
|
-
</p>
|
1734
|
-
</div>
|
1735
|
-
<div class="sourcecode">
|
1736
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000374_source')" id="l_M000374_source">show source</a> ]</p>
|
1737
|
-
<div id="M000374_source" class="dyn-source">
|
1738
|
-
<pre>
|
1739
|
-
<span class="ruby-comment cmt"># File lib/facets/core/string/mscan.rb, line 7</span>
|
1740
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">mscan</span>(<span class="ruby-identifier">re</span>) <span class="ruby-comment cmt">#:yield:</span>
|
1741
|
-
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">block_given?</span>
|
1742
|
-
<span class="ruby-identifier">scan</span>(<span class="ruby-identifier">re</span>) { <span class="ruby-keyword kw">yield</span>(<span class="ruby-identifier">$~</span>) }
|
1743
|
-
<span class="ruby-keyword kw">else</span>
|
1744
|
-
<span class="ruby-identifier">m</span> = []
|
1745
|
-
<span class="ruby-identifier">scan</span>(<span class="ruby-identifier">re</span>) { <span class="ruby-identifier">m</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">$~</span> }
|
1746
|
-
<span class="ruby-identifier">m</span>
|
1747
|
-
<span class="ruby-keyword kw">end</span>
|
1748
|
-
<span class="ruby-keyword kw">end</span>
|
1749
|
-
</pre>
|
1750
|
-
</div>
|
1751
|
-
</div>
|
1752
|
-
</div>
|
1753
|
-
<div class="method">
|
1754
|
-
<div class="title">
|
1755
|
-
<a name="M000377"></a><b>natcmp</b>(str2, caseInsensitive=false)
|
1756
|
-
</div>
|
1757
|
-
<div class="description">
|
1758
|
-
<p>
|
1759
|
-
‘Natural order’ comparison of two strings, e.g.
|
1760
|
-
</p>
|
1761
|
-
<pre>
|
1762
|
-
"my_prog_v1.1.0" < "my_prog_v1.2.0" < "my_prog_v1.10.0"
|
1763
|
-
</pre>
|
1764
|
-
<p>
|
1765
|
-
which does not follow alphabetically. A secondary parameter, if set to
|
1766
|
-
<em>true</em>, makes the comparison case insensitive.
|
1767
|
-
</p>
|
1768
|
-
<pre>
|
1769
|
-
"Hello.10".natcmp("Hello.1") #=> -1
|
1770
|
-
</pre>
|
1771
|
-
</div>
|
1772
|
-
<div class="sourcecode">
|
1773
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000377_source')" id="l_M000377_source">show source</a> ]</p>
|
1774
|
-
<div id="M000377_source" class="dyn-source">
|
1775
|
-
<pre>
|
1776
|
-
<span class="ruby-comment cmt"># File lib/facets/core/string/natcmp.rb, line 42</span>
|
1777
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">natcmp</span>(<span class="ruby-identifier">str2</span>, <span class="ruby-identifier">caseInsensitive</span>=<span class="ruby-keyword kw">false</span>)
|
1778
|
-
<span class="ruby-identifier">str1</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">dup</span>
|
1779
|
-
<span class="ruby-identifier">str2</span> = <span class="ruby-identifier">str2</span>.<span class="ruby-identifier">dup</span>
|
1780
|
-
<span class="ruby-identifier">compareExpression</span> = <span class="ruby-regexp re">/^(\D*)(\d*)(.*)$/</span>
|
1781
|
-
|
1782
|
-
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">caseInsensitive</span>
|
1783
|
-
<span class="ruby-identifier">str1</span>.<span class="ruby-identifier">downcase!</span>
|
1784
|
-
<span class="ruby-identifier">str2</span>.<span class="ruby-identifier">downcase!</span>
|
1785
|
-
<span class="ruby-keyword kw">end</span>
|
1786
|
-
|
1787
|
-
<span class="ruby-comment cmt"># remove all whitespace</span>
|
1788
|
-
<span class="ruby-identifier">str1</span>.<span class="ruby-identifier">gsub!</span>(<span class="ruby-regexp re">/\s*/</span>, <span class="ruby-value str">''</span>)
|
1789
|
-
<span class="ruby-identifier">str2</span>.<span class="ruby-identifier">gsub!</span>(<span class="ruby-regexp re">/\s*/</span>, <span class="ruby-value str">''</span>)
|
1790
|
-
|
1791
|
-
<span class="ruby-keyword kw">while</span> (<span class="ruby-identifier">str1</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">></span> <span class="ruby-value">0</span>) <span class="ruby-keyword kw">or</span> (<span class="ruby-identifier">str2</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">></span> <span class="ruby-value">0</span>) <span class="ruby-keyword kw">do</span>
|
1792
|
-
<span class="ruby-comment cmt"># Extract non-digits, digits and rest of string</span>
|
1793
|
-
<span class="ruby-identifier">str1</span> <span class="ruby-operator">=~</span> <span class="ruby-identifier">compareExpression</span>
|
1794
|
-
<span class="ruby-identifier">chars1</span>, <span class="ruby-identifier">num1</span>, <span class="ruby-identifier">str1</span> = <span class="ruby-identifier">$1</span>.<span class="ruby-identifier">dup</span>, <span class="ruby-identifier">$2</span>.<span class="ruby-identifier">dup</span>, <span class="ruby-identifier">$3</span>.<span class="ruby-identifier">dup</span>
|
1795
|
-
<span class="ruby-identifier">str2</span> <span class="ruby-operator">=~</span> <span class="ruby-identifier">compareExpression</span>
|
1796
|
-
<span class="ruby-identifier">chars2</span>, <span class="ruby-identifier">num2</span>, <span class="ruby-identifier">str2</span> = <span class="ruby-identifier">$1</span>.<span class="ruby-identifier">dup</span>, <span class="ruby-identifier">$2</span>.<span class="ruby-identifier">dup</span>, <span class="ruby-identifier">$3</span>.<span class="ruby-identifier">dup</span>
|
1797
|
-
<span class="ruby-comment cmt"># Compare the non-digits</span>
|
1798
|
-
<span class="ruby-keyword kw">case</span> (<span class="ruby-identifier">chars1</span> <span class="ruby-operator"><=></span> <span class="ruby-identifier">chars2</span>)
|
1799
|
-
<span class="ruby-keyword kw">when</span> <span class="ruby-value">0</span> <span class="ruby-comment cmt"># Non-digits are the same, compare the digits...</span>
|
1800
|
-
<span class="ruby-comment cmt"># If either number begins with a zero, then compare alphabetically,</span>
|
1801
|
-
<span class="ruby-comment cmt"># otherwise compare numerically</span>
|
1802
|
-
<span class="ruby-keyword kw">if</span> (<span class="ruby-identifier">num1</span>[<span class="ruby-value">0</span>] <span class="ruby-operator">!=</span> <span class="ruby-value">48</span>) <span class="ruby-keyword kw">and</span> (<span class="ruby-identifier">num2</span>[<span class="ruby-value">0</span>] <span class="ruby-operator">!=</span> <span class="ruby-value">48</span>)
|
1803
|
-
<span class="ruby-identifier">num1</span>, <span class="ruby-identifier">num2</span> = <span class="ruby-identifier">num1</span>.<span class="ruby-identifier">to_i</span>, <span class="ruby-identifier">num2</span>.<span class="ruby-identifier">to_i</span>
|
1804
|
-
<span class="ruby-keyword kw">end</span>
|
1805
|
-
<span class="ruby-keyword kw">case</span> (<span class="ruby-identifier">num1</span> <span class="ruby-operator"><=></span> <span class="ruby-identifier">num2</span>)
|
1806
|
-
<span class="ruby-keyword kw">when</span> <span class="ruby-value">-1</span> <span class="ruby-keyword kw">then</span> <span class="ruby-keyword kw">return</span> <span class="ruby-value">-1</span>
|
1807
|
-
<span class="ruby-keyword kw">when</span> <span class="ruby-value">1</span> <span class="ruby-keyword kw">then</span> <span class="ruby-keyword kw">return</span> <span class="ruby-value">1</span>
|
1808
|
-
<span class="ruby-keyword kw">end</span>
|
1809
|
-
<span class="ruby-keyword kw">when</span> <span class="ruby-value">-1</span> <span class="ruby-keyword kw">then</span> <span class="ruby-keyword kw">return</span> <span class="ruby-value">-1</span>
|
1810
|
-
<span class="ruby-keyword kw">when</span> <span class="ruby-value">1</span> <span class="ruby-keyword kw">then</span> <span class="ruby-keyword kw">return</span> <span class="ruby-value">1</span>
|
1811
|
-
<span class="ruby-keyword kw">end</span> <span class="ruby-comment cmt"># case</span>
|
1812
|
-
<span class="ruby-keyword kw">end</span> <span class="ruby-comment cmt"># while</span>
|
1813
|
-
|
1814
|
-
<span class="ruby-comment cmt"># strings are naturally equal.</span>
|
1815
|
-
<span class="ruby-keyword kw">return</span> <span class="ruby-value">0</span>
|
1816
|
-
<span class="ruby-keyword kw">end</span>
|
1817
|
-
|
1818
|
-
<span class="ruby-keyword kw">end</span>
|
1819
|
-
</pre>
|
1820
|
-
</div>
|
1821
|
-
</div>
|
1822
|
-
</div>
|
1823
|
-
<div class="method">
|
1824
|
-
<div class="title">
|
1825
|
-
<a name="M000300"></a><b>nchar</b>( n, replacement=nil )
|
1826
|
-
</div>
|
1827
|
-
<div class="description">
|
1828
|
-
<p>
|
1829
|
-
Retrns <em>n</em> characters of the string. If <em>n</em> is positive the
|
1830
|
-
characters are from the beginning of the string. If <em>n</em> is negative
|
1831
|
-
from the end of the string.
|
1832
|
-
</p>
|
1833
|
-
<p>
|
1834
|
-
Alternatively a replacement string can be given, which will replace the
|
1835
|
-
<em>n</em> characters.
|
1836
|
-
</p>
|
1837
|
-
</div>
|
1838
|
-
<div class="sourcecode">
|
1839
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000300_source')" id="l_M000300_source">show source</a> ]</p>
|
1840
|
-
<div id="M000300_source" class="dyn-source">
|
1841
|
-
<pre>
|
1842
|
-
<span class="ruby-comment cmt"># File lib/facets/core/string/nchar.rb, line 11</span>
|
1843
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">nchar</span>( <span class="ruby-identifier">n</span>, <span class="ruby-identifier">replacement</span>=<span class="ruby-keyword kw">nil</span> )
|
1844
|
-
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">replacement</span>
|
1845
|
-
<span class="ruby-identifier">s</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">dup</span>
|
1846
|
-
<span class="ruby-identifier">n</span> <span class="ruby-operator">></span> <span class="ruby-value">0</span> <span class="ruby-operator">?</span> (<span class="ruby-identifier">s</span>[<span class="ruby-value">0</span><span class="ruby-operator">...</span><span class="ruby-identifier">n</span>] = <span class="ruby-identifier">replacement</span>) <span class="ruby-operator">:</span> (<span class="ruby-identifier">s</span>[<span class="ruby-identifier">n</span><span class="ruby-operator">..</span><span class="ruby-value">-1</span>] = <span class="ruby-identifier">replacement</span>)
|
1847
|
-
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">s</span>
|
1848
|
-
<span class="ruby-keyword kw">else</span>
|
1849
|
-
<span class="ruby-identifier">n</span> <span class="ruby-operator">></span> <span class="ruby-value">0</span> <span class="ruby-operator">?</span> <span class="ruby-keyword kw">self</span>[<span class="ruby-value">0</span><span class="ruby-operator">...</span><span class="ruby-identifier">n</span>] <span class="ruby-operator">:</span> <span class="ruby-keyword kw">self</span>[<span class="ruby-identifier">n</span><span class="ruby-operator">..</span><span class="ruby-value">-1</span>]
|
1850
|
-
<span class="ruby-keyword kw">end</span>
|
1851
|
-
<span class="ruby-keyword kw">end</span>
|
1852
|
-
</pre>
|
1853
|
-
</div>
|
1854
|
-
</div>
|
1855
|
-
</div>
|
1856
|
-
<div class="method">
|
1857
|
-
<div class="title">
|
1858
|
-
<a name="M000359"></a><b>ordinal</b>()
|
1859
|
-
</div>
|
1860
|
-
<div class="sourcecode">
|
1861
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000359_source')" id="l_M000359_source">show source</a> ]</p>
|
1862
|
-
<div id="M000359_source" class="dyn-source">
|
1863
|
-
<pre>
|
1864
|
-
<span class="ruby-comment cmt"># File lib/facets/core/string/ordinal.rb, line 4</span>
|
1865
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">ordinal</span>
|
1866
|
-
<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">to_i</span>.<span class="ruby-identifier">ordinal</span>
|
1867
|
-
<span class="ruby-keyword kw">end</span>
|
1868
|
-
</pre>
|
1869
|
-
</div>
|
1870
|
-
</div>
|
1871
|
-
</div>
|
1872
|
-
<div class="method">
|
1873
|
-
<div class="title">
|
1874
|
-
<a name="M000380"></a><b>pathize</b>()
|
1875
|
-
</div>
|
1876
|
-
<div class="description">
|
1877
|
-
<p>
|
1878
|
-
Converts a string into a unix path. This method is geared toward code
|
1879
|
-
reflection.
|
1880
|
-
</p>
|
1881
|
-
<p>
|
1882
|
-
See : <a href="String.html#M000379">String#modulize</a>, <a
|
1883
|
-
href="String.html#M000381">String#methodize</a>
|
1884
|
-
</p>
|
1885
|
-
<pre>
|
1886
|
-
"MyModule::MyClass".pathize #=> my_module/my_class
|
1887
|
-
"my_module__my_class".pathize #=> my_module/my_class
|
1888
|
-
</pre>
|
1889
|
-
<p>
|
1890
|
-
TODO :
|
1891
|
-
</p>
|
1892
|
-
<ul>
|
1893
|
-
<li>Make sure that all scenarios return a valid unix path
|
1894
|
-
|
1895
|
-
</li>
|
1896
|
-
<li>Make sure it is revertible
|
1897
|
-
|
1898
|
-
</li>
|
1899
|
-
</ul>
|
1900
|
-
</div>
|
1901
|
-
<div class="sourcecode">
|
1902
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000380_source')" id="l_M000380_source">show source</a> ]</p>
|
1903
|
-
<div id="M000380_source" class="dyn-source">
|
1904
|
-
<pre>
|
1905
|
-
<span class="ruby-comment cmt"># File lib/facets/core/string/pathize.rb, line 17</span>
|
1906
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">pathize</span>
|
1907
|
-
<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/([A-Z])/</span>, <span class="ruby-value str">'_\1'</span>).<span class="ruby-identifier">downcase</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/^_/</span>,<span class="ruby-value str">''</span>).<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/(::|__)_?/</span>, <span class="ruby-value str">'/'</span>)
|
1908
|
-
<span class="ruby-keyword kw">end</span>
|
1909
|
-
</pre>
|
1910
|
-
</div>
|
1911
|
-
</div>
|
1912
|
-
</div>
|
1913
|
-
<div class="method">
|
1914
|
-
<div class="title">
|
1915
|
-
<a name="M000302"></a><b>plural</b>()
|
1916
|
-
</div>
|
1917
|
-
<div class="description">
|
1918
|
-
<p>
|
1919
|
-
Convert an English word from singular to plurel.
|
1920
|
-
</p>
|
1921
|
-
<pre>
|
1922
|
-
"boy".plural #=> boys
|
1923
|
-
"tomato".plural #=> tomatoes
|
1924
|
-
</pre>
|
1925
|
-
</div>
|
1926
|
-
<div class="aka">
|
1927
|
-
This method is also aliased as
|
1928
|
-
<a href="String.html#M000304">pluralize</a>
|
1929
|
-
</div>
|
1930
|
-
<div class="sourcecode">
|
1931
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000302_source')" id="l_M000302_source">show source</a> ]</p>
|
1932
|
-
<div id="M000302_source" class="dyn-source">
|
1933
|
-
<pre>
|
1934
|
-
<span class="ruby-comment cmt"># File lib/facets/core/string/singular.rb, line 76</span>
|
1935
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">plural</span>
|
1936
|
-
<span class="ruby-identifier">result</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">dup</span>
|
1937
|
-
<span class="ruby-constant">String</span><span class="ruby-operator">::</span><span class="ruby-constant">PLURAL_RULES</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span>(<span class="ruby-identifier">rule</span>, <span class="ruby-identifier">replacement</span>)<span class="ruby-operator">|</span>
|
1938
|
-
<span class="ruby-keyword kw">break</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">result</span>.<span class="ruby-identifier">gsub!</span>(<span class="ruby-identifier">rule</span>, <span class="ruby-identifier">replacement</span>)
|
1939
|
-
<span class="ruby-keyword kw">end</span>
|
1940
|
-
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">result</span>
|
1941
|
-
<span class="ruby-keyword kw">end</span>
|
1942
|
-
</pre>
|
1943
|
-
</div>
|
1944
|
-
</div>
|
1945
|
-
</div>
|
1946
|
-
<div class="method">
|
1947
|
-
<div class="title">
|
1948
|
-
<a name="M000304"></a><b>pluralize</b>()
|
1949
|
-
</div>
|
1950
|
-
<div class="description">
|
1951
|
-
<p>
|
1952
|
-
Alias for <a href="String.html#M000302">plural</a>
|
1953
|
-
</p>
|
1954
|
-
</div>
|
1955
|
-
</div>
|
1956
|
-
<div class="method">
|
1957
|
-
<div class="title">
|
1958
|
-
<a name="M000354"></a><b>pop</b>()
|
1959
|
-
</div>
|
1960
|
-
<div class="description">
|
1961
|
-
<p>
|
1962
|
-
Polymorphic with <a href="Array.html">Array</a> of characters.
|
1963
|
-
</p>
|
1964
|
-
</div>
|
1965
|
-
<div class="sourcecode">
|
1966
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000354_source')" id="l_M000354_source">show source</a> ]</p>
|
1967
|
-
<div id="M000354_source" class="dyn-source">
|
1968
|
-
<pre>
|
1969
|
-
<span class="ruby-comment cmt"># File lib/facets/core/string/pop.rb, line 5</span>
|
1970
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">pop</span>
|
1971
|
-
<span class="ruby-keyword kw">return</span> <span class="ruby-value str">''</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">size</span> <span class="ruby-operator">==</span> <span class="ruby-value">0</span>
|
1972
|
-
<span class="ruby-identifier">r</span> = <span class="ruby-keyword kw">self</span>[<span class="ruby-value">-1</span>,<span class="ruby-value">1</span>]
|
1973
|
-
<span class="ruby-keyword kw">self</span>[<span class="ruby-value">-1</span>] = <span class="ruby-value str">''</span>
|
1974
|
-
<span class="ruby-identifier">r</span> <span class="ruby-comment cmt">#self</span>
|
1975
|
-
<span class="ruby-keyword kw">end</span>
|
1976
|
-
</pre>
|
1977
|
-
</div>
|
1978
|
-
</div>
|
1979
|
-
</div>
|
1980
|
-
<div class="method">
|
1981
|
-
<div class="title">
|
1982
|
-
<a name="M000315"></a><b>pot</b>( str=' ' )
|
1983
|
-
</div>
|
1984
|
-
<div class="description">
|
1985
|
-
<p>
|
1986
|
-
Like push but works from the other end of the string.
|
1987
|
-
</p>
|
1988
|
-
</div>
|
1989
|
-
<div class="sourcecode">
|
1990
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000315_source')" id="l_M000315_source">show source</a> ]</p>
|
1991
|
-
<div id="M000315_source" class="dyn-source">
|
1992
|
-
<pre>
|
1993
|
-
<span class="ruby-comment cmt"># File lib/facets/core/string/pot.rb, line 6</span>
|
1994
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">pot</span>( <span class="ruby-identifier">str</span>=<span class="ruby-value str">' '</span> )
|
1995
|
-
<span class="ruby-identifier">insert</span>(<span class="ruby-value">0</span>, <span class="ruby-identifier">str</span>)
|
1996
|
-
<span class="ruby-keyword kw">end</span>
|
1997
|
-
</pre>
|
1998
|
-
</div>
|
1999
|
-
</div>
|
2000
|
-
</div>
|
2001
|
-
<div class="method">
|
2002
|
-
<div class="title">
|
2003
|
-
<a name="M000324"></a><b>probability</b>(*args)
|
2004
|
-
</div>
|
2005
|
-
<div class="sourcecode">
|
2006
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000324_source')" id="l_M000324_source">show source</a> ]</p>
|
2007
|
-
<div id="M000324_source" class="dyn-source">
|
2008
|
-
<pre>
|
2009
|
-
<span class="ruby-comment cmt"># File lib/facets/core/string/probability.rb, line 7</span>
|
2010
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">probability</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
|
2011
|
-
<span class="ruby-identifier">to_arr</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>).<span class="ruby-identifier">probability</span>
|
2012
|
-
<span class="ruby-keyword kw">end</span>
|
2013
|
-
</pre>
|
2014
|
-
</div>
|
2015
|
-
</div>
|
2016
|
-
</div>
|
2017
|
-
<div class="method">
|
2018
|
-
<div class="title">
|
2019
|
-
<a name="M000280"></a><b>pull</b>()
|
2020
|
-
</div>
|
2021
|
-
<div class="description">
|
2022
|
-
<p>
|
2023
|
-
Same as <a href="String.html#M000282">shift</a>.
|
2024
|
-
</p>
|
2025
|
-
</div>
|
2026
|
-
<div class="sourcecode">
|
2027
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000280_source')" id="l_M000280_source">show source</a> ]</p>
|
2028
|
-
<div id="M000280_source" class="dyn-source">
|
2029
|
-
<pre>
|
2030
|
-
<span class="ruby-comment cmt"># File lib/facets/core/string/pull.rb, line 3</span>
|
2031
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">pull</span>
|
2032
|
-
<span class="ruby-keyword kw">return</span> <span class="ruby-value str">''</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">size</span> <span class="ruby-operator">==</span> <span class="ruby-value">0</span>
|
2033
|
-
<span class="ruby-keyword kw">self</span>[<span class="ruby-value">0</span>] = <span class="ruby-value str">''</span>
|
2034
|
-
<span class="ruby-keyword kw">self</span>
|
2035
|
-
<span class="ruby-keyword kw">end</span>
|
2036
|
-
</pre>
|
2037
|
-
</div>
|
2038
|
-
</div>
|
2039
|
-
</div>
|
2040
|
-
<div class="method">
|
2041
|
-
<div class="title">
|
2042
|
-
<a name="M000281"></a><b>push</b>(str=' ')
|
2043
|
-
</div>
|
2044
|
-
<div class="description">
|
2045
|
-
<p>
|
2046
|
-
Polymorphic with <a href="Array.html">Array</a> of characters.
|
2047
|
-
</p>
|
2048
|
-
</div>
|
2049
|
-
<div class="sourcecode">
|
2050
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000281_source')" id="l_M000281_source">show source</a> ]</p>
|
2051
|
-
<div id="M000281_source" class="dyn-source">
|
2052
|
-
<pre>
|
2053
|
-
<span class="ruby-comment cmt"># File lib/facets/core/string/push.rb, line 5</span>
|
2054
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">push</span>(<span class="ruby-identifier">str</span>=<span class="ruby-value str">' '</span>)
|
2055
|
-
<span class="ruby-identifier">concat</span>(<span class="ruby-identifier">str</span>)
|
2056
|
-
<span class="ruby-keyword kw">end</span>
|
2057
|
-
</pre>
|
2058
|
-
</div>
|
2059
|
-
</div>
|
2060
|
-
</div>
|
2061
|
-
<div class="method">
|
2062
|
-
<div class="title">
|
2063
|
-
<a name="M000369"></a><b>quote</b>(type=:s)
|
2064
|
-
</div>
|
2065
|
-
<div class="description">
|
2066
|
-
<p>
|
2067
|
-
Return a new string embraced by given quotes. If no quotes are specified,
|
2068
|
-
then assumes single quotes.
|
2069
|
-
</p>
|
2070
|
-
<pre>
|
2071
|
-
"quote me".quote #=> "'quote me'"
|
2072
|
-
"quote me".quote(2) #=> "\"quote me\""
|
2073
|
-
</pre>
|
2074
|
-
</div>
|
2075
|
-
<div class="sourcecode">
|
2076
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000369_source')" id="l_M000369_source">show source</a> ]</p>
|
2077
|
-
<div id="M000369_source" class="dyn-source">
|
2078
|
-
<pre>
|
2079
|
-
<span class="ruby-comment cmt"># File lib/facets/core/string/quote.rb, line 11</span>
|
2080
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">quote</span>(<span class="ruby-identifier">type</span>=<span class="ruby-identifier">:s</span>)
|
2081
|
-
<span class="ruby-keyword kw">case</span> <span class="ruby-identifier">type</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">downcase</span>
|
2082
|
-
<span class="ruby-keyword kw">when</span> <span class="ruby-value str">'s'</span>, <span class="ruby-value str">'single'</span>
|
2083
|
-
<span class="ruby-identifier">bracket</span>(<span class="ruby-value str">"'"</span>)
|
2084
|
-
<span class="ruby-keyword kw">when</span> <span class="ruby-value str">'d'</span>, <span class="ruby-value str">'double'</span>
|
2085
|
-
<span class="ruby-identifier">bracket</span>(<span class="ruby-value str">'"'</span>)
|
2086
|
-
<span class="ruby-keyword kw">when</span> <span class="ruby-value str">'b'</span>, <span class="ruby-value str">'back'</span>
|
2087
|
-
<span class="ruby-identifier">bracket</span>(<span class="ruby-value str">'`'</span>)
|
2088
|
-
<span class="ruby-keyword kw">else</span>
|
2089
|
-
<span class="ruby-identifier">bracket</span>(<span class="ruby-value str">"'"</span>)
|
2090
|
-
<span class="ruby-keyword kw">end</span>
|
2091
|
-
<span class="ruby-keyword kw">end</span>
|
2092
|
-
</pre>
|
2093
|
-
</div>
|
2094
|
-
</div>
|
2095
|
-
</div>
|
2096
|
-
<div class="method">
|
2097
|
-
<div class="title">
|
2098
|
-
<a name="M000308"></a><b>rand_byte</b>()
|
2099
|
-
</div>
|
2100
|
-
<div class="description">
|
2101
|
-
<p>
|
2102
|
-
Return a random byte of <em>self</em>.
|
2103
|
-
</p>
|
2104
|
-
<pre>
|
2105
|
-
"Ruby rules".rand_byte #=> 121
|
2106
|
-
</pre>
|
2107
|
-
</div>
|
2108
|
-
<div class="sourcecode">
|
2109
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000308_source')" id="l_M000308_source">show source</a> ]</p>
|
2110
|
-
<div id="M000308_source" class="dyn-source">
|
2111
|
-
<pre>
|
2112
|
-
<span class="ruby-comment cmt"># File lib/facets/core/string/rand_byte.rb, line 8</span>
|
2113
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">rand_byte</span>
|
2114
|
-
<span class="ruby-keyword kw">self</span>[<span class="ruby-identifier">rand</span>( <span class="ruby-identifier">size</span> )]
|
2115
|
-
<span class="ruby-keyword kw">end</span>
|
2116
|
-
</pre>
|
2117
|
-
</div>
|
2118
|
-
</div>
|
2119
|
-
</div>
|
2120
|
-
<div class="method">
|
2121
|
-
<div class="title">
|
2122
|
-
<a name="M000309"></a><b>rand_byte!</b>()
|
2123
|
-
</div>
|
2124
|
-
<div class="description">
|
2125
|
-
<p>
|
2126
|
-
Destructive <a href="String.html#M000308">rand_byte</a>. Delete a random
|
2127
|
-
byte of <em>self</em> and return it.
|
2128
|
-
</p>
|
2129
|
-
<pre>
|
2130
|
-
s = "Ruby rules"
|
2131
|
-
s.rand_byte! #=> 121
|
2132
|
-
s #=> "Rub rules"
|
2133
|
-
</pre>
|
2134
|
-
</div>
|
2135
|
-
<div class="sourcecode">
|
2136
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000309_source')" id="l_M000309_source">show source</a> ]</p>
|
2137
|
-
<div id="M000309_source" class="dyn-source">
|
2138
|
-
<pre>
|
2139
|
-
<span class="ruby-comment cmt"># File lib/facets/core/string/rand_byte.rb, line 18</span>
|
2140
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">rand_byte!</span>
|
2141
|
-
<span class="ruby-identifier">i</span> = <span class="ruby-identifier">rand</span>( <span class="ruby-identifier">size</span> )
|
2142
|
-
<span class="ruby-identifier">rv</span> = <span class="ruby-keyword kw">self</span>[<span class="ruby-identifier">i</span>,<span class="ruby-value">1</span>]
|
2143
|
-
<span class="ruby-keyword kw">self</span>[<span class="ruby-identifier">i</span>,<span class="ruby-value">1</span>] = <span class="ruby-value str">''</span>
|
2144
|
-
<span class="ruby-identifier">rv</span>
|
2145
|
-
<span class="ruby-keyword kw">end</span>
|
2146
|
-
</pre>
|
2147
|
-
</div>
|
2148
|
-
</div>
|
2149
|
-
</div>
|
2150
|
-
<div class="method">
|
2151
|
-
<div class="title">
|
2152
|
-
<a name="M000299"></a><b>rand_index</b>()
|
2153
|
-
</div>
|
2154
|
-
<div class="description">
|
2155
|
-
<p>
|
2156
|
-
Return a random string index.
|
2157
|
-
</p>
|
2158
|
-
<pre>
|
2159
|
-
"Ruby rules".rand_index #=> 3
|
2160
|
-
</pre>
|
2161
|
-
</div>
|
2162
|
-
<div class="sourcecode">
|
2163
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000299_source')" id="l_M000299_source">show source</a> ]</p>
|
2164
|
-
<div id="M000299_source" class="dyn-source">
|
2165
|
-
<pre>
|
2166
|
-
<span class="ruby-comment cmt"># File lib/facets/core/string/rand_index.rb, line 6</span>
|
2167
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">rand_index</span>
|
2168
|
-
<span class="ruby-identifier">rand</span>( <span class="ruby-identifier">size</span> )
|
2169
|
-
<span class="ruby-keyword kw">end</span>
|
2170
|
-
</pre>
|
2171
|
-
</div>
|
2172
|
-
</div>
|
2173
|
-
</div>
|
2174
|
-
<div class="method">
|
2175
|
-
<div class="title">
|
2176
|
-
<a name="M000336"></a><b>range</b>(s, offset=0)
|
2177
|
-
</div>
|
2178
|
-
<div class="description">
|
2179
|
-
<p>
|
2180
|
-
Like index but returns a <a href="Range.html">Range</a>.
|
2181
|
-
</p>
|
2182
|
-
<pre>
|
2183
|
-
"This is a test!".range('test') #=> 10..13
|
2184
|
-
</pre>
|
2185
|
-
</div>
|
2186
|
-
<div class="sourcecode">
|
2187
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000336_source')" id="l_M000336_source">show source</a> ]</p>
|
2188
|
-
<div id="M000336_source" class="dyn-source">
|
2189
|
-
<pre>
|
2190
|
-
<span class="ruby-comment cmt"># File lib/facets/core/string/range.rb, line 8</span>
|
2191
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">range</span>(<span class="ruby-identifier">s</span>, <span class="ruby-identifier">offset</span>=<span class="ruby-value">0</span>)
|
2192
|
-
<span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">index</span>(<span class="ruby-identifier">s</span>, <span class="ruby-identifier">offset</span>)
|
2193
|
-
<span class="ruby-keyword kw">return</span> (<span class="ruby-identifier">$~</span>.<span class="ruby-identifier">begin</span>(<span class="ruby-value">0</span>))<span class="ruby-operator">..</span>(<span class="ruby-identifier">$~</span>.<span class="ruby-identifier">end</span>(<span class="ruby-value">0</span>)<span class="ruby-operator">-</span><span class="ruby-value">1</span>)
|
2194
|
-
<span class="ruby-keyword kw">end</span>
|
2195
|
-
<span class="ruby-keyword kw">nil</span>
|
2196
|
-
<span class="ruby-keyword kw">end</span>
|
2197
|
-
</pre>
|
2198
|
-
</div>
|
2199
|
-
</div>
|
2200
|
-
</div>
|
2201
|
-
<div class="method">
|
2202
|
-
<div class="title">
|
2203
|
-
<a name="M000373"></a><b>range_all</b>(s, reuse=false)
|
2204
|
-
</div>
|
2205
|
-
<div class="description">
|
2206
|
-
<p>
|
2207
|
-
Like <a href="String.html#M000368">index_all</a> but returns an array of
|
2208
|
-
Ranges.
|
2209
|
-
</p>
|
2210
|
-
<pre>
|
2211
|
-
"abc123abc123".range_all('abc') #=> [0..2, 6..8]
|
2212
|
-
</pre>
|
2213
|
-
</div>
|
2214
|
-
<div class="sourcecode">
|
2215
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000373_source')" id="l_M000373_source">show source</a> ]</p>
|
2216
|
-
<div id="M000373_source" class="dyn-source">
|
2217
|
-
<pre>
|
2218
|
-
<span class="ruby-comment cmt"># File lib/facets/core/string/range_all.rb, line 12</span>
|
2219
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">range_all</span>(<span class="ruby-identifier">s</span>, <span class="ruby-identifier">reuse</span>=<span class="ruby-keyword kw">false</span>)
|
2220
|
-
<span class="ruby-identifier">r</span> = []; <span class="ruby-identifier">i</span> = <span class="ruby-value">0</span>
|
2221
|
-
<span class="ruby-keyword kw">while</span> <span class="ruby-identifier">i</span> <span class="ruby-operator"><</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">length</span>
|
2222
|
-
<span class="ruby-identifier">rng</span> = <span class="ruby-identifier">range</span>(<span class="ruby-identifier">s</span>, <span class="ruby-identifier">i</span>)
|
2223
|
-
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">rng</span>
|
2224
|
-
<span class="ruby-identifier">r</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">rng</span>
|
2225
|
-
<span class="ruby-identifier">i</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">reuse</span> <span class="ruby-value">? </span><span class="ruby-value">1</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">rng</span>.<span class="ruby-identifier">end</span> <span class="ruby-operator">+</span> <span class="ruby-value">1</span>
|
2226
|
-
<span class="ruby-keyword kw">else</span>
|
2227
|
-
<span class="ruby-keyword kw">break</span>
|
2228
|
-
<span class="ruby-keyword kw">end</span>
|
2229
|
-
<span class="ruby-keyword kw">end</span>
|
2230
|
-
<span class="ruby-identifier">r</span>.<span class="ruby-identifier">uniq</span>
|
2231
|
-
<span class="ruby-keyword kw">end</span>
|
2232
|
-
</pre>
|
2233
|
-
</div>
|
2234
|
-
</div>
|
2235
|
-
</div>
|
2236
|
-
<div class="method">
|
2237
|
-
<div class="title">
|
2238
|
-
<a name="M000355"></a><b>range_of_line</b>()
|
2239
|
-
</div>
|
2240
|
-
<div class="description">
|
2241
|
-
<p>
|
2242
|
-
Returns an array of ranges mapping the characters per line.
|
2243
|
-
</p>
|
2244
|
-
<pre>
|
2245
|
-
"this\nis\na\ntest".range_of_line
|
2246
|
-
#=> [0..4, 5..7, 8..9, 10..13]
|
2247
|
-
</pre>
|
2248
|
-
</div>
|
2249
|
-
<div class="sourcecode">
|
2250
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000355_source')" id="l_M000355_source">show source</a> ]</p>
|
2251
|
-
<div id="M000355_source" class="dyn-source">
|
2252
|
-
<pre>
|
2253
|
-
<span class="ruby-comment cmt"># File lib/facets/core/string/range_of_line.rb, line 10</span>
|
2254
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">range_of_line</span>
|
2255
|
-
<span class="ruby-identifier">offset</span>=<span class="ruby-value">0</span>; <span class="ruby-identifier">charmap</span> = []
|
2256
|
-
<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">line</span><span class="ruby-operator">|</span>
|
2257
|
-
<span class="ruby-identifier">charmap</span> <span class="ruby-operator"><<</span> (<span class="ruby-identifier">offset</span><span class="ruby-operator">..</span>(<span class="ruby-identifier">offset</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">line</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">-</span> <span class="ruby-value">1</span>))
|
2258
|
-
<span class="ruby-identifier">offset</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">line</span>.<span class="ruby-identifier">length</span>
|
2259
|
-
<span class="ruby-keyword kw">end</span>
|
2260
|
-
<span class="ruby-identifier">charmap</span>
|
2261
|
-
<span class="ruby-keyword kw">end</span>
|
2262
|
-
</pre>
|
2263
|
-
</div>
|
2264
|
-
</div>
|
2265
|
-
</div>
|
2266
|
-
<div class="method">
|
2267
|
-
<div class="title">
|
2268
|
-
<a name="M000370"></a><b>regesc</b>()
|
2269
|
-
</div>
|
2270
|
-
<div class="description">
|
2271
|
-
<p>
|
2272
|
-
Escape string for <a href="Regexp.html">Regexp</a> use.
|
2273
|
-
</p>
|
2274
|
-
</div>
|
2275
|
-
<div class="sourcecode">
|
2276
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000370_source')" id="l_M000370_source">show source</a> ]</p>
|
2277
|
-
<div id="M000370_source" class="dyn-source">
|
2278
|
-
<pre>
|
2279
|
-
<span class="ruby-comment cmt"># File lib/facets/core/string/regesc.rb, line 5</span>
|
2280
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">regesc</span>
|
2281
|
-
<span class="ruby-constant">Regexp</span>.<span class="ruby-identifier">escape</span>( <span class="ruby-keyword kw">self</span> )
|
2282
|
-
<span class="ruby-keyword kw">end</span>
|
2283
|
-
</pre>
|
2284
|
-
</div>
|
2285
|
-
</div>
|
2286
|
-
</div>
|
2287
|
-
<div class="method">
|
2288
|
-
<div class="title">
|
2289
|
-
<a name="M000375"></a><b>shatter</b>( re )
|
2290
|
-
</div>
|
2291
|
-
<div class="description">
|
2292
|
-
<p>
|
2293
|
-
Breaks a string up into an array based on a regular expression. Similar to
|
2294
|
-
scan, but includes the matches.
|
2295
|
-
</p>
|
2296
|
-
<pre>
|
2297
|
-
s = "<p>This<b>is</b>a test.</p>"
|
2298
|
-
s.shatter( /\<.*?\>/ )
|
2299
|
-
</pre>
|
2300
|
-
<p>
|
2301
|
-
<em>produces</em>
|
2302
|
-
</p>
|
2303
|
-
<pre>
|
2304
|
-
["<p>", "This", "<b>", "is", "</b>", "a test.", "</p>"]
|
2305
|
-
</pre>
|
2306
|
-
</div>
|
2307
|
-
<div class="sourcecode">
|
2308
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000375_source')" id="l_M000375_source">show source</a> ]</p>
|
2309
|
-
<div id="M000375_source" class="dyn-source">
|
2310
|
-
<pre>
|
2311
|
-
<span class="ruby-comment cmt"># File lib/facets/core/string/shatter.rb, line 14</span>
|
2312
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">shatter</span>( <span class="ruby-identifier">re</span> )
|
2313
|
-
<span class="ruby-identifier">r</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">gsub</span>( <span class="ruby-identifier">re</span> ){ <span class="ruby-operator">|</span><span class="ruby-identifier">s</span><span class="ruby-operator">|</span> <span class="ruby-value str">"\1"</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">s</span> <span class="ruby-operator">+</span> <span class="ruby-value str">"\1"</span> }
|
2314
|
-
<span class="ruby-keyword kw">while</span> <span class="ruby-identifier">r</span>[<span class="ruby-value">0</span>,<span class="ruby-value">1</span>] <span class="ruby-operator">==</span> <span class="ruby-value str">"\1"</span> ; <span class="ruby-identifier">r</span>[<span class="ruby-value">0</span>] = <span class="ruby-value str">''</span> ; <span class="ruby-keyword kw">end</span>
|
2315
|
-
<span class="ruby-keyword kw">while</span> <span class="ruby-identifier">r</span>[<span class="ruby-value">-1</span>,<span class="ruby-value">1</span>] <span class="ruby-operator">==</span> <span class="ruby-value str">"\1"</span> ; <span class="ruby-identifier">r</span>[<span class="ruby-value">-1</span>] = <span class="ruby-value str">''</span> ; <span class="ruby-keyword kw">end</span>
|
2316
|
-
<span class="ruby-identifier">r</span>.<span class="ruby-identifier">split</span>(<span class="ruby-value str">"\1"</span>)
|
2317
|
-
<span class="ruby-keyword kw">end</span>
|
2318
|
-
</pre>
|
2319
|
-
</div>
|
2320
|
-
</div>
|
2321
|
-
</div>
|
2322
|
-
<div class="method">
|
2323
|
-
<div class="title">
|
2324
|
-
<a name="M000382"></a><b>shell_escape</b>()
|
2325
|
-
</div>
|
2326
|
-
<div class="description">
|
2327
|
-
<p>
|
2328
|
-
Escape special characters used in most unix shells to use it, eg. with
|
2329
|
-
system().
|
2330
|
-
</p>
|
2331
|
-
</div>
|
2332
|
-
<div class="sourcecode">
|
2333
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000382_source')" id="l_M000382_source">show source</a> ]</p>
|
2334
|
-
<div id="M000382_source" class="dyn-source">
|
2335
|
-
<pre>
|
2336
|
-
<span class="ruby-comment cmt"># File lib/facets/core/string/shell_escape.rb, line 7</span>
|
2337
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">shell_escape</span>
|
2338
|
-
<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/([\\\t\| &`<>)('"])/</span>) { <span class="ruby-operator">|</span><span class="ruby-identifier">s</span><span class="ruby-operator">|</span> <span class="ruby-value str">'\\'</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">s</span> }
|
2339
|
-
<span class="ruby-keyword kw">end</span>
|
2340
|
-
</pre>
|
2341
|
-
</div>
|
2342
|
-
</div>
|
2343
|
-
</div>
|
2344
|
-
<div class="method">
|
2345
|
-
<div class="title">
|
2346
|
-
<a name="M000282"></a><b>shift</b>()
|
2347
|
-
</div>
|
2348
|
-
<div class="sourcecode">
|
2349
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000282_source')" id="l_M000282_source">show source</a> ]</p>
|
2350
|
-
<div id="M000282_source" class="dyn-source">
|
2351
|
-
<pre>
|
2352
|
-
<span class="ruby-comment cmt"># File lib/facets/core/string/shift.rb, line 2</span>
|
2353
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">shift</span>
|
2354
|
-
<span class="ruby-keyword kw">return</span> <span class="ruby-value str">''</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">size</span> <span class="ruby-operator">==</span> <span class="ruby-value">0</span>
|
2355
|
-
<span class="ruby-keyword kw">self</span>[<span class="ruby-value">0</span>] = <span class="ruby-value str">''</span>
|
2356
|
-
<span class="ruby-keyword kw">self</span>
|
2357
|
-
<span class="ruby-keyword kw">end</span>
|
2358
|
-
</pre>
|
2359
|
-
</div>
|
2360
|
-
</div>
|
2361
|
-
</div>
|
2362
|
-
<div class="method">
|
2363
|
-
<div class="title">
|
2364
|
-
<a name="M000360"></a><b>shuffle</b>(separator=//)
|
2365
|
-
</div>
|
2366
|
-
<div class="description">
|
2367
|
-
<p>
|
2368
|
-
Return the string with seperated sections arranged in a random order. The
|
2369
|
-
default seperation is by character.
|
2370
|
-
</p>
|
2371
|
-
<pre>
|
2372
|
-
"Ruby rules".shuffle #=> "e lybRsuur"
|
2373
|
-
</pre>
|
2374
|
-
</div>
|
2375
|
-
<div class="sourcecode">
|
2376
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000360_source')" id="l_M000360_source">show source</a> ]</p>
|
2377
|
-
<div id="M000360_source" class="dyn-source">
|
2378
|
-
<pre>
|
2379
|
-
<span class="ruby-comment cmt"># File lib/facets/core/string/shuffle.rb, line 10</span>
|
2380
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">shuffle</span>(<span class="ruby-identifier">separator</span>=<span class="ruby-regexp re">//</span>)
|
2381
|
-
<span class="ruby-identifier">split</span>(<span class="ruby-identifier">separator</span>).<span class="ruby-identifier">shuffle</span>.<span class="ruby-identifier">join</span>(<span class="ruby-value str">''</span>)
|
2382
|
-
<span class="ruby-keyword kw">end</span>
|
2383
|
-
</pre>
|
2384
|
-
</div>
|
2385
|
-
</div>
|
2386
|
-
</div>
|
2387
|
-
<div class="method">
|
2388
|
-
<div class="title">
|
2389
|
-
<a name="M000361"></a><b>shuffle!</b>(separator=//)
|
2390
|
-
</div>
|
2391
|
-
<div class="description">
|
2392
|
-
<p>
|
2393
|
-
In place version of shuffle.
|
2394
|
-
</p>
|
2395
|
-
</div>
|
2396
|
-
<div class="sourcecode">
|
2397
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000361_source')" id="l_M000361_source">show source</a> ]</p>
|
2398
|
-
<div id="M000361_source" class="dyn-source">
|
2399
|
-
<pre>
|
2400
|
-
<span class="ruby-comment cmt"># File lib/facets/core/string/shuffle.rb, line 16</span>
|
2401
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">shuffle!</span>(<span class="ruby-identifier">separator</span>=<span class="ruby-regexp re">//</span>)
|
2402
|
-
<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">replace</span>( <span class="ruby-identifier">shuffle</span>(<span class="ruby-identifier">separator</span>) )
|
2403
|
-
<span class="ruby-keyword kw">end</span>
|
2404
|
-
</pre>
|
2405
|
-
</div>
|
2406
|
-
</div>
|
2407
|
-
</div>
|
2408
|
-
<div class="method">
|
2409
|
-
<div class="title">
|
2410
|
-
<a name="M000306"></a><b>similarity</b>( str_in )
|
2411
|
-
</div>
|
2412
|
-
<div class="description">
|
2413
|
-
<p>
|
2414
|
-
A fuzzy matching mechanism. Returns a score from 0-1, based on the number
|
2415
|
-
of shared edges. To be effective, the strings must be of length 2 or
|
2416
|
-
greater.
|
2417
|
-
</p>
|
2418
|
-
<pre>
|
2419
|
-
"Alexsander".fuzzy_match( "Aleksander" ) #=> 0.9
|
2420
|
-
</pre>
|
2421
|
-
<p>
|
2422
|
-
The way it works:
|
2423
|
-
</p>
|
2424
|
-
<ul>
|
2425
|
-
<li>Converts each string into a "graph like" object, with edges
|
2426
|
-
|
2427
|
-
<pre>
|
2428
|
-
"alexsander" -> [ alexsander, alexsand, alexsan ... lexsand ... san ... an, etc ]
|
2429
|
-
"aleksander" -> [ aleksander, aleksand ... etc. ]
|
2430
|
-
</pre>
|
2431
|
-
</li>
|
2432
|
-
<li>Perform match, then remove any subsets from this matched set (i.e. a hit on
|
2433
|
-
"san" is a subset of a hit on "sander")
|
2434
|
-
|
2435
|
-
<pre>
|
2436
|
-
Above example, once reduced -> [ ale, sander ]
|
2437
|
-
</pre>
|
2438
|
-
</li>
|
2439
|
-
<li>See’s how many of the matches remain, and calculates a score based on
|
2440
|
-
how many matches, their length, and compare to the length of the larger of
|
2441
|
-
the two words.
|
2442
|
-
|
2443
|
-
</li>
|
2444
|
-
</ul>
|
2445
|
-
</div>
|
2446
|
-
<div class="aka">
|
2447
|
-
This method is also aliased as
|
2448
|
-
<a href="String.html#M000307">fuzzy_match</a>
|
2449
|
-
</div>
|
2450
|
-
<div class="sourcecode">
|
2451
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000306_source')" id="l_M000306_source">show source</a> ]</p>
|
2452
|
-
<div id="M000306_source" class="dyn-source">
|
2453
|
-
<pre>
|
2454
|
-
<span class="ruby-comment cmt"># File lib/facets/core/string/similarity.rb, line 25</span>
|
2455
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">similarity</span>( <span class="ruby-identifier">str_in</span> )
|
2456
|
-
<span class="ruby-keyword kw">return</span> <span class="ruby-value">0</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">str_in</span> <span class="ruby-operator">==</span> <span class="ruby-keyword kw">nil</span>
|
2457
|
-
<span class="ruby-keyword kw">return</span> <span class="ruby-value">1</span> <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">self</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">str_in</span>
|
2458
|
-
|
2459
|
-
<span class="ruby-comment cmt"># Make a graph of each word (okay, so its not a true graph, but is similar)</span>
|
2460
|
-
<span class="ruby-identifier">graph_A</span> = <span class="ruby-constant">Array</span>.<span class="ruby-identifier">new</span>
|
2461
|
-
<span class="ruby-identifier">graph_B</span> = <span class="ruby-constant">Array</span>.<span class="ruby-identifier">new</span>
|
2462
|
-
|
2463
|
-
<span class="ruby-comment cmt"># "graph" self</span>
|
2464
|
-
<span class="ruby-identifier">last</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">length</span>
|
2465
|
-
(<span class="ruby-value">0</span><span class="ruby-operator">..</span><span class="ruby-identifier">last</span>).<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">ff</span><span class="ruby-operator">|</span>
|
2466
|
-
<span class="ruby-identifier">loc</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">length</span>
|
2467
|
-
<span class="ruby-keyword kw">break</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">ff</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">last</span> <span class="ruby-operator">-</span> <span class="ruby-value">1</span>
|
2468
|
-
<span class="ruby-identifier">wordB</span> = (<span class="ruby-value">1</span><span class="ruby-operator">..</span>(<span class="ruby-identifier">last</span><span class="ruby-operator">-</span><span class="ruby-value">1</span>)).<span class="ruby-identifier">to_a</span>.<span class="ruby-identifier">reverse!</span>
|
2469
|
-
<span class="ruby-keyword kw">if</span> (<span class="ruby-identifier">wordB</span> <span class="ruby-operator">!=</span> <span class="ruby-keyword kw">nil</span>)
|
2470
|
-
<span class="ruby-identifier">wordB</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">ss</span><span class="ruby-operator">|</span>
|
2471
|
-
<span class="ruby-keyword kw">break</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">ss</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">ff</span>
|
2472
|
-
<span class="ruby-identifier">graph_A</span>.<span class="ruby-identifier">push</span>( <span class="ruby-node">"#{self[ff..ss]}"</span> )
|
2473
|
-
<span class="ruby-keyword kw">end</span>
|
2474
|
-
<span class="ruby-keyword kw">end</span>
|
2475
|
-
<span class="ruby-keyword kw">end</span>
|
2476
|
-
|
2477
|
-
<span class="ruby-comment cmt"># "graph" input string</span>
|
2478
|
-
<span class="ruby-identifier">last</span> = <span class="ruby-identifier">str_in</span>.<span class="ruby-identifier">length</span>
|
2479
|
-
(<span class="ruby-value">0</span><span class="ruby-operator">..</span><span class="ruby-identifier">last</span>).<span class="ruby-identifier">each</span>{ <span class="ruby-operator">|</span><span class="ruby-identifier">ff</span><span class="ruby-operator">|</span>
|
2480
|
-
<span class="ruby-identifier">loc</span> = <span class="ruby-identifier">str_in</span>.<span class="ruby-identifier">length</span>
|
2481
|
-
<span class="ruby-keyword kw">break</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">ff</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">last</span> <span class="ruby-operator">-</span> <span class="ruby-value">1</span>
|
2482
|
-
<span class="ruby-identifier">wordB</span> = (<span class="ruby-value">1</span><span class="ruby-operator">..</span>(<span class="ruby-identifier">last</span><span class="ruby-operator">-</span><span class="ruby-value">1</span>)).<span class="ruby-identifier">to_a</span>.<span class="ruby-identifier">reverse!</span>
|
2483
|
-
<span class="ruby-identifier">wordB</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">ss</span><span class="ruby-operator">|</span>
|
2484
|
-
<span class="ruby-keyword kw">break</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">ss</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">ff</span>
|
2485
|
-
<span class="ruby-identifier">graph_B</span>.<span class="ruby-identifier">push</span>( <span class="ruby-node">"#{str_in[ff..ss]}"</span> )
|
2486
|
-
<span class="ruby-keyword kw">end</span>
|
2487
|
-
}
|
2488
|
-
|
2489
|
-
|
2490
|
-
<span class="ruby-comment cmt"># count how many of these "graph edges" we have that are the same</span>
|
2491
|
-
<span class="ruby-identifier">matches</span> = <span class="ruby-identifier">graph_A</span> <span class="ruby-operator">&</span> <span class="ruby-identifier">graph_B</span>
|
2492
|
-
<span class="ruby-comment cmt">#matches = Array.new</span>
|
2493
|
-
<span class="ruby-comment cmt">#graph_A.each do |aa|</span>
|
2494
|
-
<span class="ruby-comment cmt"># matches.push( aa ) if( graph_B.include?( aa ) )</span>
|
2495
|
-
<span class="ruby-comment cmt">#end</span>
|
2496
|
-
|
2497
|
-
<span class="ruby-comment cmt"># For eliminating subsets, we want to start with the smallest hits.</span>
|
2498
|
-
<span class="ruby-identifier">matches</span>.<span class="ruby-identifier">sort!</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">x</span>,<span class="ruby-identifier">y</span><span class="ruby-operator">|</span> <span class="ruby-identifier">x</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator"><=></span> <span class="ruby-identifier">y</span>.<span class="ruby-identifier">length</span>}
|
2499
|
-
|
2500
|
-
<span class="ruby-comment cmt"># eliminate any subsets</span>
|
2501
|
-
<span class="ruby-identifier">mclone</span> = <span class="ruby-identifier">matches</span>.<span class="ruby-identifier">dup</span>
|
2502
|
-
<span class="ruby-identifier">mclone</span>.<span class="ruby-identifier">each_index</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">ii</span><span class="ruby-operator">|</span>
|
2503
|
-
<span class="ruby-identifier">reg</span> = <span class="ruby-constant">Regexp</span>.<span class="ruby-identifier">compile</span>( <span class="ruby-identifier">mclone</span>[<span class="ruby-identifier">ii</span>] )
|
2504
|
-
<span class="ruby-identifier">count</span> = <span class="ruby-value">0</span><span class="ruby-value">.0</span>
|
2505
|
-
<span class="ruby-identifier">matches</span>.<span class="ruby-identifier">each</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">xx</span><span class="ruby-operator">|</span> <span class="ruby-identifier">count</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">xx</span> <span class="ruby-operator">=~</span> <span class="ruby-identifier">reg</span>}
|
2506
|
-
<span class="ruby-identifier">matches</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-identifier">mclone</span>[<span class="ruby-identifier">ii</span>]) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">count</span> <span class="ruby-operator">></span> <span class="ruby-value">1</span>
|
2507
|
-
<span class="ruby-keyword kw">end</span>
|
2508
|
-
|
2509
|
-
<span class="ruby-identifier">score</span> = <span class="ruby-value">0</span><span class="ruby-value">.0</span>
|
2510
|
-
<span class="ruby-identifier">matches</span>.<span class="ruby-identifier">each</span>{ <span class="ruby-operator">|</span><span class="ruby-identifier">mm</span><span class="ruby-operator">|</span> <span class="ruby-identifier">score</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">mm</span>.<span class="ruby-identifier">length</span> }
|
2511
|
-
<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">></span> <span class="ruby-identifier">str_in</span>.<span class="ruby-identifier">length</span> <span class="ruby-value">? </span><span class="ruby-identifier">largest</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">largest</span> = <span class="ruby-identifier">str_in</span>.<span class="ruby-identifier">length</span>
|
2512
|
-
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">score</span><span class="ruby-operator">/</span><span class="ruby-identifier">largest</span>
|
2513
|
-
<span class="ruby-keyword kw">end</span>
|
2514
|
-
</pre>
|
2515
|
-
</div>
|
2516
|
-
</div>
|
2517
|
-
</div>
|
2518
|
-
<div class="method">
|
2519
|
-
<div class="title">
|
2520
|
-
<a name="M000301"></a><b>singular</b>()
|
2521
|
-
</div>
|
2522
|
-
<div class="description">
|
2523
|
-
<p>
|
2524
|
-
Convert an English word from plurel to singular.
|
2525
|
-
</p>
|
2526
|
-
<pre>
|
2527
|
-
"boys".singular #=> boy
|
2528
|
-
"tomatoes".singular #=> tomato
|
2529
|
-
</pre>
|
2530
|
-
</div>
|
2531
|
-
<div class="aka">
|
2532
|
-
This method is also aliased as
|
2533
|
-
<a href="String.html#M000303">singularize</a>
|
2534
|
-
</div>
|
2535
|
-
<div class="sourcecode">
|
2536
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000301_source')" id="l_M000301_source">show source</a> ]</p>
|
2537
|
-
<div id="M000301_source" class="dyn-source">
|
2538
|
-
<pre>
|
2539
|
-
<span class="ruby-comment cmt"># File lib/facets/core/string/singular.rb, line 63</span>
|
2540
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">singular</span>
|
2541
|
-
<span class="ruby-identifier">result</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">dup</span>
|
2542
|
-
<span class="ruby-constant">String</span><span class="ruby-operator">::</span><span class="ruby-constant">SINGULAR_RULES</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span>(<span class="ruby-identifier">rule</span>, <span class="ruby-identifier">replacement</span>)<span class="ruby-operator">|</span>
|
2543
|
-
<span class="ruby-keyword kw">break</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">result</span>.<span class="ruby-identifier">gsub!</span>(<span class="ruby-identifier">rule</span>, <span class="ruby-identifier">replacement</span>)
|
2544
|
-
<span class="ruby-keyword kw">end</span>
|
2545
|
-
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">result</span>
|
2546
|
-
<span class="ruby-keyword kw">end</span>
|
2547
|
-
</pre>
|
2548
|
-
</div>
|
2549
|
-
</div>
|
2550
|
-
</div>
|
2551
|
-
<div class="method">
|
2552
|
-
<div class="title">
|
2553
|
-
<a name="M000303"></a><b>singularize</b>()
|
2554
|
-
</div>
|
2555
|
-
<div class="description">
|
2556
|
-
<p>
|
2557
|
-
Alias for <a href="String.html#M000301">singular</a>
|
2558
|
-
</p>
|
2559
|
-
</div>
|
2560
|
-
</div>
|
2561
|
-
<div class="method">
|
2562
|
-
<div class="title">
|
2563
|
-
<a name="M000371"></a><b>soundex</b>()
|
2564
|
-
</div>
|
2565
|
-
<div class="description">
|
2566
|
-
<p>
|
2567
|
-
Implementation of the soundex algorithm as described by Knuth in volume 3
|
2568
|
-
of The Art of Computer Programming. Returns nil if the value couldn’t
|
2569
|
-
be calculated b/c of empty-string or invalid character.
|
2570
|
-
</p>
|
2571
|
-
<pre>
|
2572
|
-
"Ruby".soundex #=> "R100"
|
2573
|
-
</pre>
|
2574
|
-
</div>
|
2575
|
-
<div class="sourcecode">
|
2576
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000371_source')" id="l_M000371_source">show source</a> ]</p>
|
2577
|
-
<div id="M000371_source" class="dyn-source">
|
2578
|
-
<pre>
|
2579
|
-
<span class="ruby-comment cmt"># File lib/facets/core/string/soundex.rb, line 14</span>
|
2580
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">soundex</span>
|
2581
|
-
<span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">nil</span> <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">empty?</span>
|
2582
|
-
|
2583
|
-
<span class="ruby-identifier">str</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">upcase</span>
|
2584
|
-
<span class="ruby-identifier">last_code</span> = <span class="ruby-constant">String</span>.<span class="ruby-identifier">soundex_code</span>(<span class="ruby-identifier">str</span>[<span class="ruby-value">0</span>,<span class="ruby-value">1</span>])
|
2585
|
-
<span class="ruby-identifier">soundex_code</span> = <span class="ruby-identifier">str</span>[<span class="ruby-value">0</span>,<span class="ruby-value">1</span>]
|
2586
|
-
|
2587
|
-
<span class="ruby-keyword kw">for</span> <span class="ruby-identifier">index</span> <span class="ruby-keyword kw">in</span> <span class="ruby-value">1</span><span class="ruby-operator">...</span>(<span class="ruby-identifier">str</span>.<span class="ruby-identifier">size</span>) <span class="ruby-keyword kw">do</span>
|
2588
|
-
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">soundex_code</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">soundex_code</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">==</span> <span class="ruby-value">4</span>
|
2589
|
-
|
2590
|
-
<span class="ruby-identifier">code</span> = <span class="ruby-constant">String</span>.<span class="ruby-identifier">soundex_code</span>(<span class="ruby-identifier">str</span>[<span class="ruby-identifier">index</span>,<span class="ruby-value">1</span>])
|
2591
|
-
|
2592
|
-
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">code</span> <span class="ruby-operator">==</span> <span class="ruby-value str">"0"</span> <span class="ruby-keyword kw">then</span>
|
2593
|
-
<span class="ruby-identifier">last_code</span> = <span class="ruby-keyword kw">nil</span>
|
2594
|
-
<span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">code</span> <span class="ruby-operator">==</span> <span class="ruby-keyword kw">nil</span> <span class="ruby-keyword kw">then</span>
|
2595
|
-
<span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">nil</span>
|
2596
|
-
<span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">code</span> <span class="ruby-operator">!=</span> <span class="ruby-identifier">last_code</span> <span class="ruby-keyword kw">then</span>
|
2597
|
-
<span class="ruby-identifier">soundex_code</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">code</span>
|
2598
|
-
<span class="ruby-identifier">last_code</span> = <span class="ruby-identifier">code</span>
|
2599
|
-
<span class="ruby-keyword kw">end</span>
|
2600
|
-
<span class="ruby-keyword kw">end</span>
|
2601
|
-
|
2602
|
-
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">soundex_code</span> <span class="ruby-operator">+</span> <span class="ruby-value str">"000"</span>[<span class="ruby-value">0</span>,<span class="ruby-value">4</span><span class="ruby-operator">-</span><span class="ruby-identifier">soundex_code</span>.<span class="ruby-identifier">size</span>]
|
2603
|
-
<span class="ruby-keyword kw">end</span>
|
2604
|
-
</pre>
|
2605
|
-
</div>
|
2606
|
-
</div>
|
2607
|
-
</div>
|
2608
|
-
<div class="method">
|
2609
|
-
<div class="title">
|
2610
|
-
<a name="M000316"></a><b>starts_with?</b>(str)
|
2611
|
-
</div>
|
2612
|
-
<div class="sourcecode">
|
2613
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000316_source')" id="l_M000316_source">show source</a> ]</p>
|
2614
|
-
<div id="M000316_source" class="dyn-source">
|
2615
|
-
<pre>
|
2616
|
-
<span class="ruby-comment cmt"># File lib/facets/core/string/starts_with.rb, line 7</span>
|
2617
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">starts_with?</span>(<span class="ruby-identifier">str</span>)
|
2618
|
-
<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">index</span>( <span class="ruby-identifier">str</span> ) <span class="ruby-operator">==</span> <span class="ruby-value">0</span>
|
2619
|
-
<span class="ruby-keyword kw">end</span>
|
2620
|
-
</pre>
|
2621
|
-
</div>
|
2622
|
-
</div>
|
2623
|
-
</div>
|
2624
|
-
<div class="method">
|
2625
|
-
<div class="title">
|
2626
|
-
<a name="M000323"></a><b>succ</b>(n=1)
|
2627
|
-
</div>
|
2628
|
-
<div class="description">
|
2629
|
-
<p>
|
2630
|
-
Allows <a href="String.html#M000323">succ</a> to take <em>n</em> step
|
2631
|
-
increments.
|
2632
|
-
</p>
|
2633
|
-
<pre>
|
2634
|
-
"abc".succ #=> "abd"
|
2635
|
-
"abc".succ(4) #=> "abg"
|
2636
|
-
"abc".succ(24) #=> "aca"
|
2637
|
-
</pre>
|
2638
|
-
</div>
|
2639
|
-
<div class="sourcecode">
|
2640
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000323_source')" id="l_M000323_source">show source</a> ]</p>
|
2641
|
-
<div id="M000323_source" class="dyn-source">
|
2642
|
-
<pre>
|
2643
|
-
<span class="ruby-comment cmt"># File lib/facets/core/string/succ.rb, line 9</span>
|
2644
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">succ</span>(<span class="ruby-identifier">n</span>=<span class="ruby-value">1</span>)
|
2645
|
-
<span class="ruby-identifier">s</span> = <span class="ruby-keyword kw">self</span>
|
2646
|
-
<span class="ruby-identifier">n</span>.<span class="ruby-identifier">times</span> { <span class="ruby-identifier">s</span> = <span class="ruby-identifier">s</span>.<span class="ruby-identifier">succ_once</span> }
|
2647
|
-
<span class="ruby-identifier">s</span>
|
2648
|
-
<span class="ruby-keyword kw">end</span>
|
2649
|
-
</pre>
|
2650
|
-
</div>
|
2651
|
-
</div>
|
2652
|
-
</div>
|
2653
|
-
<div class="method">
|
2654
|
-
<div class="title">
|
2655
|
-
<a name="M000347"></a><b>tab</b>(n)
|
2656
|
-
</div>
|
2657
|
-
<div class="description">
|
2658
|
-
<p>
|
2659
|
-
Aligns each line n spaces. (This used to be taballto.)
|
2660
|
-
</p>
|
2661
|
-
</div>
|
2662
|
-
<div class="sourcecode">
|
2663
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000347_source')" id="l_M000347_source">show source</a> ]</p>
|
2664
|
-
<div id="M000347_source" class="dyn-source">
|
2665
|
-
<pre>
|
2666
|
-
<span class="ruby-comment cmt"># File lib/facets/core/string/indent.rb, line 7</span>
|
2667
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">tab</span>(<span class="ruby-identifier">n</span>)
|
2668
|
-
<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/^ */</span>, <span class="ruby-value str">' '</span> <span class="ruby-operator">*</span> <span class="ruby-identifier">n</span>)
|
2669
|
-
<span class="ruby-keyword kw">end</span>
|
2670
|
-
</pre>
|
2671
|
-
</div>
|
2672
|
-
</div>
|
2673
|
-
</div>
|
2674
|
-
<div class="method">
|
2675
|
-
<div class="title">
|
2676
|
-
<a name="M000348"></a><b>tabto</b>(n)
|
2677
|
-
</div>
|
2678
|
-
<div class="description">
|
2679
|
-
<p>
|
2680
|
-
Preserves relative tabbing. The first non-empty line ends up with n spaces
|
2681
|
-
before nonspace.
|
2682
|
-
</p>
|
2683
|
-
</div>
|
2684
|
-
<div class="sourcecode">
|
2685
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000348_source')" id="l_M000348_source">show source</a> ]</p>
|
2686
|
-
<div id="M000348_source" class="dyn-source">
|
2687
|
-
<pre>
|
2688
|
-
<span class="ruby-comment cmt"># File lib/facets/core/string/indent.rb, line 14</span>
|
2689
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">tabto</span>(<span class="ruby-identifier">n</span>)
|
2690
|
-
<span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">self</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/^( *)\S/</span>
|
2691
|
-
<span class="ruby-identifier">indent</span>(<span class="ruby-identifier">n</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">$1</span>.<span class="ruby-identifier">length</span>)
|
2692
|
-
<span class="ruby-keyword kw">else</span>
|
2693
|
-
<span class="ruby-keyword kw">self</span>
|
2694
|
-
<span class="ruby-keyword kw">end</span>
|
2695
|
-
<span class="ruby-keyword kw">end</span>
|
2696
|
-
</pre>
|
2697
|
-
</div>
|
2698
|
-
</div>
|
2699
|
-
</div>
|
2700
|
-
<div class="method">
|
2701
|
-
<div class="title">
|
2702
|
-
<a name="M000337"></a><b>to_a</b>(div=//,limit=0)
|
2703
|
-
</div>
|
2704
|
-
<div class="description">
|
2705
|
-
<p>
|
2706
|
-
Essentially makes <a href="String.html#M000337">to_a</a> an alias for
|
2707
|
-
split, with the excpetion that if no divider is given then the array is
|
2708
|
-
split on charaters, and NOT on the global input record divider ($/).
|
2709
|
-
</p>
|
2710
|
-
<p>
|
2711
|
-
WARNING There is a slight chance of incompatability with other libraries
|
2712
|
-
which depend on spliting with $/ (although doing so is a very bad idea!).
|
2713
|
-
</p>
|
2714
|
-
</div>
|
2715
|
-
<div class="sourcecode">
|
2716
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000337_source')" id="l_M000337_source">show source</a> ]</p>
|
2717
|
-
<div id="M000337_source" class="dyn-source">
|
2718
|
-
<pre>
|
2719
|
-
<span class="ruby-comment cmt"># File lib/facets/core/string/to_a.rb, line 14</span>
|
2720
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_a</span>(<span class="ruby-identifier">div</span>=<span class="ruby-regexp re">//</span>,<span class="ruby-identifier">limit</span>=<span class="ruby-value">0</span>)
|
2721
|
-
<span class="ruby-identifier">split</span>(<span class="ruby-identifier">div</span>,<span class="ruby-identifier">limit</span>)
|
2722
|
-
<span class="ruby-keyword kw">end</span>
|
2723
|
-
</pre>
|
2724
|
-
</div>
|
2725
|
-
</div>
|
2726
|
-
</div>
|
2727
|
-
<div class="method">
|
2728
|
-
<div class="title">
|
2729
|
-
<a name="M000338"></a><b>to_b</b>()
|
2730
|
-
</div>
|
2731
|
-
<div class="description">
|
2732
|
-
<p>
|
2733
|
-
Interpret common affirmative string meanings as true, otherwise false.
|
2734
|
-
Balnk sapce and case are ignored. The following strings that will return
|
2735
|
-
true:
|
2736
|
-
</p>
|
2737
|
-
<pre>
|
2738
|
-
<tt>true</tt>,<tt>yes</tt>,<tt>on</tt>,<tt>t</tt>,<tt>1</tt>,<tt>y</tt>,<tt>==</tt>
|
2739
|
-
</pre>
|
2740
|
-
<p>
|
2741
|
-
Examples:
|
2742
|
-
</p>
|
2743
|
-
<pre>
|
2744
|
-
"true".to_b #=> true
|
2745
|
-
"yes".to_b #=> true
|
2746
|
-
"no".to_b #=> false
|
2747
|
-
"123".to_b #=> false
|
2748
|
-
</pre>
|
2749
|
-
</div>
|
2750
|
-
<div class="sourcecode">
|
2751
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000338_source')" id="l_M000338_source">show source</a> ]</p>
|
2752
|
-
<div id="M000338_source" class="dyn-source">
|
2753
|
-
<pre>
|
2754
|
-
<span class="ruby-comment cmt"># File lib/facets/core/string/to_b.rb, line 17</span>
|
2755
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_b</span>
|
2756
|
-
<span class="ruby-keyword kw">case</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">downcase</span>.<span class="ruby-identifier">strip</span>
|
2757
|
-
<span class="ruby-keyword kw">when</span> <span class="ruby-value str">'true'</span>, <span class="ruby-value str">'yes'</span>, <span class="ruby-value str">'on'</span>, <span class="ruby-value str">'t'</span>, <span class="ruby-value str">'1'</span>, <span class="ruby-value str">'y'</span>, <span class="ruby-value str">'=='</span>
|
2758
|
-
<span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">true</span>
|
2759
|
-
<span class="ruby-keyword kw">when</span> <span class="ruby-value str">'nil'</span>, <span class="ruby-value str">'null'</span>
|
2760
|
-
<span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">nil</span>
|
2761
|
-
<span class="ruby-keyword kw">else</span>
|
2762
|
-
<span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">false</span>
|
2763
|
-
<span class="ruby-keyword kw">end</span>
|
2764
|
-
<span class="ruby-keyword kw">end</span>
|
2765
|
-
</pre>
|
2766
|
-
</div>
|
2767
|
-
</div>
|
2768
|
-
</div>
|
2769
|
-
<div class="method">
|
2770
|
-
<div class="title">
|
2771
|
-
<a name="M000353"></a><b>to_const</b>()
|
2772
|
-
</div>
|
2773
|
-
<div class="description">
|
2774
|
-
<p>
|
2775
|
-
Get a constant by a given string name.
|
2776
|
-
</p>
|
2777
|
-
<pre>
|
2778
|
-
"Class".to_const #=> Class
|
2779
|
-
</pre>
|
2780
|
-
<p>
|
2781
|
-
Note this method is not as verstile as it should be, since it can not
|
2782
|
-
access contants relative to the current execution context. But without a
|
2783
|
-
binding_of_caller that does not seem possible.
|
2784
|
-
</p>
|
2785
|
-
</div>
|
2786
|
-
<div class="sourcecode">
|
2787
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000353_source')" id="l_M000353_source">show source</a> ]</p>
|
2788
|
-
<div id="M000353_source" class="dyn-source">
|
2789
|
-
<pre>
|
2790
|
-
<span class="ruby-comment cmt"># File lib/facets/core/string/to_const.rb, line 12</span>
|
2791
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_const</span>
|
2792
|
-
<span class="ruby-identifier">split</span>(<span class="ruby-value str">'::'</span>).<span class="ruby-identifier">inject</span>(<span class="ruby-constant">Object</span>){ <span class="ruby-operator">|</span><span class="ruby-identifier">namespace</span>,<span class="ruby-identifier">name</span><span class="ruby-operator">|</span> <span class="ruby-identifier">namespace</span>.<span class="ruby-identifier">const_get</span>(<span class="ruby-identifier">name</span>) }
|
2793
|
-
<span class="ruby-keyword kw">end</span>
|
2794
|
-
</pre>
|
2795
|
-
</div>
|
2796
|
-
</div>
|
2797
|
-
</div>
|
2798
|
-
<div class="method">
|
2799
|
-
<div class="title">
|
2800
|
-
<a name="M000313"></a><b>to_date</b>()
|
2801
|
-
</div>
|
2802
|
-
<div class="sourcecode">
|
2803
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000313_source')" id="l_M000313_source">show source</a> ]</p>
|
2804
|
-
<div id="M000313_source" class="dyn-source">
|
2805
|
-
<pre>
|
2806
|
-
<span class="ruby-comment cmt"># File lib/facets/core/string/to_date.rb, line 4</span>
|
2807
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_date</span>
|
2808
|
-
<span class="ruby-identifier">require</span> <span class="ruby-value str">'date'</span>
|
2809
|
-
<span class="ruby-identifier">require</span> <span class="ruby-value str">'parsedate'</span>
|
2810
|
-
<span class="ruby-operator">::</span><span class="ruby-constant">Date</span><span class="ruby-operator">::</span><span class="ruby-identifier">civil</span>(<span class="ruby-operator">*</span><span class="ruby-constant">ParseDate</span>.<span class="ruby-identifier">parsedate</span>(<span class="ruby-keyword kw">self</span>)[<span class="ruby-value">0</span><span class="ruby-operator">..</span><span class="ruby-value">2</span>])
|
2811
|
-
<span class="ruby-keyword kw">end</span>
|
2812
|
-
</pre>
|
2813
|
-
</div>
|
2814
|
-
</div>
|
2815
|
-
</div>
|
2816
|
-
<div class="method">
|
2817
|
-
<div class="title">
|
2818
|
-
<a name="M000310"></a><b>to_proc</b>(context=nil)
|
2819
|
-
</div>
|
2820
|
-
<div class="description">
|
2821
|
-
<p>
|
2822
|
-
Evaluates a <a href="String.html">String</a> as a <a
|
2823
|
-
href="Proc.html">Proc</a>.
|
2824
|
-
</p>
|
2825
|
-
<pre>
|
2826
|
-
xyp = "|x,y| x + y".to_proc
|
2827
|
-
xyp.class #=> Proc
|
2828
|
-
xyp.call(1,2) #=> 3
|
2829
|
-
</pre>
|
2830
|
-
</div>
|
2831
|
-
<div class="sourcecode">
|
2832
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000310_source')" id="l_M000310_source">show source</a> ]</p>
|
2833
|
-
<div id="M000310_source" class="dyn-source">
|
2834
|
-
<pre>
|
2835
|
-
<span class="ruby-comment cmt"># File lib/facets/core/string/to_proc.rb, line 14</span>
|
2836
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_proc</span>(<span class="ruby-identifier">context</span>=<span class="ruby-keyword kw">nil</span>)
|
2837
|
-
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">context</span>
|
2838
|
-
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">context</span>.<span class="ruby-identifier">kind_of?</span>(<span class="ruby-constant">Binding</span>) <span class="ruby-keyword kw">or</span> <span class="ruby-identifier">context</span>.<span class="ruby-identifier">kind_of?</span>(<span class="ruby-constant">Proc</span>)
|
2839
|
-
<span class="ruby-constant">Kernel</span>.<span class="ruby-identifier">eval</span> <span class="ruby-node">"proc { #{self} }"</span>, <span class="ruby-identifier">context</span>
|
2840
|
-
<span class="ruby-keyword kw">else</span> <span class="ruby-identifier">context</span>
|
2841
|
-
<span class="ruby-identifier">context</span>.<span class="ruby-identifier">instance_eval</span> <span class="ruby-node">"proc { #{self} }"</span>
|
2842
|
-
<span class="ruby-keyword kw">end</span>
|
2843
|
-
<span class="ruby-keyword kw">else</span>
|
2844
|
-
<span class="ruby-constant">Kernel</span>.<span class="ruby-identifier">eval</span> <span class="ruby-node">"proc { #{self} }"</span>
|
2845
|
-
<span class="ruby-keyword kw">end</span>
|
2846
|
-
<span class="ruby-keyword kw">end</span>
|
2847
|
-
</pre>
|
2848
|
-
</div>
|
2849
|
-
</div>
|
2850
|
-
</div>
|
2851
|
-
<div class="method">
|
2852
|
-
<div class="title">
|
2853
|
-
<a name="M000339"></a><b>to_re</b>(esc=true)
|
2854
|
-
</div>
|
2855
|
-
<div class="description">
|
2856
|
-
<p>
|
2857
|
-
Turns a string into a regular expression. By default it will escape all
|
2858
|
-
characters. Use <tt>false</tt> argument to turn off escaping.
|
2859
|
-
</p>
|
2860
|
-
<pre>
|
2861
|
-
"[".to_re #=> /\[/
|
2862
|
-
</pre>
|
2863
|
-
</div>
|
2864
|
-
<div class="sourcecode">
|
2865
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000339_source')" id="l_M000339_source">show source</a> ]</p>
|
2866
|
-
<div id="M000339_source" class="dyn-source">
|
2867
|
-
<pre>
|
2868
|
-
<span class="ruby-comment cmt"># File lib/facets/core/string/to_re.rb, line 10</span>
|
2869
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_re</span>(<span class="ruby-identifier">esc</span>=<span class="ruby-keyword kw">true</span>)
|
2870
|
-
<span class="ruby-constant">Regexp</span>.<span class="ruby-identifier">new</span>((<span class="ruby-identifier">esc</span> <span class="ruby-value">? </span><span class="ruby-constant">Regexp</span>.<span class="ruby-identifier">escape</span>(<span class="ruby-keyword kw">self</span>) <span class="ruby-operator">:</span> <span class="ruby-keyword kw">self</span>))
|
2871
|
-
<span class="ruby-keyword kw">end</span>
|
2872
|
-
</pre>
|
2873
|
-
</div>
|
2874
|
-
</div>
|
2875
|
-
</div>
|
2876
|
-
<div class="method">
|
2877
|
-
<div class="title">
|
2878
|
-
<a name="M000340"></a><b>to_rx</b>()
|
2879
|
-
</div>
|
2880
|
-
<div class="description">
|
2881
|
-
<p>
|
2882
|
-
Turns a string into a regular expression. Unlike <a
|
2883
|
-
href="String.html#M000339">to_re</a> this will not escape characters.
|
2884
|
-
</p>
|
2885
|
-
<pre>
|
2886
|
-
"a?".to_rx #=> /a?/
|
2887
|
-
</pre>
|
2888
|
-
</div>
|
2889
|
-
<div class="sourcecode">
|
2890
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000340_source')" id="l_M000340_source">show source</a> ]</p>
|
2891
|
-
<div id="M000340_source" class="dyn-source">
|
2892
|
-
<pre>
|
2893
|
-
<span class="ruby-comment cmt"># File lib/facets/core/string/to_re.rb, line 19</span>
|
2894
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_rx</span>
|
2895
|
-
<span class="ruby-constant">Regexp</span>.<span class="ruby-identifier">new</span>(<span class="ruby-keyword kw">self</span>)
|
2896
|
-
<span class="ruby-keyword kw">end</span>
|
2897
|
-
</pre>
|
2898
|
-
</div>
|
2899
|
-
</div>
|
2900
|
-
</div>
|
2901
|
-
<div class="method">
|
2902
|
-
<div class="title">
|
2903
|
-
<a name="M000358"></a><b>to_time</b>()
|
2904
|
-
</div>
|
2905
|
-
<div class="sourcecode">
|
2906
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000358_source')" id="l_M000358_source">show source</a> ]</p>
|
2907
|
-
<div id="M000358_source" class="dyn-source">
|
2908
|
-
<pre>
|
2909
|
-
<span class="ruby-comment cmt"># File lib/facets/core/string/to_time.rb, line 4</span>
|
2910
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_time</span>
|
2911
|
-
<span class="ruby-identifier">require</span> <span class="ruby-value str">'time'</span>
|
2912
|
-
<span class="ruby-constant">Time</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-keyword kw">self</span>)
|
2913
|
-
<span class="ruby-keyword kw">end</span>
|
2914
|
-
</pre>
|
2915
|
-
</div>
|
2916
|
-
</div>
|
2917
|
-
</div>
|
2918
|
-
<div class="method">
|
2919
|
-
<div class="title">
|
2920
|
-
<a name="M000334"></a><b>unbracket</b>(bra=nil, ket=nil)
|
2921
|
-
</div>
|
2922
|
-
<div class="description">
|
2923
|
-
<p>
|
2924
|
-
Return a new string embraced by given brakets. If only one bracket char is
|
2925
|
-
given it will be placed on either side.
|
2926
|
-
</p>
|
2927
|
-
<pre>
|
2928
|
-
"{unwrap me}".debracket('{') #=> "unwrap me"
|
2929
|
-
"--unwrap me!".debracket('--','!') #=> "unwrap me!"
|
2930
|
-
</pre>
|
2931
|
-
</div>
|
2932
|
-
<div class="sourcecode">
|
2933
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000334_source')" id="l_M000334_source">show source</a> ]</p>
|
2934
|
-
<div id="M000334_source" class="dyn-source">
|
2935
|
-
<pre>
|
2936
|
-
<span class="ruby-comment cmt"># File lib/facets/core/string/unbracket.rb, line 16</span>
|
2937
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">unbracket</span>(<span class="ruby-identifier">bra</span>=<span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">ket</span>=<span class="ruby-keyword kw">nil</span>)
|
2938
|
-
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">bra</span>
|
2939
|
-
<span class="ruby-identifier">ket</span> = <span class="ruby-constant">Sring</span>.<span class="ruby-identifier">bra2ket</span>[<span class="ruby-identifier">bra</span>] <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">ket</span>
|
2940
|
-
<span class="ruby-identifier">ket</span> = <span class="ruby-identifier">ket</span> <span class="ruby-value">? </span><span class="ruby-identifier">ket</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">bra</span>
|
2941
|
-
<span class="ruby-identifier">s</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">dup</span>
|
2942
|
-
<span class="ruby-identifier">s</span>.<span class="ruby-identifier">gsub!</span>(<span class="ruby-node">%r[^#{Regexp.escape(bra)}]</span>, <span class="ruby-value str">''</span>)
|
2943
|
-
<span class="ruby-identifier">s</span>.<span class="ruby-identifier">gsub!</span>(<span class="ruby-node">%r[#{Regexp.escape(ket)}$]</span>, <span class="ruby-value str">''</span>)
|
2944
|
-
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">s</span>
|
2945
|
-
<span class="ruby-keyword kw">else</span>
|
2946
|
-
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">m</span> = <span class="ruby-constant">String</span>.<span class="ruby-identifier">bra2ket</span>[ <span class="ruby-keyword kw">self</span>[<span class="ruby-value">0</span>,<span class="ruby-value">1</span>] ]
|
2947
|
-
<span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">slice</span>(<span class="ruby-value">1</span><span class="ruby-operator">...</span><span class="ruby-value">-1</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">self</span>[<span class="ruby-value">-1</span>,<span class="ruby-value">1</span>] <span class="ruby-operator">==</span> <span class="ruby-identifier">m</span>
|
2948
|
-
<span class="ruby-keyword kw">end</span>
|
2949
|
-
<span class="ruby-keyword kw">end</span>
|
2950
|
-
<span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">dup</span> <span class="ruby-comment cmt"># if nothing else</span>
|
2951
|
-
<span class="ruby-keyword kw">end</span>
|
2952
|
-
</pre>
|
2953
|
-
</div>
|
2954
|
-
</div>
|
2955
|
-
</div>
|
2956
|
-
<div class="method">
|
2957
|
-
<div class="title">
|
2958
|
-
<a name="M000335"></a><b>unbracket!</b>(bra=nil, ket=nil)
|
2959
|
-
</div>
|
2960
|
-
<div class="description">
|
2961
|
-
<p>
|
2962
|
-
Inplace version of debraket.
|
2963
|
-
</p>
|
2964
|
-
</div>
|
2965
|
-
<div class="sourcecode">
|
2966
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000335_source')" id="l_M000335_source">show source</a> ]</p>
|
2967
|
-
<div id="M000335_source" class="dyn-source">
|
2968
|
-
<pre>
|
2969
|
-
<span class="ruby-comment cmt"># File lib/facets/core/string/unbracket.rb, line 33</span>
|
2970
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">unbracket!</span>(<span class="ruby-identifier">bra</span>=<span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">ket</span>=<span class="ruby-keyword kw">nil</span>)
|
2971
|
-
<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">replace</span>( <span class="ruby-identifier">unbracket</span>(<span class="ruby-identifier">bra</span>, <span class="ruby-identifier">ket</span>) )
|
2972
|
-
<span class="ruby-keyword kw">end</span>
|
2973
|
-
</pre>
|
2974
|
-
</div>
|
2975
|
-
</div>
|
2976
|
-
</div>
|
2977
|
-
<div class="method">
|
2978
|
-
<div class="title">
|
2979
|
-
<a name="M000376"></a><b>underscore</b>(
|
2980
|
-
</div>
|
2981
|
-
<div class="description">
|
2982
|
-
<p>
|
2983
|
-
Underscore string based on camelcase characteristics.
|
2984
|
-
</p>
|
2985
|
-
</div>
|
2986
|
-
<div class="sourcecode">
|
2987
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000376_source')" id="l_M000376_source">show source</a> ]</p>
|
2988
|
-
<div id="M000376_source" class="dyn-source">
|
2989
|
-
<pre>
|
2990
|
-
<span class="ruby-comment cmt"># File lib/facets/core/string/underscore.rb, line 5</span>
|
2991
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">underscore</span> <span class="ruby-comment cmt">#(camel_cased_word)</span>
|
2992
|
-
<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/([A-Z]+)([A-Z])/</span>,<span class="ruby-value str">'\1_\2'</span>).<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/([a-z])([A-Z])/</span>,<span class="ruby-value str">'\1_\2'</span>).<span class="ruby-identifier">downcase</span>
|
2993
|
-
<span class="ruby-keyword kw">end</span>
|
2994
|
-
</pre>
|
2995
|
-
</div>
|
2996
|
-
</div>
|
2997
|
-
</div>
|
2998
|
-
<div class="method">
|
2999
|
-
<div class="title">
|
3000
|
-
<a name="M000287"></a><b>unix_crypt</b>()
|
3001
|
-
</div>
|
3002
|
-
<div class="description">
|
3003
|
-
<p>
|
3004
|
-
Common Unix cryptography method.
|
3005
|
-
</p>
|
3006
|
-
</div>
|
3007
|
-
<div class="sourcecode">
|
3008
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000287_source')" id="l_M000287_source">show source</a> ]</p>
|
3009
|
-
<div id="M000287_source" class="dyn-source">
|
3010
|
-
<pre>
|
3011
|
-
<span class="ruby-comment cmt"># File lib/facets/core/string/unix_crypt.rb, line 7</span>
|
3012
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">unix_crypt</span>
|
3013
|
-
<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">crypt</span>(<span class="ruby-constant">String</span>.<span class="ruby-identifier">rand_letter</span> <span class="ruby-operator">+</span> <span class="ruby-constant">String</span>.<span class="ruby-identifier">rand_letter</span>)
|
3014
|
-
<span class="ruby-keyword kw">end</span>
|
3015
|
-
</pre>
|
3016
|
-
</div>
|
3017
|
-
</div>
|
3018
|
-
</div>
|
3019
|
-
<div class="method">
|
3020
|
-
<div class="title">
|
3021
|
-
<a name="M000288"></a><b>unix_crypt!</b>()
|
3022
|
-
</div>
|
3023
|
-
<div class="description">
|
3024
|
-
<p>
|
3025
|
-
Common Unix cryptography in-place method.
|
3026
|
-
</p>
|
3027
|
-
</div>
|
3028
|
-
<div class="sourcecode">
|
3029
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000288_source')" id="l_M000288_source">show source</a> ]</p>
|
3030
|
-
<div id="M000288_source" class="dyn-source">
|
3031
|
-
<pre>
|
3032
|
-
<span class="ruby-comment cmt"># File lib/facets/core/string/unix_crypt.rb, line 12</span>
|
3033
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">unix_crypt!</span>
|
3034
|
-
<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">replace</span>( <span class="ruby-identifier">unix_crypt</span> )
|
3035
|
-
<span class="ruby-keyword kw">end</span>
|
3036
|
-
</pre>
|
3037
|
-
</div>
|
3038
|
-
</div>
|
3039
|
-
</div>
|
3040
|
-
<div class="method">
|
3041
|
-
<div class="title">
|
3042
|
-
<a name="M000298"></a><b>unpack</b>(format, offset=nil)
|
3043
|
-
</div>
|
3044
|
-
<div class="description">
|
3045
|
-
<p>
|
3046
|
-
Upack with offset. Extends <a href="String.html#M000298">unpack</a> to
|
3047
|
-
allow a string to be unpacked starting at an offset position within it.
|
3048
|
-
</p>
|
3049
|
-
</div>
|
3050
|
-
<div class="sourcecode">
|
3051
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000298_source')" id="l_M000298_source">show source</a> ]</p>
|
3052
|
-
<div id="M000298_source" class="dyn-source">
|
3053
|
-
<pre>
|
3054
|
-
<span class="ruby-comment cmt"># File lib/facets/core/string/unpack.rb, line 8</span>
|
3055
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">unpack</span>(<span class="ruby-identifier">format</span>, <span class="ruby-identifier">offset</span>=<span class="ruby-keyword kw">nil</span>)
|
3056
|
-
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">offset</span>.<span class="ruby-identifier">nil?</span>
|
3057
|
-
<span class="ruby-identifier">unpack_from_orgin</span>(<span class="ruby-identifier">format</span>)
|
3058
|
-
<span class="ruby-keyword kw">else</span>
|
3059
|
-
<span class="ruby-keyword kw">self</span>[<span class="ruby-identifier">offset</span><span class="ruby-operator">..</span><span class="ruby-value">-1</span>].<span class="ruby-identifier">unpack_from_orgin</span>(<span class="ruby-identifier">format</span>)
|
3060
|
-
<span class="ruby-keyword kw">end</span>
|
3061
|
-
<span class="ruby-keyword kw">end</span>
|
3062
|
-
</pre>
|
3063
|
-
</div>
|
3064
|
-
</div>
|
3065
|
-
</div>
|
3066
|
-
<div class="method">
|
3067
|
-
<div class="title">
|
3068
|
-
<a name="M000363"></a><b>unshift</b>( str=' ' )
|
3069
|
-
</div>
|
3070
|
-
<div class="sourcecode">
|
3071
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000363_source')" id="l_M000363_source">show source</a> ]</p>
|
3072
|
-
<div id="M000363_source" class="dyn-source">
|
3073
|
-
<pre>
|
3074
|
-
<span class="ruby-comment cmt"># File lib/facets/core/string/unshift.rb, line 4</span>
|
3075
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">unshift</span>( <span class="ruby-identifier">str</span>=<span class="ruby-value str">' '</span> )
|
3076
|
-
<span class="ruby-identifier">insert</span>(<span class="ruby-value">0</span>, <span class="ruby-identifier">str</span>)
|
3077
|
-
<span class="ruby-keyword kw">end</span>
|
3078
|
-
</pre>
|
3079
|
-
</div>
|
3080
|
-
</div>
|
3081
|
-
</div>
|
3082
|
-
<div class="method">
|
3083
|
-
<div class="title">
|
3084
|
-
<a name="M000350"></a><b>upcase?</b>()
|
3085
|
-
</div>
|
3086
|
-
<div class="description">
|
3087
|
-
<p>
|
3088
|
-
Is the string upcase/uppercase?
|
3089
|
-
</p>
|
3090
|
-
<pre>
|
3091
|
-
"THIS".upcase? #=> true
|
3092
|
-
"This".upcase? #=> false
|
3093
|
-
"this".upcase? #=> false
|
3094
|
-
</pre>
|
3095
|
-
</div>
|
3096
|
-
<div class="aka">
|
3097
|
-
This method is also aliased as
|
3098
|
-
<a href="String.html#M000351">uppercase?</a>
|
3099
|
-
</div>
|
3100
|
-
<div class="sourcecode">
|
3101
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000350_source')" id="l_M000350_source">show source</a> ]</p>
|
3102
|
-
<div id="M000350_source" class="dyn-source">
|
3103
|
-
<pre>
|
3104
|
-
<span class="ruby-comment cmt"># File lib/facets/core/string/upcase.rb, line 13</span>
|
3105
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">upcase?</span>
|
3106
|
-
<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">upcase</span> <span class="ruby-operator">==</span> <span class="ruby-keyword kw">self</span>
|
3107
|
-
<span class="ruby-keyword kw">end</span>
|
3108
|
-
</pre>
|
3109
|
-
</div>
|
3110
|
-
</div>
|
3111
|
-
</div>
|
3112
|
-
<div class="method">
|
3113
|
-
<div class="title">
|
3114
|
-
<a name="M000351"></a><b>uppercase?</b>()
|
3115
|
-
</div>
|
3116
|
-
<div class="description">
|
3117
|
-
<p>
|
3118
|
-
Alias for <a href="String.html#M000350">upcase?</a>
|
3119
|
-
</p>
|
3120
|
-
</div>
|
3121
|
-
</div>
|
3122
|
-
<div class="method">
|
3123
|
-
<div class="title">
|
3124
|
-
<a name="M000312"></a><b>whitespace?</b>()
|
3125
|
-
</div>
|
3126
|
-
<div class="description">
|
3127
|
-
<p>
|
3128
|
-
Alias for <a href="String.html#M000311">blank?</a>
|
3129
|
-
</p>
|
3130
|
-
</div>
|
3131
|
-
</div>
|
3132
|
-
<div class="method">
|
3133
|
-
<div class="title">
|
3134
|
-
<a name="M000326"></a><b>whitespace?</b>()
|
3135
|
-
</div>
|
3136
|
-
<div class="description">
|
3137
|
-
<p>
|
3138
|
-
Alias for <a href="String.html#M000311">blank?</a>
|
3139
|
-
</p>
|
3140
|
-
</div>
|
3141
|
-
</div>
|
3142
|
-
<div class="method">
|
3143
|
-
<div class="title">
|
3144
|
-
<a name="M000285"></a><b>word_filter</b>( &blk )
|
3145
|
-
</div>
|
3146
|
-
<div class="description">
|
3147
|
-
<p>
|
3148
|
-
Filters out words from a string based on block test.
|
3149
|
-
</p>
|
3150
|
-
<pre>
|
3151
|
-
"a string".word_filter { |word| word =~ /^a/ } #=> "string"
|
3152
|
-
</pre>
|
3153
|
-
</div>
|
3154
|
-
<div class="sourcecode">
|
3155
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000285_source')" id="l_M000285_source">show source</a> ]</p>
|
3156
|
-
<div id="M000285_source" class="dyn-source">
|
3157
|
-
<pre>
|
3158
|
-
<span class="ruby-comment cmt"># File lib/facets/core/string/word_filter.rb, line 8</span>
|
3159
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">word_filter</span>( <span class="ruby-operator">&</span><span class="ruby-identifier">blk</span> )
|
3160
|
-
<span class="ruby-identifier">s</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">dup</span>
|
3161
|
-
<span class="ruby-identifier">s</span>.<span class="ruby-identifier">word_filter!</span>( <span class="ruby-operator">&</span><span class="ruby-identifier">blk</span> )
|
3162
|
-
<span class="ruby-keyword kw">end</span>
|
3163
|
-
</pre>
|
3164
|
-
</div>
|
3165
|
-
</div>
|
3166
|
-
</div>
|
3167
|
-
<div class="method">
|
3168
|
-
<div class="title">
|
3169
|
-
<a name="M000286"></a><b>word_filter!</b>( {|| ...}
|
3170
|
-
</div>
|
3171
|
-
<div class="description">
|
3172
|
-
<p>
|
3173
|
-
In place version of <a href="String.html#M000285">word_filter</a>.
|
3174
|
-
</p>
|
3175
|
-
<pre>
|
3176
|
-
"a string".word_filter { |word| ... }
|
3177
|
-
</pre>
|
3178
|
-
</div>
|
3179
|
-
<div class="sourcecode">
|
3180
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000286_source')" id="l_M000286_source">show source</a> ]</p>
|
3181
|
-
<div id="M000286_source" class="dyn-source">
|
3182
|
-
<pre>
|
3183
|
-
<span class="ruby-comment cmt"># File lib/facets/core/string/word_filter.rb, line 17</span>
|
3184
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">word_filter!</span> <span class="ruby-comment cmt">#:yield:</span>
|
3185
|
-
<span class="ruby-identifier">rest_of_string</span> = <span class="ruby-keyword kw">self</span>
|
3186
|
-
<span class="ruby-identifier">wordfind</span> = <span class="ruby-regexp re">/(\w+)/</span>
|
3187
|
-
<span class="ruby-identifier">offset</span> = <span class="ruby-value">0</span>
|
3188
|
-
<span class="ruby-keyword kw">while</span> <span class="ruby-identifier">wmatch</span> = <span class="ruby-identifier">wordfind</span>.<span class="ruby-identifier">match</span>(<span class="ruby-identifier">rest_of_string</span>)
|
3189
|
-
<span class="ruby-identifier">word</span> = <span class="ruby-identifier">wmatch</span>[<span class="ruby-value">0</span>]
|
3190
|
-
<span class="ruby-identifier">range</span> = <span class="ruby-identifier">offset</span><span class="ruby-operator">+</span><span class="ruby-identifier">wmatch</span>.<span class="ruby-identifier">begin</span>(<span class="ruby-value">0</span>) <span class="ruby-operator">...</span> <span class="ruby-identifier">offset</span><span class="ruby-operator">+</span><span class="ruby-identifier">wmatch</span>.<span class="ruby-identifier">end</span>(<span class="ruby-value">0</span>)
|
3191
|
-
<span class="ruby-identifier">rest_of_string</span> = <span class="ruby-identifier">wmatch</span>.<span class="ruby-identifier">post_match</span>
|
3192
|
-
<span class="ruby-keyword kw">self</span>[<span class="ruby-identifier">range</span>] = <span class="ruby-keyword kw">yield</span>( <span class="ruby-identifier">word</span> ).<span class="ruby-identifier">to_s</span>
|
3193
|
-
<span class="ruby-identifier">offset</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">rest_of_string</span>.<span class="ruby-identifier">length</span>
|
3194
|
-
<span class="ruby-keyword kw">end</span>
|
3195
|
-
<span class="ruby-keyword kw">self</span>
|
3196
|
-
<span class="ruby-keyword kw">end</span>
|
3197
|
-
</pre>
|
3198
|
-
</div>
|
3199
|
-
</div>
|
3200
|
-
</div>
|
3201
|
-
<div class="method">
|
3202
|
-
<div class="title">
|
3203
|
-
<a name="M000293"></a><b>word_wrap</b>( col_width=80 )
|
3204
|
-
</div>
|
3205
|
-
<div class="description">
|
3206
|
-
<p>
|
3207
|
-
Word wrap a string not exceeding max width.
|
3208
|
-
</p>
|
3209
|
-
<pre>
|
3210
|
-
puts "this is a test".word_wrap(4)
|
3211
|
-
</pre>
|
3212
|
-
<p>
|
3213
|
-
<em>produces</em>
|
3214
|
-
</p>
|
3215
|
-
<pre>
|
3216
|
-
this
|
3217
|
-
is a
|
3218
|
-
test
|
3219
|
-
</pre>
|
3220
|
-
</div>
|
3221
|
-
<div class="sourcecode">
|
3222
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000293_source')" id="l_M000293_source">show source</a> ]</p>
|
3223
|
-
<div id="M000293_source" class="dyn-source">
|
3224
|
-
<pre>
|
3225
|
-
<span class="ruby-comment cmt"># File lib/facets/core/string/word_wrap.rb, line 18</span>
|
3226
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">word_wrap</span>( <span class="ruby-identifier">col_width</span>=<span class="ruby-value">80</span> )
|
3227
|
-
<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">dup</span>.<span class="ruby-identifier">word_wrap!</span>( <span class="ruby-identifier">col_width</span> )
|
3228
|
-
<span class="ruby-keyword kw">end</span>
|
3229
|
-
</pre>
|
3230
|
-
</div>
|
3231
|
-
</div>
|
3232
|
-
</div>
|
3233
|
-
<div class="method">
|
3234
|
-
<div class="title">
|
3235
|
-
<a name="M000294"></a><b>word_wrap!</b>( col_width=80 )
|
3236
|
-
</div>
|
3237
|
-
<div class="description">
|
3238
|
-
<p>
|
3239
|
-
As with <a href="String.html#M000293">word_wrap</a>, but modifies the
|
3240
|
-
string in place.
|
3241
|
-
</p>
|
3242
|
-
</div>
|
3243
|
-
<div class="sourcecode">
|
3244
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000294_source')" id="l_M000294_source">show source</a> ]</p>
|
3245
|
-
<div id="M000294_source" class="dyn-source">
|
3246
|
-
<pre>
|
3247
|
-
<span class="ruby-comment cmt"># File lib/facets/core/string/word_wrap.rb, line 24</span>
|
3248
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">word_wrap!</span>( <span class="ruby-identifier">col_width</span>=<span class="ruby-value">80</span> )
|
3249
|
-
<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">gsub!</span>( <span class="ruby-node">/(\S{#{col_width}})(?=\S)/</span>, <span class="ruby-value str">'\1 '</span> )
|
3250
|
-
<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">gsub!</span>( <span class="ruby-node">/(.{1,#{col_width}})(?:\s+|$)/</span>, <span class="ruby-value str">"\\1\n"</span> )
|
3251
|
-
<span class="ruby-keyword kw">self</span>
|
3252
|
-
<span class="ruby-keyword kw">end</span>
|
3253
|
-
</pre>
|
3254
|
-
</div>
|
3255
|
-
</div>
|
3256
|
-
</div>
|
3257
|
-
<div class="method">
|
3258
|
-
<div class="title">
|
3259
|
-
<a name="M000346"></a><b>words</b>()
|
3260
|
-
</div>
|
3261
|
-
<div class="description">
|
3262
|
-
<p>
|
3263
|
-
Returns an array of characters.
|
3264
|
-
</p>
|
3265
|
-
<pre>
|
3266
|
-
"abc 123".words #=> ["abc","123"]
|
3267
|
-
</pre>
|
3268
|
-
</div>
|
3269
|
-
<div class="sourcecode">
|
3270
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000346_source')" id="l_M000346_source">show source</a> ]</p>
|
3271
|
-
<div id="M000346_source" class="dyn-source">
|
3272
|
-
<pre>
|
3273
|
-
<span class="ruby-comment cmt"># File lib/facets/core/string/words.rb, line 8</span>
|
3274
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">words</span>
|
3275
|
-
<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">split</span>(<span class="ruby-regexp re">/\s+/</span>)
|
3276
|
-
<span class="ruby-keyword kw">end</span>
|
3277
|
-
</pre>
|
3278
|
-
</div>
|
3279
|
-
</div>
|
3280
|
-
</div>
|
3281
|
-
</div>
|
3282
|
-
|
3283
|
-
</div>
|
3284
|
-
|
3285
|
-
</body>
|
3286
|
-
</html>
|