facets 2.5.2 → 2.6.0
Sign up to get free protection for your applications and to get access to all the features.
- data/HISTORY.rdoc +2245 -0
- data/MANIFEST +20 -725
- data/{README → README.rdoc} +0 -0
- data/RELEASE +37 -48
- data/doc/log/stats/index.html +39 -0
- data/doc/notes/CHANGES +2529 -0
- data/lib/{more → core}/facets/binding/opvars.rb +0 -0
- data/lib/core/facets/integer/length.rb +16 -0
- data/lib/core/facets/kernel/state.rb +50 -0
- data/lib/core/facets/module/extend.rb +2 -2
- data/lib/core/facets/string/camelcase.rb +33 -9
- data/lib/core/facets/string/lowercase.rb +1 -0
- data/lib/core/facets/string/methodize.rb +10 -1
- data/lib/core/facets/string/modulize.rb +8 -0
- data/lib/core/facets/string/pathize.rb +10 -0
- data/lib/core/facets/string/snakecase.rb +2 -2
- data/lib/core/facets/string/underscore.rb +21 -0
- data/lib/core/facets/string/uppercase.rb +23 -0
- data/lib/more/facets/censor.rb +97 -0
- data/lib/more/facets/minitar.rb +11 -11
- data/lib/more/facets/platform.rb +47 -0
- data/lib/more/facets/pry.rb +32 -0
- data/lib/more/facets/string/obfuscate.rb +65 -0
- data/lib/more/facets/string/stylize.rb +169 -0
- data/lib/more/facets/string/words.rb +10 -13
- data/meta/modified +1 -0
- data/meta/package +1 -0
- data/meta/version +1 -0
- data/test/core/integer/test_length.rb +12 -0
- metadata +41 -822
- data/CHANGES +0 -133
- data/VERSION +0 -1
- data/doc/changelogs/CHANGELOG-0.10.30 +0 -239
- data/doc/changelogs/CHANGELOG-1.8.54 +0 -450
- data/doc/changelogs/CHANGELOG-2.4.5 +0 -1654
- data/doc/rdoc/core/classes/Array.html +0 -1208
- data/doc/rdoc/core/classes/Binding.html +0 -364
- data/doc/rdoc/core/classes/Class.html +0 -444
- data/doc/rdoc/core/classes/Comparable.html +0 -250
- data/doc/rdoc/core/classes/Dir.html +0 -395
- data/doc/rdoc/core/classes/Enumerable.html +0 -1262
- data/doc/rdoc/core/classes/Enumerable/Enumerator.html +0 -243
- data/doc/rdoc/core/classes/Enumerator.html +0 -242
- data/doc/rdoc/core/classes/Exception.html +0 -163
- data/doc/rdoc/core/classes/FalseClass.html +0 -131
- data/doc/rdoc/core/classes/File.html +0 -576
- data/doc/rdoc/core/classes/FileTest.html +0 -116
- data/doc/rdoc/core/classes/Float.html +0 -159
- data/doc/rdoc/core/classes/Functor.html +0 -171
- data/doc/rdoc/core/classes/Hash.html +0 -2184
- data/doc/rdoc/core/classes/Indexable.html +0 -629
- data/doc/rdoc/core/classes/InstanceVariables.html +0 -306
- data/doc/rdoc/core/classes/Integer.html +0 -583
- data/doc/rdoc/core/classes/Kernel.html +0 -2269
- data/doc/rdoc/core/classes/Lazy.html +0 -96
- data/doc/rdoc/core/classes/Lazy/Future.html +0 -100
- data/doc/rdoc/core/classes/Lazy/Promise.html +0 -114
- data/doc/rdoc/core/classes/Lazy/PromiseSafe.html +0 -99
- data/doc/rdoc/core/classes/MatchData.html +0 -204
- data/doc/rdoc/core/classes/Module.html +0 -1316
- data/doc/rdoc/core/classes/NilClass.html +0 -217
- data/doc/rdoc/core/classes/Numeric.html +0 -251
- data/doc/rdoc/core/classes/Object.html +0 -161
- data/doc/rdoc/core/classes/ObjectSpace.html +0 -114
- data/doc/rdoc/core/classes/Proc.html +0 -302
- data/doc/rdoc/core/classes/Range.html +0 -360
- data/doc/rdoc/core/classes/Regexp.html +0 -191
- data/doc/rdoc/core/classes/Stackable.html +0 -262
- data/doc/rdoc/core/classes/String.html +0 -2332
- data/doc/rdoc/core/classes/Struct.html +0 -121
- data/doc/rdoc/core/classes/Symbol.html +0 -441
- data/doc/rdoc/core/classes/Time.html +0 -521
- data/doc/rdoc/core/classes/TrueClass.html +0 -131
- data/doc/rdoc/core/classes/UnboundMethod.html +0 -200
- data/doc/rdoc/core/created.rid +0 -1
- data/doc/rdoc/core/files/README.html +0 -287
- data/doc/rdoc/core/files/doc/README_core.html +0 -230
- data/doc/rdoc/core/files/lib/core/facets/array/combination_rb.html +0 -96
- data/doc/rdoc/core/files/lib/core/facets/array/conjoin_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/array/delete_rb.html +0 -101
- data/doc/rdoc/core/files/lib/core/facets/array/delete_unless_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/array/delete_values_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/array/index_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/array/indexable_rb.html +0 -97
- data/doc/rdoc/core/files/lib/core/facets/array/merge_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/array/not_empty_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/array/only_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/array/pad_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/array/permutation_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/array/product_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/array/recursively_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/array/rotate_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/array/select_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/array/splice_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/array/stackable_rb.html +0 -97
- data/doc/rdoc/core/files/lib/core/facets/array/traverse_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/array_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/binding/caller_rb.html +0 -97
- data/doc/rdoc/core/files/lib/core/facets/binding/callstack_rb.html +0 -96
- data/doc/rdoc/core/files/lib/core/facets/binding/defined_rb.html +0 -96
- data/doc/rdoc/core/files/lib/core/facets/binding/eval_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/binding/local_variables_rb.html +0 -96
- data/doc/rdoc/core/files/lib/core/facets/binding/self_rb.html +0 -96
- data/doc/rdoc/core/files/lib/core/facets/binding_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/bitmask_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/blank_rb.html +0 -97
- data/doc/rdoc/core/files/lib/core/facets/boolean_rb.html +0 -126
- data/doc/rdoc/core/files/lib/core/facets/cattr_rb.html +0 -100
- data/doc/rdoc/core/files/lib/core/facets/class/cattr_accessor_rb.html +0 -96
- data/doc/rdoc/core/files/lib/core/facets/class/cattr_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/class/cattr_reader_rb.html +0 -96
- data/doc/rdoc/core/files/lib/core/facets/class/cattr_writer_rb.html +0 -96
- data/doc/rdoc/core/files/lib/core/facets/class/descendents_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/class/methodize_rb.html +0 -96
- data/doc/rdoc/core/files/lib/core/facets/class/pathize_rb.html +0 -96
- data/doc/rdoc/core/files/lib/core/facets/class/prepend_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/class/subclasses_rb.html +0 -96
- data/doc/rdoc/core/files/lib/core/facets/class/to_proc_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/class_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/comparable/at_least_rb.html +0 -96
- data/doc/rdoc/core/files/lib/core/facets/comparable/at_most_rb.html +0 -96
- data/doc/rdoc/core/files/lib/core/facets/comparable/bound_rb.html +0 -96
- data/doc/rdoc/core/files/lib/core/facets/comparable/cap_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/comparable/clip_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/comparable/cmp_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/comparable/comparable_rb.html +0 -109
- data/doc/rdoc/core/files/lib/core/facets/comparable_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/dir/ascend_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/dir/descend_rb.html +0 -96
- data/doc/rdoc/core/files/lib/core/facets/dir/multiglob_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/dir/parent_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/dir/recurse_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/dir_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/enumerable/accumulate_rb.html +0 -96
- data/doc/rdoc/core/files/lib/core/facets/enumerable/cluster_by_rb.html +0 -96
- data/doc/rdoc/core/files/lib/core/facets/enumerable/collect_rb.html +0 -101
- data/doc/rdoc/core/files/lib/core/facets/enumerable/commonality_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/enumerable/compact_map_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/enumerable/count_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/enumerable/divide_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/enumerable/duplicates_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/enumerable/each_by_rb.html +0 -96
- data/doc/rdoc/core/files/lib/core/facets/enumerable/entropy_rb.html +0 -96
- data/doc/rdoc/core/files/lib/core/facets/enumerable/frequency_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/enumerable/graph_rb.html +0 -96
- data/doc/rdoc/core/files/lib/core/facets/enumerable/group_by_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/enumerable/inject_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/enumerable/map_send_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/enumerable/map_with_index_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/enumerable/mash_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/enumerable/mode_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/enumerable/modulate_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/enumerable/none_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/enumerable/occur_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/enumerable/one_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/enumerable/probability_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/enumerable/split_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/enumerable/sum_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/enumerable/take_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/enumerable/uniq_by_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/enumerable_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/exception/detail_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/exception/suppress_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/exception_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/file/append_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/file/create_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/file/null_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/file/read_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/file/rewrite_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/file/rootname_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/file/split_all_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/file/split_root_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/file/write_rb.html +0 -102
- data/doc/rdoc/core/files/lib/core/facets/file/writelines_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/file_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/filetest/root_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/filetest_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/float/round_rb.html +0 -96
- data/doc/rdoc/core/files/lib/core/facets/float_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/functor_rb.html +0 -151
- data/doc/rdoc/core/files/lib/core/facets/hash/alias_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/hash/argumentize_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/hash/at_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/hash/autonew_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/hash/collate_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/hash/dearray_values_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/hash/delete_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/hash/diff_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/hash/except_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/hash/group_by_value_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/hash/insert_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/hash/inverse_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/hash/join_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/hash/keys_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/hash/mash_rb.html +0 -96
- data/doc/rdoc/core/files/lib/core/facets/hash/merge_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/hash/new_with_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/hash/op_add_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/hash/op_and_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/hash/op_mul_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/hash/op_or_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/hash/op_push_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/hash/op_rb.html +0 -101
- data/doc/rdoc/core/files/lib/core/facets/hash/op_sub_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/hash/recursive_merge_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/hash/recursively_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/hash/rekey_rb.html +0 -96
- data/doc/rdoc/core/files/lib/core/facets/hash/replace_each_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/hash/select_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/hash/slice_rb.html +0 -96
- data/doc/rdoc/core/files/lib/core/facets/hash/stringify_keys_rb.html +0 -96
- data/doc/rdoc/core/files/lib/core/facets/hash/swap_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/hash/symbolize_keys_rb.html +0 -96
- data/doc/rdoc/core/files/lib/core/facets/hash/to_h_rb.html +0 -96
- data/doc/rdoc/core/files/lib/core/facets/hash/to_options_rb.html +0 -96
- data/doc/rdoc/core/files/lib/core/facets/hash/to_proc_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/hash/to_struct_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/hash/traverse_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/hash/update_each_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/hash/update_keys_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/hash/update_rb.html +0 -103
- data/doc/rdoc/core/files/lib/core/facets/hash/update_values_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/hash/weave_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/hash/zipnew_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/hash_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/indexable_rb.html +0 -113
- data/doc/rdoc/core/files/lib/core/facets/integer/even_rb.html +0 -96
- data/doc/rdoc/core/files/lib/core/facets/integer/factorial_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/integer/multiple_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/integer/odd_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/integer/of_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/integer/ordinal_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/integer_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/kernel/__callee___rb.html +0 -96
- data/doc/rdoc/core/files/lib/core/facets/kernel/__class___rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/kernel/__dir___rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/kernel/__get___rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/kernel/__here___rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/kernel/__method___rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/kernel/__set___rb.html +0 -96
- data/doc/rdoc/core/files/lib/core/facets/kernel/as_rb.html +0 -96
- data/doc/rdoc/core/files/lib/core/facets/kernel/ask_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/kernel/attr_singleton_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/kernel/callstack_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/kernel/complete_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/kernel/constant_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/kernel/d_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/kernel/deep_copy_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/kernel/demo_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/kernel/ergo_rb.html +0 -96
- data/doc/rdoc/core/files/lib/core/facets/kernel/here_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/kernel/in_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/kernel/instance_assign_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/kernel/instance_class_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/kernel/instance_exec_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/kernel/instance_rb.html +0 -96
- data/doc/rdoc/core/files/lib/core/facets/kernel/instance_send_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/kernel/instance_variables_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/kernel/maybe_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/kernel/not_nil_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/kernel/object_class_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/kernel/object_hexid_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/kernel/object_send_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/kernel/p_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/kernel/populate_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/kernel/qua_class_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/kernel/require_all_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/kernel/require_local_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/kernel/resc_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/kernel/respond_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/kernel/returning_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/kernel/silence_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/kernel/singleton_class_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/kernel/tap_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/kernel/try_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/kernel/val_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/kernel/with_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/kernel_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/lazy_rb.html +0 -120
- data/doc/rdoc/core/files/lib/core/facets/matchdata/match_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/matchdata/matchset_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/matchdata_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/metaid_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/module/abstract_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/module/alias_accessor_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/module/alias_method_chain_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/module/alias_module_function_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/module/ancestor_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/module/basename_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/module/can_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/module/class_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/module/conflict_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/module/extend_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/module/include_function_module_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/module/instance_methods_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/module/integrate_rb.html +0 -96
- data/doc/rdoc/core/files/lib/core/facets/module/is_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/module/methodize_rb.html +0 -96
- data/doc/rdoc/core/files/lib/core/facets/module/modspace_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/module/module_load_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/module/nesting_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/module/op_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/module/pathize_rb.html +0 -96
- data/doc/rdoc/core/files/lib/core/facets/module/prepend_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/module/redefine_method_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/module/redirect_method_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/module/rename_method_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/module/revise_rb.html +0 -99
- data/doc/rdoc/core/files/lib/core/facets/module/spacename_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/module/wrap_method_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/module_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/nilclass/ergo_rb.html +0 -96
- data/doc/rdoc/core/files/lib/core/facets/nilclass/to_f_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/nilclass_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/numeric/approx_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/numeric/distance_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/numeric/round_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/numeric_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/objectspace/classes_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/objectspace_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/proc/bind_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/proc/compose_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/proc/curry_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/proc/to_method_rb.html +0 -96
- data/doc/rdoc/core/files/lib/core/facets/proc/update_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/proc_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/range/combine_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/range/overlap_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/range/to_r_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/range/umbrella_rb.html +0 -96
- data/doc/rdoc/core/files/lib/core/facets/range/within_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/range_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/regexp/arity_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/regexp/to_re_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/regexp_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/stackable_rb.html +0 -120
- data/doc/rdoc/core/files/lib/core/facets/string/align_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/string/bracket_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/string/bytes_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/string/camelcase_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/string/capitalized_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/string/chars_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/string/chomp_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/string/cleave_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/string/compress_lines_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/string/contains_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/string/divide_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/string/each_char_rb.html +0 -96
- data/doc/rdoc/core/files/lib/core/facets/string/each_word_rb.html +0 -96
- data/doc/rdoc/core/files/lib/core/facets/string/end_with_rb.html +0 -96
- data/doc/rdoc/core/files/lib/core/facets/string/expand_tab_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/string/file_rb.html +0 -96
- data/doc/rdoc/core/files/lib/core/facets/string/fold_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/string/indent_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/string/interpolate_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/string/line_wrap_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/string/lines_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/string/margin_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/string/methodize_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/string/modulize_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/string/mscan_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/string/natcmp_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/string/nchar_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/string/op_sub_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/string/outdent_rb.html +0 -96
- data/doc/rdoc/core/files/lib/core/facets/string/pathize_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/string/range_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/string/rewrite_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/string/shatter_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/string/snakecase_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/string/splice_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/string/start_with_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/string/subtract_rb.html +0 -100
- data/doc/rdoc/core/files/lib/core/facets/string/tab_rb.html +0 -99
- data/doc/rdoc/core/files/lib/core/facets/string/tabto_rb.html +0 -96
- data/doc/rdoc/core/files/lib/core/facets/string/titlecase_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/string/to_re_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/string/variablize_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/string/word_wrap_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/string/words_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/string/xor_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/string_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/struct/attributes_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/struct_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/symbol/chomp_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/symbol/generate_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/symbol/not_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/symbol/plain_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/symbol/query_rb.html +0 -96
- data/doc/rdoc/core/files/lib/core/facets/symbol/re_s_rb.html +0 -96
- data/doc/rdoc/core/files/lib/core/facets/symbol/setter_rb.html +0 -96
- data/doc/rdoc/core/files/lib/core/facets/symbol/succ_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/symbol/to_proc_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/symbol/variablize_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/symbol_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/time/advance_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/time/ago_rb.html +0 -96
- data/doc/rdoc/core/files/lib/core/facets/time/change_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/time/elapse_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/time/hence_rb.html +0 -96
- data/doc/rdoc/core/files/lib/core/facets/time/round_rb.html +0 -96
- data/doc/rdoc/core/files/lib/core/facets/time/set_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/time/stamp_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/time/to_time_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/time/trunc_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/time_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/to_hash_rb.html +0 -97
- data/doc/rdoc/core/files/lib/core/facets/unboundmethod/arguments_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/unboundmethod/name_rb.html +0 -92
- data/doc/rdoc/core/files/lib/core/facets/unboundmethod_rb.html +0 -92
- data/doc/rdoc/core/fr_class_index.html +0 -85
- data/doc/rdoc/core/fr_file_index.html +0 -381
- data/doc/rdoc/core/fr_method_index.html +0 -520
- data/doc/rdoc/core/index.html +0 -26
- data/doc/rdoc/core/rdoc-style.css +0 -177
- data/doc/rdoc/more/classes/ANSICode.html +0 -493
- data/doc/rdoc/more/classes/Advisable.html +0 -269
- data/doc/rdoc/more/classes/Advisable/Method.html +0 -223
- data/doc/rdoc/more/classes/Archive.html +0 -89
- data/doc/rdoc/more/classes/Archive/Tar.html +0 -89
- data/doc/rdoc/more/classes/Archive/Tar/Minitar.html +0 -469
- data/doc/rdoc/more/classes/Archive/Tar/Minitar/Input.html +0 -355
- data/doc/rdoc/more/classes/Archive/Tar/Minitar/Output.html +0 -216
- data/doc/rdoc/more/classes/Archive/Tar/Minitar/Reader.html +0 -283
- data/doc/rdoc/more/classes/Archive/Tar/Minitar/Writer.html +0 -378
- data/doc/rdoc/more/classes/Argvector.html +0 -487
- data/doc/rdoc/more/classes/Association.html +0 -319
- data/doc/rdoc/more/classes/Association/Kernel.html +0 -131
- data/doc/rdoc/more/classes/Autoarray.html +0 -166
- data/doc/rdoc/more/classes/BBCode.html +0 -532
- data/doc/rdoc/more/classes/BaseX.html +0 -194
- data/doc/rdoc/more/classes/BiCrypt.html +0 -541
- data/doc/rdoc/more/classes/BinReadable.html +0 -485
- data/doc/rdoc/more/classes/BinReadable/ByteOrder.html +0 -223
- data/doc/rdoc/more/classes/Binding.html +0 -146
- data/doc/rdoc/more/classes/BlankSlate.html +0 -129
- data/doc/rdoc/more/classes/Buildable.html +0 -152
- data/doc/rdoc/more/classes/BuildingBlock.html +0 -360
- data/doc/rdoc/more/classes/Capsule.html +0 -408
- data/doc/rdoc/more/classes/Capsule/MissingFile.html +0 -96
- data/doc/rdoc/more/classes/Cloneable.html +0 -129
- data/doc/rdoc/more/classes/ConsoleUtils.html +0 -238
- data/doc/rdoc/more/classes/Coroutine.html +0 -285
- data/doc/rdoc/more/classes/Crypt.html +0 -275
- data/doc/rdoc/more/classes/CssFilter.html +0 -471
- data/doc/rdoc/more/classes/CssTree.html +0 -149
- data/doc/rdoc/more/classes/Dictionary.html +0 -1255
- data/doc/rdoc/more/classes/Downloader.html +0 -512
- data/doc/rdoc/more/classes/Duration.html +0 -691
- data/doc/rdoc/more/classes/Duration/Numeric.html +0 -389
- data/doc/rdoc/more/classes/Duration/Time.html +0 -124
- data/doc/rdoc/more/classes/Enumerable.html +0 -401
- data/doc/rdoc/more/classes/Enumerable/Elementor.html +0 -170
- data/doc/rdoc/more/classes/Enumerable/Enumerator.html +0 -116
- data/doc/rdoc/more/classes/Enumerable/Filterable.html +0 -246
- data/doc/rdoc/more/classes/EnumerablePass.html +0 -214
- data/doc/rdoc/more/classes/Enumerator.html +0 -95
- data/doc/rdoc/more/classes/Enumerator/Filter.html +0 -104
- data/doc/rdoc/more/classes/Equatable.html +0 -188
- data/doc/rdoc/more/classes/Expirable.html +0 -195
- data/doc/rdoc/more/classes/FileList.html +0 -955
- data/doc/rdoc/more/classes/Fileable.html +0 -178
- data/doc/rdoc/more/classes/Fileable/DSL.html +0 -303
- data/doc/rdoc/more/classes/Hash.html +0 -171
- data/doc/rdoc/more/classes/Hash2Xml.html +0 -105
- data/doc/rdoc/more/classes/Hook.html +0 -162
- data/doc/rdoc/more/classes/HtmlFilter.html +0 -329
- data/doc/rdoc/more/classes/IORedirect.html +0 -220
- data/doc/rdoc/more/classes/InfinityClass.html +0 -448
- data/doc/rdoc/more/classes/InfinityClass/Numeric.html +0 -195
- data/doc/rdoc/more/classes/Ini.html +0 -447
- data/doc/rdoc/more/classes/Instantiable.html +0 -140
- data/doc/rdoc/more/classes/Instantize.html +0 -160
- data/doc/rdoc/more/classes/Interval.html +0 -877
- data/doc/rdoc/more/classes/It.html +0 -185
- data/doc/rdoc/more/classes/LRUCache.html +0 -321
- data/doc/rdoc/more/classes/LRUCache/Item.html +0 -114
- data/doc/rdoc/more/classes/LRUCache/Sentinel.html +0 -100
- data/doc/rdoc/more/classes/LinkedList.html +0 -432
- data/doc/rdoc/more/classes/LinkedList/Node.html +0 -149
- data/doc/rdoc/more/classes/Matcher.html +0 -335
- data/doc/rdoc/more/classes/Matcher/MatchData.html +0 -115
- data/doc/rdoc/more/classes/Memoizer.html +0 -240
- data/doc/rdoc/more/classes/MissingArgument.html +0 -97
- data/doc/rdoc/more/classes/Module.html +0 -1224
- data/doc/rdoc/more/classes/Multiton.html +0 -205
- data/doc/rdoc/more/classes/Multiton/Inclusive.html +0 -93
- data/doc/rdoc/more/classes/Multiton/MetaMethods.html +0 -221
- data/doc/rdoc/more/classes/NackClass.html +0 -98
- data/doc/rdoc/more/classes/Net.html +0 -88
- data/doc/rdoc/more/classes/Net/SMTP.html +0 -140
- data/doc/rdoc/more/classes/NullClass.html +0 -202
- data/doc/rdoc/more/classes/Numeric/Multipliers.html +0 -456
- data/doc/rdoc/more/classes/ObjectReflection.html +0 -172
- data/doc/rdoc/more/classes/OpEsc.html +0 -137
- data/doc/rdoc/more/classes/OpenCascade.html +0 -179
- data/doc/rdoc/more/classes/OpenCollection.html +0 -138
- data/doc/rdoc/more/classes/OpenHash.html +0 -157
- data/doc/rdoc/more/classes/OpenModule.html +0 -135
- data/doc/rdoc/more/classes/OpenObject.html +0 -608
- data/doc/rdoc/more/classes/OpenStructable.html +0 -326
- data/doc/rdoc/more/classes/PQueue.html +0 -607
- data/doc/rdoc/more/classes/Paramix.html +0 -201
- data/doc/rdoc/more/classes/Paramix/Delegator.html +0 -215
- data/doc/rdoc/more/classes/PathList.html +0 -159
- data/doc/rdoc/more/classes/PathList/Finder.html +0 -135
- data/doc/rdoc/more/classes/Platform.html +0 -444
- data/doc/rdoc/more/classes/Pool.html +0 -204
- data/doc/rdoc/more/classes/Proc.html +0 -180
- data/doc/rdoc/more/classes/ProgressBar.html +0 -356
- data/doc/rdoc/more/classes/Prototype.html +0 -243
- data/doc/rdoc/more/classes/RWDelegator.html +0 -194
- data/doc/rdoc/more/classes/Random.html +0 -145
- data/doc/rdoc/more/classes/Random/Array.html +0 -339
- data/doc/rdoc/more/classes/Random/Hash.html +0 -378
- data/doc/rdoc/more/classes/Random/Object.html +0 -119
- data/doc/rdoc/more/classes/Random/String.html +0 -299
- data/doc/rdoc/more/classes/Random/String/Self.html +0 -153
- data/doc/rdoc/more/classes/Recorder.html +0 -203
- data/doc/rdoc/more/classes/Reference.html +0 -196
- data/doc/rdoc/more/classes/Registerable.html +0 -157
- data/doc/rdoc/more/classes/Semaphore.html +0 -260
- data/doc/rdoc/more/classes/Settings.html +0 -288
- data/doc/rdoc/more/classes/Settings/Setting.html +0 -223
- data/doc/rdoc/more/classes/Settings/SettingCollection.html +0 -144
- data/doc/rdoc/more/classes/SimpleStringIO.html +0 -135
- data/doc/rdoc/more/classes/Snapshot.html +0 -194
- data/doc/rdoc/more/classes/Snapshot/ValueHolder.html +0 -163
- data/doc/rdoc/more/classes/SparseArray.html +0 -1397
- data/doc/rdoc/more/classes/Stash.html +0 -232
- data/doc/rdoc/more/classes/String/Mask.html +0 -555
- data/doc/rdoc/more/classes/String/Words.html +0 -328
- data/doc/rdoc/more/classes/Struct.html +0 -130
- data/doc/rdoc/more/classes/SyncArray.html +0 -127
- data/doc/rdoc/more/classes/SyncHash.html +0 -158
- data/doc/rdoc/more/classes/SyncHash/Delegator.html +0 -211
- data/doc/rdoc/more/classes/SyncHash/Inheritor.html +0 -211
- data/doc/rdoc/more/classes/System.html +0 -1117
- data/doc/rdoc/more/classes/Timer.html +0 -464
- data/doc/rdoc/more/classes/Timer/Dummy.html +0 -139
- data/doc/rdoc/more/classes/TracePoint.html +0 -455
- data/doc/rdoc/more/classes/Tuple.html +0 -900
- data/doc/rdoc/more/classes/TypeCast.html +0 -158
- data/doc/rdoc/more/classes/TypeCast/Class.html +0 -127
- data/doc/rdoc/more/classes/TypeCast/Object.html +0 -117
- data/doc/rdoc/more/classes/TypeCastException.html +0 -96
- data/doc/rdoc/more/classes/Uninheritable.html +0 -120
- data/doc/rdoc/more/classes/VersionNumber.html +0 -408
- data/doc/rdoc/more/classes/X.html +0 -117
- data/doc/rdoc/more/classes/XOXO.html +0 -189
- data/doc/rdoc/more/classes/ZipUtils.html +0 -568
- data/doc/rdoc/more/classes/ZipUtils/DryRun.html +0 -391
- data/doc/rdoc/more/classes/ZipUtils/NoWrite.html +0 -391
- data/doc/rdoc/more/classes/ZipUtils/Verbose.html +0 -361
- data/doc/rdoc/more/created.rid +0 -1
- data/doc/rdoc/more/files/README.html +0 -286
- data/doc/rdoc/more/files/doc/README_more.html +0 -141
- data/doc/rdoc/more/files/lib/more/facets/1stclassmethod_rb.html +0 -181
- data/doc/rdoc/more/files/lib/more/facets/advisable_rb.html +0 -124
- data/doc/rdoc/more/files/lib/more/facets/ansicode_rb.html +0 -200
- data/doc/rdoc/more/files/lib/more/facets/argvector_rb.html +0 -142
- data/doc/rdoc/more/files/lib/more/facets/association_rb.html +0 -158
- data/doc/rdoc/more/files/lib/more/facets/attr_rb.html +0 -92
- data/doc/rdoc/more/files/lib/more/facets/autoarray_rb.html +0 -125
- data/doc/rdoc/more/files/lib/more/facets/autoreload_rb.html +0 -134
- data/doc/rdoc/more/files/lib/more/facets/basex_rb.html +0 -92
- data/doc/rdoc/more/files/lib/more/facets/bbcode_rb.html +0 -138
- data/doc/rdoc/more/files/lib/more/facets/bicrypt_rb.html +0 -124
- data/doc/rdoc/more/files/lib/more/facets/binding/opvars_rb.html +0 -96
- data/doc/rdoc/more/files/lib/more/facets/binreadable_rb.html +0 -141
- data/doc/rdoc/more/files/lib/more/facets/blankslate_rb.html +0 -92
- data/doc/rdoc/more/files/lib/more/facets/buildable_rb.html +0 -230
- data/doc/rdoc/more/files/lib/more/facets/capsule_rb.html +0 -143
- data/doc/rdoc/more/files/lib/more/facets/class_extension_rb.html +0 -155
- data/doc/rdoc/more/files/lib/more/facets/classmethods_rb.html +0 -213
- data/doc/rdoc/more/files/lib/more/facets/cloneable_rb.html +0 -134
- data/doc/rdoc/more/files/lib/more/facets/consoleutils_rb.html +0 -92
- data/doc/rdoc/more/files/lib/more/facets/coroutine_rb.html +0 -163
- data/doc/rdoc/more/files/lib/more/facets/crypt_rb.html +0 -141
- data/doc/rdoc/more/files/lib/more/facets/cssfilter_rb.html +0 -121
- data/doc/rdoc/more/files/lib/more/facets/daemonize_rb.html +0 -118
- data/doc/rdoc/more/files/lib/more/facets/dependency_rb.html +0 -158
- data/doc/rdoc/more/files/lib/more/facets/dictionary_rb.html +0 -201
- data/doc/rdoc/more/files/lib/more/facets/downloader_rb.html +0 -137
- data/doc/rdoc/more/files/lib/more/facets/duplicable_rb.html +0 -100
- data/doc/rdoc/more/files/lib/more/facets/duration_rb.html +0 -92
- data/doc/rdoc/more/files/lib/more/facets/elementor_rb.html +0 -149
- data/doc/rdoc/more/files/lib/more/facets/elementwise_rb.html +0 -96
- data/doc/rdoc/more/files/lib/more/facets/enumerablepass_rb.html +0 -154
- data/doc/rdoc/more/files/lib/more/facets/equatable_rb.html +0 -146
- data/doc/rdoc/more/files/lib/more/facets/expirable_rb.html +0 -116
- data/doc/rdoc/more/files/lib/more/facets/fileable_rb.html +0 -138
- data/doc/rdoc/more/files/lib/more/facets/filelist_rb.html +0 -165
- data/doc/rdoc/more/files/lib/more/facets/filter_rb.html +0 -97
- data/doc/rdoc/more/files/lib/more/facets/heap_rb.html +0 -132
- data/doc/rdoc/more/files/lib/more/facets/hook_rb.html +0 -96
- data/doc/rdoc/more/files/lib/more/facets/htmlfilter_rb.html +0 -153
- data/doc/rdoc/more/files/lib/more/facets/infinity_rb.html +0 -153
- data/doc/rdoc/more/files/lib/more/facets/inheritor_rb.html +0 -124
- data/doc/rdoc/more/files/lib/more/facets/ini_rb.html +0 -105
- data/doc/rdoc/more/files/lib/more/facets/instantiable_rb.html +0 -119
- data/doc/rdoc/more/files/lib/more/facets/instantise_rb.html +0 -96
- data/doc/rdoc/more/files/lib/more/facets/instantize_rb.html +0 -160
- data/doc/rdoc/more/files/lib/more/facets/interval_rb.html +0 -163
- data/doc/rdoc/more/files/lib/more/facets/ioredirect_rb.html +0 -133
- data/doc/rdoc/more/files/lib/more/facets/iteration_rb.html +0 -94
- data/doc/rdoc/more/files/lib/more/facets/kernel/meta_rb.html +0 -96
- data/doc/rdoc/more/files/lib/more/facets/linkedlist_rb.html +0 -159
- data/doc/rdoc/more/files/lib/more/facets/lrucache_rb.html +0 -129
- data/doc/rdoc/more/files/lib/more/facets/main_rb.html +0 -126
- data/doc/rdoc/more/files/lib/more/facets/matcher_rb.html +0 -97
- data/doc/rdoc/more/files/lib/more/facets/memoize_rb.html +0 -164
- data/doc/rdoc/more/files/lib/more/facets/memoizer_rb.html +0 -152
- data/doc/rdoc/more/files/lib/more/facets/methodspace_rb.html +0 -138
- data/doc/rdoc/more/files/lib/more/facets/minitar_rb.html +0 -203
- data/doc/rdoc/more/files/lib/more/facets/multipliers_rb.html +0 -132
- data/doc/rdoc/more/files/lib/more/facets/multiton_rb.html +0 -187
- data/doc/rdoc/more/files/lib/more/facets/nackclass_rb.html +0 -120
- data/doc/rdoc/more/files/lib/more/facets/net/smtp_tls_rb.html +0 -143
- data/doc/rdoc/more/files/lib/more/facets/nilstatus_rb.html +0 -92
- data/doc/rdoc/more/files/lib/more/facets/nullclass_rb.html +0 -122
- data/doc/rdoc/more/files/lib/more/facets/opencascade_rb.html +0 -114
- data/doc/rdoc/more/files/lib/more/facets/opencollection_rb.html +0 -123
- data/doc/rdoc/more/files/lib/more/facets/openhash_rb.html +0 -107
- data/doc/rdoc/more/files/lib/more/facets/openmodule_rb.html +0 -92
- data/doc/rdoc/more/files/lib/more/facets/openobject_rb.html +0 -169
- data/doc/rdoc/more/files/lib/more/facets/opesc_rb.html +0 -94
- data/doc/rdoc/more/files/lib/more/facets/orderedhash_rb.html +0 -143
- data/doc/rdoc/more/files/lib/more/facets/ostructable_rb.html +0 -92
- data/doc/rdoc/more/files/lib/more/facets/overload_rb.html +0 -119
- data/doc/rdoc/more/files/lib/more/facets/paramix_rb.html +0 -135
- data/doc/rdoc/more/files/lib/more/facets/partial_rb.html +0 -124
- data/doc/rdoc/more/files/lib/more/facets/pathlist_rb.html +0 -133
- data/doc/rdoc/more/files/lib/more/facets/platform_rb.html +0 -103
- data/doc/rdoc/more/files/lib/more/facets/pool_rb.html +0 -131
- data/doc/rdoc/more/files/lib/more/facets/pqueue_rb.html +0 -128
- data/doc/rdoc/more/files/lib/more/facets/progressbar_rb.html +0 -126
- data/doc/rdoc/more/files/lib/more/facets/prototype_rb.html +0 -102
- data/doc/rdoc/more/files/lib/more/facets/random_rb.html +0 -149
- data/doc/rdoc/more/files/lib/more/facets/rbsystem_rb.html +0 -144
- data/doc/rdoc/more/files/lib/more/facets/recorder_rb.html +0 -154
- data/doc/rdoc/more/files/lib/more/facets/reference_rb.html +0 -130
- data/doc/rdoc/more/files/lib/more/facets/reflection_rb.html +0 -134
- data/doc/rdoc/more/files/lib/more/facets/registerable_rb.html +0 -98
- data/doc/rdoc/more/files/lib/more/facets/rwdelegator_rb.html +0 -122
- data/doc/rdoc/more/files/lib/more/facets/semaphore_rb.html +0 -120
- data/doc/rdoc/more/files/lib/more/facets/settings_rb.html +0 -141
- data/doc/rdoc/more/files/lib/more/facets/snapshot_rb.html +0 -177
- data/doc/rdoc/more/files/lib/more/facets/sparse_array_rb.html +0 -92
- data/doc/rdoc/more/files/lib/more/facets/stash_rb.html +0 -166
- data/doc/rdoc/more/files/lib/more/facets/string/mask_rb.html +0 -96
- data/doc/rdoc/more/files/lib/more/facets/string/words_rb.html +0 -96
- data/doc/rdoc/more/files/lib/more/facets/succ_rb.html +0 -92
- data/doc/rdoc/more/files/lib/more/facets/syncarray_rb.html +0 -125
- data/doc/rdoc/more/files/lib/more/facets/synchash_rb.html +0 -138
- data/doc/rdoc/more/files/lib/more/facets/thread_rb.html +0 -132
- data/doc/rdoc/more/files/lib/more/facets/timer_rb.html +0 -174
- data/doc/rdoc/more/files/lib/more/facets/tracepoint_rb.html +0 -172
- data/doc/rdoc/more/files/lib/more/facets/tuple_rb.html +0 -160
- data/doc/rdoc/more/files/lib/more/facets/typecast_rb.html +0 -215
- data/doc/rdoc/more/files/lib/more/facets/uninheritable_rb.html +0 -129
- data/doc/rdoc/more/files/lib/more/facets/version_rb.html +0 -132
- data/doc/rdoc/more/files/lib/more/facets/xmlhash_rb.html +0 -97
- data/doc/rdoc/more/files/lib/more/facets/xoxo_rb.html +0 -136
- data/doc/rdoc/more/files/lib/more/facets/ziputils_rb.html +0 -105
- data/doc/rdoc/more/fr_class_index.html +0 -185
- data/doc/rdoc/more/fr_file_index.html +0 -156
- data/doc/rdoc/more/fr_method_index.html +0 -1132
- data/doc/rdoc/more/index.html +0 -26
- data/doc/rdoc/more/rdoc-style.css +0 -177
- data/lib/core/facets/kernel/__here__.rb +0 -8
- data/lib/more/facets/buildable.rb +0 -344
- data/lib/more/facets/cssfilter.rb +0 -254
- data/lib/more/facets/htmlfilter.rb +0 -595
- data/lib/more/facets/kernel/meta.rb +0 -32
- data/lib/more/facets/prototype.rb +0 -88
- data/lib/more/facets/rwdelegator.rb +0 -74
@@ -1,262 +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>Module: Stackable</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 = "+"
|
36
|
-
}
|
37
|
-
else
|
38
|
-
{
|
39
|
-
elem.style.display = "block"
|
40
|
-
link.innerHTML = "-"
|
41
|
-
}
|
42
|
-
}
|
43
|
-
|
44
|
-
function openCode( url )
|
45
|
-
{
|
46
|
-
window.open( url, "SOURCE_CODE", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=480,width=750" ).focus();
|
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">Module</span><br />Stackable</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/core/facets/stackable_rb.html">lib/core/facets/stackable.rb</a>
|
61
|
-
</td>
|
62
|
-
</tr>
|
63
|
-
</table>
|
64
|
-
</td>
|
65
|
-
</tr>
|
66
|
-
</table>
|
67
|
-
<!-- banner header -->
|
68
|
-
|
69
|
-
<div id="bodyContent">
|
70
|
-
<div id="content">
|
71
|
-
|
72
|
-
<div class="description"><h1><a href="Stackable.html">Stackable</a></h1>
|
73
|
-
<p>
|
74
|
-
<a href="Stackable.html">Stackable</a> mixin provides <a
|
75
|
-
href="Stackable.html#M000353">pop</a>, <a
|
76
|
-
href="Stackable.html#M000354">push</a>, <a
|
77
|
-
href="Stackable.html#M000355">pull</a>, etc. It depends on slice, splice
|
78
|
-
and insert.
|
79
|
-
</p>
|
80
|
-
</div>
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
<div class="sectiontitle">Methods</div>
|
85
|
-
<span style="padding-right: 5px;"><a href="#M000359">peek</a></span>
|
86
|
-
<span style="padding-right: 5px;"><a href="#M000357">poke</a></span>
|
87
|
-
<span style="padding-right: 5px;"><a href="#M000353">pop</a></span>
|
88
|
-
<span style="padding-right: 5px;"><a href="#M000355">pull</a></span>
|
89
|
-
<span style="padding-right: 5px;"><a href="#M000354">push</a></span>
|
90
|
-
<span style="padding-right: 5px;"><a href="#M000356">shift</a></span>
|
91
|
-
<span style="padding-right: 5px;"><a href="#M000358">unshift</a></span>
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
<div class="sectiontitle">Public Instance methods</div>
|
99
|
-
<div class="method">
|
100
|
-
<div class="title">
|
101
|
-
<a name="M000359"></a><b>peek</b>()
|
102
|
-
</div>
|
103
|
-
<div class="description">
|
104
|
-
<p>
|
105
|
-
Peek at the top of the stack.
|
106
|
-
</p>
|
107
|
-
<pre>
|
108
|
-
a = [1, 2, 3]
|
109
|
-
a.peek #=> 3
|
110
|
-
a #=> [1, 2, 3]
|
111
|
-
</pre>
|
112
|
-
</div>
|
113
|
-
<div class="sourcecode">
|
114
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000359_source')" id="l_M000359_source">+</a> ]</p>
|
115
|
-
<div id="M000359_source" class="dyn-source">
|
116
|
-
<pre>
|
117
|
-
<span class="ruby-comment cmt"># File lib/core/facets/stackable.rb, line 81</span>
|
118
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">peek</span>
|
119
|
-
<span class="ruby-identifier">slice</span>(<span class="ruby-value">-1</span>)
|
120
|
-
<span class="ruby-keyword kw">end</span>
|
121
|
-
</pre>
|
122
|
-
</div>
|
123
|
-
</div>
|
124
|
-
</div>
|
125
|
-
<div class="method">
|
126
|
-
<div class="title">
|
127
|
-
<a name="M000357"></a><b>poke</b>(x)
|
128
|
-
</div>
|
129
|
-
<div class="description">
|
130
|
-
<p>
|
131
|
-
Poke item onto the stack.
|
132
|
-
</p>
|
133
|
-
<pre>
|
134
|
-
a = [2, 3]
|
135
|
-
a.poke(1) #=> [1, 2, 3]
|
136
|
-
|
137
|
-
TODO: Better name (besides unshift)?
|
138
|
-
</pre>
|
139
|
-
</div>
|
140
|
-
<div class="aka">
|
141
|
-
This method is also aliased as
|
142
|
-
<a href="Stackable.html#M000358">unshift</a>
|
143
|
-
</div>
|
144
|
-
<div class="sourcecode">
|
145
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000357_source')" id="l_M000357_source">+</a> ]</p>
|
146
|
-
<div id="M000357_source" class="dyn-source">
|
147
|
-
<pre>
|
148
|
-
<span class="ruby-comment cmt"># File lib/core/facets/stackable.rb, line 69</span>
|
149
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">poke</span>(<span class="ruby-identifier">x</span>)
|
150
|
-
<span class="ruby-identifier">insert</span>(<span class="ruby-value">0</span>,<span class="ruby-identifier">x</span>)
|
151
|
-
<span class="ruby-keyword kw">end</span>
|
152
|
-
</pre>
|
153
|
-
</div>
|
154
|
-
</div>
|
155
|
-
</div>
|
156
|
-
<div class="method">
|
157
|
-
<div class="title">
|
158
|
-
<a name="M000353"></a><b>pop</b>()
|
159
|
-
</div>
|
160
|
-
<div class="description">
|
161
|
-
<p>
|
162
|
-
Pop item off stack.
|
163
|
-
</p>
|
164
|
-
<pre>
|
165
|
-
a = [1, 2, 3]
|
166
|
-
a.pop #=> 3
|
167
|
-
a #=> [1, 2]
|
168
|
-
</pre>
|
169
|
-
</div>
|
170
|
-
<div class="sourcecode">
|
171
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000353_source')" id="l_M000353_source">+</a> ]</p>
|
172
|
-
<div id="M000353_source" class="dyn-source">
|
173
|
-
<pre>
|
174
|
-
<span class="ruby-comment cmt"># File lib/core/facets/stackable.rb, line 37</span>
|
175
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">pop</span>
|
176
|
-
<span class="ruby-identifier">splice</span>(<span class="ruby-value">-1</span>)
|
177
|
-
<span class="ruby-keyword kw">end</span>
|
178
|
-
</pre>
|
179
|
-
</div>
|
180
|
-
</div>
|
181
|
-
</div>
|
182
|
-
<div class="method">
|
183
|
-
<div class="title">
|
184
|
-
<a name="M000355"></a><b>pull</b>()
|
185
|
-
</div>
|
186
|
-
<div class="description">
|
187
|
-
<p>
|
188
|
-
Pull item off the stack.
|
189
|
-
</p>
|
190
|
-
<pre>
|
191
|
-
a = [1, 2, 3]
|
192
|
-
a.pull #=> 1
|
193
|
-
a #=> [2, 3]
|
194
|
-
</pre>
|
195
|
-
</div>
|
196
|
-
<div class="aka">
|
197
|
-
This method is also aliased as
|
198
|
-
<a href="Stackable.html#M000356">shift</a>
|
199
|
-
</div>
|
200
|
-
<div class="sourcecode">
|
201
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000355_source')" id="l_M000355_source">+</a> ]</p>
|
202
|
-
<div id="M000355_source" class="dyn-source">
|
203
|
-
<pre>
|
204
|
-
<span class="ruby-comment cmt"># File lib/core/facets/stackable.rb, line 56</span>
|
205
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">pull</span>
|
206
|
-
<span class="ruby-identifier">slice</span>(<span class="ruby-value">0</span>)
|
207
|
-
<span class="ruby-keyword kw">end</span>
|
208
|
-
</pre>
|
209
|
-
</div>
|
210
|
-
</div>
|
211
|
-
</div>
|
212
|
-
<div class="method">
|
213
|
-
<div class="title">
|
214
|
-
<a name="M000354"></a><b>push</b>(x)
|
215
|
-
</div>
|
216
|
-
<div class="description">
|
217
|
-
<p>
|
218
|
-
Push item onto the stack.
|
219
|
-
</p>
|
220
|
-
<pre>
|
221
|
-
a = [1, 2]
|
222
|
-
a.push(3) #=> [1, 2, 3]
|
223
|
-
</pre>
|
224
|
-
</div>
|
225
|
-
<div class="sourcecode">
|
226
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000354_source')" id="l_M000354_source">+</a> ]</p>
|
227
|
-
<div id="M000354_source" class="dyn-source">
|
228
|
-
<pre>
|
229
|
-
<span class="ruby-comment cmt"># File lib/core/facets/stackable.rb, line 46</span>
|
230
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">push</span>(<span class="ruby-identifier">x</span>)
|
231
|
-
<span class="ruby-identifier">insert</span>(<span class="ruby-value">-1</span>,<span class="ruby-identifier">x</span>)
|
232
|
-
<span class="ruby-keyword kw">end</span>
|
233
|
-
</pre>
|
234
|
-
</div>
|
235
|
-
</div>
|
236
|
-
</div>
|
237
|
-
<div class="method">
|
238
|
-
<div class="title">
|
239
|
-
<a name="M000356"></a><b>shift</b>()
|
240
|
-
</div>
|
241
|
-
<div class="description">
|
242
|
-
<p>
|
243
|
-
Alias for <a href="Stackable.html#M000355">pull</a>
|
244
|
-
</p>
|
245
|
-
</div>
|
246
|
-
</div>
|
247
|
-
<div class="method">
|
248
|
-
<div class="title">
|
249
|
-
<a name="M000358"></a><b>unshift</b>(x)
|
250
|
-
</div>
|
251
|
-
<div class="description">
|
252
|
-
<p>
|
253
|
-
Alias for <a href="Stackable.html#M000357">poke</a>
|
254
|
-
</p>
|
255
|
-
</div>
|
256
|
-
</div>
|
257
|
-
</div>
|
258
|
-
|
259
|
-
</div>
|
260
|
-
|
261
|
-
</body>
|
262
|
-
</html>
|
@@ -1,2332 +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 = "+"
|
36
|
-
}
|
37
|
-
else
|
38
|
-
{
|
39
|
-
elem.style.display = "block"
|
40
|
-
link.innerHTML = "-"
|
41
|
-
}
|
42
|
-
}
|
43
|
-
|
44
|
-
function openCode( url )
|
45
|
-
{
|
46
|
-
window.open( url, "SOURCE_CODE", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=480,width=750" ).focus();
|
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/core/facets/boolean_rb.html">lib/core/facets/boolean.rb</a>
|
61
|
-
<a href="../files/lib/core/facets/comparable/cmp_rb.html">lib/core/facets/comparable/cmp.rb</a>
|
62
|
-
<a href="../files/lib/core/facets/string/shatter_rb.html">lib/core/facets/string/shatter.rb</a>
|
63
|
-
<a href="../files/lib/core/facets/string/file_rb.html">lib/core/facets/string/file.rb</a>
|
64
|
-
<a href="../files/lib/core/facets/string/to_re_rb.html">lib/core/facets/string/to_re.rb</a>
|
65
|
-
<a href="../files/lib/core/facets/string/fold_rb.html">lib/core/facets/string/fold.rb</a>
|
66
|
-
<a href="../files/lib/core/facets/string/start_with_rb.html">lib/core/facets/string/start_with.rb</a>
|
67
|
-
<a href="../files/lib/core/facets/string/camelcase_rb.html">lib/core/facets/string/camelcase.rb</a>
|
68
|
-
<a href="../files/lib/core/facets/string/lines_rb.html">lib/core/facets/string/lines.rb</a>
|
69
|
-
<a href="../files/lib/core/facets/string/modulize_rb.html">lib/core/facets/string/modulize.rb</a>
|
70
|
-
<a href="../files/lib/core/facets/string/word_wrap_rb.html">lib/core/facets/string/word_wrap.rb</a>
|
71
|
-
<a href="../files/lib/core/facets/string/align_rb.html">lib/core/facets/string/align.rb</a>
|
72
|
-
<a href="../files/lib/core/facets/string/tab_rb.html">lib/core/facets/string/tab.rb</a>
|
73
|
-
<a href="../files/lib/core/facets/string/methodize_rb.html">lib/core/facets/string/methodize.rb</a>
|
74
|
-
<a href="../files/lib/core/facets/string/op_sub_rb.html">lib/core/facets/string/op_sub.rb</a>
|
75
|
-
<a href="../files/lib/core/facets/string/compress_lines_rb.html">lib/core/facets/string/compress_lines.rb</a>
|
76
|
-
<a href="../files/lib/core/facets/string/range_rb.html">lib/core/facets/string/range.rb</a>
|
77
|
-
<a href="../files/lib/core/facets/string/snakecase_rb.html">lib/core/facets/string/snakecase.rb</a>
|
78
|
-
<a href="../files/lib/core/facets/string/each_char_rb.html">lib/core/facets/string/each_char.rb</a>
|
79
|
-
<a href="../files/lib/core/facets/string/divide_rb.html">lib/core/facets/string/divide.rb</a>
|
80
|
-
<a href="../files/lib/core/facets/string/margin_rb.html">lib/core/facets/string/margin.rb</a>
|
81
|
-
<a href="../files/lib/core/facets/string/mscan_rb.html">lib/core/facets/string/mscan.rb</a>
|
82
|
-
<a href="../files/lib/core/facets/string/capitalized_rb.html">lib/core/facets/string/capitalized.rb</a>
|
83
|
-
<a href="../files/lib/core/facets/string/expand_tab_rb.html">lib/core/facets/string/expand_tab.rb</a>
|
84
|
-
<a href="../files/lib/core/facets/string/natcmp_rb.html">lib/core/facets/string/natcmp.rb</a>
|
85
|
-
<a href="../files/lib/core/facets/string/variablize_rb.html">lib/core/facets/string/variablize.rb</a>
|
86
|
-
<a href="../files/lib/core/facets/string/bytes_rb.html">lib/core/facets/string/bytes.rb</a>
|
87
|
-
<a href="../files/lib/core/facets/string/pathize_rb.html">lib/core/facets/string/pathize.rb</a>
|
88
|
-
<a href="../files/lib/core/facets/string/indent_rb.html">lib/core/facets/string/indent.rb</a>
|
89
|
-
<a href="../files/lib/core/facets/string/titlecase_rb.html">lib/core/facets/string/titlecase.rb</a>
|
90
|
-
<a href="../files/lib/core/facets/string/tabto_rb.html">lib/core/facets/string/tabto.rb</a>
|
91
|
-
<a href="../files/lib/core/facets/string/words_rb.html">lib/core/facets/string/words.rb</a>
|
92
|
-
<a href="../files/lib/core/facets/string/interpolate_rb.html">lib/core/facets/string/interpolate.rb</a>
|
93
|
-
<a href="../files/lib/core/facets/string/cleave_rb.html">lib/core/facets/string/cleave.rb</a>
|
94
|
-
<a href="../files/lib/core/facets/string/line_wrap_rb.html">lib/core/facets/string/line_wrap.rb</a>
|
95
|
-
<a href="../files/lib/core/facets/string/bracket_rb.html">lib/core/facets/string/bracket.rb</a>
|
96
|
-
<a href="../files/lib/core/facets/string/chars_rb.html">lib/core/facets/string/chars.rb</a>
|
97
|
-
<a href="../files/lib/core/facets/string/chomp_rb.html">lib/core/facets/string/chomp.rb</a>
|
98
|
-
<a href="../files/lib/core/facets/string/splice_rb.html">lib/core/facets/string/splice.rb</a>
|
99
|
-
<a href="../files/lib/core/facets/string/rewrite_rb.html">lib/core/facets/string/rewrite.rb</a>
|
100
|
-
<a href="../files/lib/core/facets/string/nchar_rb.html">lib/core/facets/string/nchar.rb</a>
|
101
|
-
<a href="../files/lib/core/facets/string/xor_rb.html">lib/core/facets/string/xor.rb</a>
|
102
|
-
<a href="../files/lib/core/facets/string/each_word_rb.html">lib/core/facets/string/each_word.rb</a>
|
103
|
-
<a href="../files/lib/core/facets/blank_rb.html">lib/core/facets/blank.rb</a>
|
104
|
-
</td>
|
105
|
-
</tr>
|
106
|
-
<tr>
|
107
|
-
<td>Parent:</td>
|
108
|
-
<td>
|
109
|
-
<a href="Object.html">
|
110
|
-
Object
|
111
|
-
</a>
|
112
|
-
</td>
|
113
|
-
</tr>
|
114
|
-
</table>
|
115
|
-
</td>
|
116
|
-
</tr>
|
117
|
-
</table>
|
118
|
-
<!-- banner header -->
|
119
|
-
|
120
|
-
<div id="bodyContent">
|
121
|
-
<div id="content">
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
<div class="sectiontitle">Methods</div>
|
127
|
-
<span style="padding-right: 5px;"><a href="#M000289">-</a></span>
|
128
|
-
<span style="padding-right: 5px;"><a href="#M000329">^</a></span>
|
129
|
-
<span style="padding-right: 5px;"><a href="#M000283">align</a></span>
|
130
|
-
<span style="padding-right: 5px;"><a href="#M000286">align_center</a></span>
|
131
|
-
<span style="padding-right: 5px;"><a href="#M000285">align_left</a></span>
|
132
|
-
<span style="padding-right: 5px;"><a href="#M000284">align_right</a></span>
|
133
|
-
<span style="padding-right: 5px;"><a href="#M000331">blank?</a></span>
|
134
|
-
<span style="padding-right: 5px;"><a href="#M000317">bracket</a></span>
|
135
|
-
<span style="padding-right: 5px;"><a href="#M000318">bracket!</a></span>
|
136
|
-
<span style="padding-right: 5px;"><a href="#M000307">bytes</a></span>
|
137
|
-
<span style="padding-right: 5px;"><a href="#M000278">camelcase</a></span>
|
138
|
-
<span style="padding-right: 5px;"><a href="#M000300">capitalized?</a></span>
|
139
|
-
<span style="padding-right: 5px;"><a href="#M000323">chars</a></span>
|
140
|
-
<span style="padding-right: 5px;"><a href="#M000315">cleave</a></span>
|
141
|
-
<span style="padding-right: 5px;"><a href="#M000270">cmp</a></span>
|
142
|
-
<span style="padding-right: 5px;"><a href="#M000290">compress_lines</a></span>
|
143
|
-
<span style="padding-right: 5px;"><a href="#M000322">dequote</a></span>
|
144
|
-
<span style="padding-right: 5px;"><a href="#M000297">divide</a></span>
|
145
|
-
<span style="padding-right: 5px;"><a href="#M000301">downcase?</a></span>
|
146
|
-
<span style="padding-right: 5px;"><a href="#M000296">each_char</a></span>
|
147
|
-
<span style="padding-right: 5px;"><a href="#M000330">each_word</a></span>
|
148
|
-
<span style="padding-right: 5px;"><a href="#M000277">end_with?</a></span>
|
149
|
-
<span style="padding-right: 5px;"><a href="#M000303">expand_tab</a></span>
|
150
|
-
<span style="padding-right: 5px;"><a href="#M000304">expand_tabs</a></span>
|
151
|
-
<span style="padding-right: 5px;"><a href="#M000272">file</a></span>
|
152
|
-
<span style="padding-right: 5px;"><a href="#M000275">fold</a></span>
|
153
|
-
<span style="padding-right: 5px;"><a href="#M000309">indent</a></span>
|
154
|
-
<span style="padding-right: 5px;"><a href="#M000294">index_all</a></span>
|
155
|
-
<span style="padding-right: 5px;"><a href="#M000314">interpolate</a></span>
|
156
|
-
<span style="padding-right: 5px;"><a href="#M000324">lchomp</a></span>
|
157
|
-
<span style="padding-right: 5px;"><a href="#M000325">lchomp!</a></span>
|
158
|
-
<span style="padding-right: 5px;"><a href="#M000316">line_wrap</a></span>
|
159
|
-
<span style="padding-right: 5px;"><a href="#M000279">lines</a></span>
|
160
|
-
<span style="padding-right: 5px;"><a href="#M000298">margin</a></span>
|
161
|
-
<span style="padding-right: 5px;"><a href="#M000288">methodize</a></span>
|
162
|
-
<span style="padding-right: 5px;"><a href="#M000280">modulize</a></span>
|
163
|
-
<span style="padding-right: 5px;"><a href="#M000299">mscan</a></span>
|
164
|
-
<span style="padding-right: 5px;"><a href="#M000305">natcmp</a></span>
|
165
|
-
<span style="padding-right: 5px;"><a href="#M000328">nchar</a></span>
|
166
|
-
<span style="padding-right: 5px;"><a href="#M000310">outdent</a></span>
|
167
|
-
<span style="padding-right: 5px;"><a href="#M000308">pathize</a></span>
|
168
|
-
<span style="padding-right: 5px;"><a href="#M000321">quote</a></span>
|
169
|
-
<span style="padding-right: 5px;"><a href="#M000291">range</a></span>
|
170
|
-
<span style="padding-right: 5px;"><a href="#M000292">range_all</a></span>
|
171
|
-
<span style="padding-right: 5px;"><a href="#M000293">range_of_line</a></span>
|
172
|
-
<span style="padding-right: 5px;"><a href="#M000327">rewrite</a></span>
|
173
|
-
<span style="padding-right: 5px;"><a href="#M000271">shatter</a></span>
|
174
|
-
<span style="padding-right: 5px;"><a href="#M000295">snakecase</a></span>
|
175
|
-
<span style="padding-right: 5px;"><a href="#M000326">splice</a></span>
|
176
|
-
<span style="padding-right: 5px;"><a href="#M000276">start_with?</a></span>
|
177
|
-
<span style="padding-right: 5px;"><a href="#M000287">tab</a></span>
|
178
|
-
<span style="padding-right: 5px;"><a href="#M000312">tabto</a></span>
|
179
|
-
<span style="padding-right: 5px;"><a href="#M000311">titlecase</a></span>
|
180
|
-
<span style="padding-right: 5px;"><a href="#M000269">to_b</a></span>
|
181
|
-
<span style="padding-right: 5px;"><a href="#M000273">to_re</a></span>
|
182
|
-
<span style="padding-right: 5px;"><a href="#M000274">to_rx</a></span>
|
183
|
-
<span style="padding-right: 5px;"><a href="#M000319">unbracket</a></span>
|
184
|
-
<span style="padding-right: 5px;"><a href="#M000320">unbracket!</a></span>
|
185
|
-
<span style="padding-right: 5px;"><a href="#M000302">upcase?</a></span>
|
186
|
-
<span style="padding-right: 5px;"><a href="#M000306">variablize</a></span>
|
187
|
-
<span style="padding-right: 5px;"><a href="#M000281">word_wrap</a></span>
|
188
|
-
<span style="padding-right: 5px;"><a href="#M000282">word_wrap!</a></span>
|
189
|
-
<span style="padding-right: 5px;"><a href="#M000313">words</a></span>
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
<div class="sectiontitle">Constants</div>
|
195
|
-
<table border='0' cellpadding='5'>
|
196
|
-
<tr valign='top'>
|
197
|
-
<td class="attr-name">BRA2KET</td>
|
198
|
-
<td>=</td>
|
199
|
-
<td class="attr-value">{ '['=>']', '('=>')', '{'=>'}', '<'=>'>' }</td>
|
200
|
-
</tr>
|
201
|
-
</table>
|
202
|
-
|
203
|
-
|
204
|
-
<div class="sectiontitle">Public Class methods</div>
|
205
|
-
<div class="method">
|
206
|
-
<div class="title">
|
207
|
-
<a name="M000314"></a><b>interpolate</b>(&str)
|
208
|
-
</div>
|
209
|
-
<div class="description">
|
210
|
-
<p>
|
211
|
-
Interpolate. Provides a means of extenally using Ruby string interpolation
|
212
|
-
mechinism.
|
213
|
-
</p>
|
214
|
-
<pre>
|
215
|
-
try = "hello"
|
216
|
-
str = "\#{try}!!!"
|
217
|
-
String.interpolate{ str } #=> "hello!!!"
|
218
|
-
|
219
|
-
NOTE: The block neccessary in order to get
|
220
|
-
then binding of the caller.
|
221
|
-
</pre>
|
222
|
-
<p>
|
223
|
-
CREDIT: Trans
|
224
|
-
</p>
|
225
|
-
</div>
|
226
|
-
<div class="sourcecode">
|
227
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000314_source')" id="l_M000314_source">+</a> ]</p>
|
228
|
-
<div id="M000314_source" class="dyn-source">
|
229
|
-
<pre>
|
230
|
-
<span class="ruby-comment cmt"># File lib/core/facets/string/interpolate.rb, line 15</span>
|
231
|
-
<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>)
|
232
|
-
<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>
|
233
|
-
<span class="ruby-keyword kw">end</span>
|
234
|
-
</pre>
|
235
|
-
</div>
|
236
|
-
</div>
|
237
|
-
</div>
|
238
|
-
<div class="sectiontitle">Public Instance methods</div>
|
239
|
-
<div class="method">
|
240
|
-
<div class="title">
|
241
|
-
<a name="M000289"></a><b>-</b>(pattern)
|
242
|
-
</div>
|
243
|
-
<div class="description">
|
244
|
-
<p>
|
245
|
-
Removes occurances of a string or regexp.
|
246
|
-
</p>
|
247
|
-
<pre>
|
248
|
-
"HELLO HELLO" - "LL" #=> "HEO HEO"
|
249
|
-
</pre>
|
250
|
-
<p>
|
251
|
-
CREDIT: Benjamin David Oakes
|
252
|
-
</p>
|
253
|
-
</div>
|
254
|
-
<div class="sourcecode">
|
255
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000289_source')" id="l_M000289_source">+</a> ]</p>
|
256
|
-
<div id="M000289_source" class="dyn-source">
|
257
|
-
<pre>
|
258
|
-
<span class="ruby-comment cmt"># File lib/core/facets/string/op_sub.rb, line 9</span>
|
259
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-operator">-</span>(<span class="ruby-identifier">pattern</span>)
|
260
|
-
<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-identifier">pattern</span>, <span class="ruby-value str">''</span>)
|
261
|
-
<span class="ruby-keyword kw">end</span>
|
262
|
-
</pre>
|
263
|
-
</div>
|
264
|
-
</div>
|
265
|
-
</div>
|
266
|
-
<div class="method">
|
267
|
-
<div class="title">
|
268
|
-
<a name="M000329"></a><b>^</b>(aString)
|
269
|
-
</div>
|
270
|
-
<div class="description">
|
271
|
-
<p>
|
272
|
-
Binary XOR of two strings.
|
273
|
-
</p>
|
274
|
-
<pre>
|
275
|
-
puts "\000\000\001\001" ^ "\000\001\000\001"
|
276
|
-
puts "\003\003\003" ^ "\000\001\002"
|
277
|
-
</pre>
|
278
|
-
<p>
|
279
|
-
<em>produces</em>
|
280
|
-
</p>
|
281
|
-
<pre>
|
282
|
-
"\000\001\001\000"
|
283
|
-
"\003\002\001"
|
284
|
-
</pre>
|
285
|
-
</div>
|
286
|
-
<div class="sourcecode">
|
287
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000329_source')" id="l_M000329_source">+</a> ]</p>
|
288
|
-
<div id="M000329_source" class="dyn-source">
|
289
|
-
<pre>
|
290
|
-
<span class="ruby-comment cmt"># File lib/core/facets/string/xor.rb, line 13</span>
|
291
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-operator">^</span>(<span class="ruby-identifier">aString</span>)
|
292
|
-
<span class="ruby-identifier">a</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">unpack</span>(<span class="ruby-value str">'C'</span><span class="ruby-operator">*</span>(<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">length</span>))
|
293
|
-
<span class="ruby-identifier">b</span> = <span class="ruby-identifier">aString</span>.<span class="ruby-identifier">unpack</span>(<span class="ruby-value str">'C'</span><span class="ruby-operator">*</span>(<span class="ruby-identifier">aString</span>.<span class="ruby-identifier">length</span>))
|
294
|
-
<span class="ruby-keyword kw">if</span> (<span class="ruby-identifier">b</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator"><</span> <span class="ruby-identifier">a</span>.<span class="ruby-identifier">length</span>)
|
295
|
-
(<span class="ruby-identifier">a</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">b</span>.<span class="ruby-identifier">length</span>).<span class="ruby-identifier">times</span> { <span class="ruby-identifier">b</span> <span class="ruby-operator"><<</span> <span class="ruby-value">0</span> }
|
296
|
-
<span class="ruby-keyword kw">end</span>
|
297
|
-
<span class="ruby-identifier">xor</span> = <span class="ruby-value str">""</span>
|
298
|
-
<span class="ruby-value">0</span>.<span class="ruby-identifier">upto</span>(<span class="ruby-identifier">a</span>.<span class="ruby-identifier">length</span><span class="ruby-operator">-</span><span class="ruby-value">1</span>) { <span class="ruby-operator">|</span><span class="ruby-identifier">pos</span><span class="ruby-operator">|</span>
|
299
|
-
<span class="ruby-identifier">x</span> = <span class="ruby-identifier">a</span>[<span class="ruby-identifier">pos</span>] <span class="ruby-operator">^</span> <span class="ruby-identifier">b</span>[<span class="ruby-identifier">pos</span>]
|
300
|
-
<span class="ruby-identifier">xor</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">x</span>.<span class="ruby-identifier">chr</span>()
|
301
|
-
}
|
302
|
-
<span class="ruby-keyword kw">return</span>(<span class="ruby-identifier">xor</span>)
|
303
|
-
<span class="ruby-keyword kw">end</span>
|
304
|
-
</pre>
|
305
|
-
</div>
|
306
|
-
</div>
|
307
|
-
</div>
|
308
|
-
<div class="method">
|
309
|
-
<div class="title">
|
310
|
-
<a name="M000283"></a><b>align</b>(direction, n, sep="\n", c=' ')
|
311
|
-
</div>
|
312
|
-
<div class="sourcecode">
|
313
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000283_source')" id="l_M000283_source">+</a> ]</p>
|
314
|
-
<div id="M000283_source" class="dyn-source">
|
315
|
-
<pre>
|
316
|
-
<span class="ruby-comment cmt"># File lib/core/facets/string/align.rb, line 3</span>
|
317
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">align</span>(<span class="ruby-identifier">direction</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>)
|
318
|
-
<span class="ruby-keyword kw">case</span> <span class="ruby-identifier">direction</span>
|
319
|
-
<span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:right</span>
|
320
|
-
<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>)
|
321
|
-
<span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:left</span>
|
322
|
-
<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>)
|
323
|
-
<span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:center</span>
|
324
|
-
<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>)
|
325
|
-
<span class="ruby-keyword kw">else</span>
|
326
|
-
<span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>
|
327
|
-
<span class="ruby-keyword kw">end</span>
|
328
|
-
<span class="ruby-keyword kw">end</span>
|
329
|
-
</pre>
|
330
|
-
</div>
|
331
|
-
</div>
|
332
|
-
</div>
|
333
|
-
<div class="method">
|
334
|
-
<div class="title">
|
335
|
-
<a name="M000286"></a><b>align_center</b>(n, sep="\n", c=' ')
|
336
|
-
</div>
|
337
|
-
<div class="description">
|
338
|
-
<p>
|
339
|
-
Centers each line of a string.
|
340
|
-
</p>
|
341
|
-
<p>
|
342
|
-
The default alignment separation is a new line ("\n"). This can
|
343
|
-
be changed as can be the padding string which defaults to a single space
|
344
|
-
(’ ’).
|
345
|
-
</p>
|
346
|
-
<pre>
|
347
|
-
s = <<-EOS
|
348
|
-
This is a test
|
349
|
-
and
|
350
|
-
so on
|
351
|
-
EOS
|
352
|
-
|
353
|
-
puts s.align_center(14)
|
354
|
-
</pre>
|
355
|
-
<p>
|
356
|
-
<em>produces</em>
|
357
|
-
</p>
|
358
|
-
<pre>
|
359
|
-
This is a test
|
360
|
-
and
|
361
|
-
so on
|
362
|
-
</pre>
|
363
|
-
<p>
|
364
|
-
CREDIT: Trans
|
365
|
-
</p>
|
366
|
-
</div>
|
367
|
-
<div class="sourcecode">
|
368
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000286_source')" id="l_M000286_source">+</a> ]</p>
|
369
|
-
<div id="M000286_source" class="dyn-source">
|
370
|
-
<pre>
|
371
|
-
<span class="ruby-comment cmt"># File lib/core/facets/string/align.rb, line 98</span>
|
372
|
-
<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>)
|
373
|
-
<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>
|
374
|
-
<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>
|
375
|
-
<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>)
|
376
|
-
}
|
377
|
-
<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>)
|
378
|
-
<span class="ruby-keyword kw">end</span>
|
379
|
-
</pre>
|
380
|
-
</div>
|
381
|
-
</div>
|
382
|
-
</div>
|
383
|
-
<div class="method">
|
384
|
-
<div class="title">
|
385
|
-
<a name="M000285"></a><b>align_left</b>(n, sep="\n", c=' ')
|
386
|
-
</div>
|
387
|
-
<div class="description">
|
388
|
-
<p>
|
389
|
-
Align a string to the left.
|
390
|
-
</p>
|
391
|
-
<p>
|
392
|
-
The default alignment separation is a new line ("\n"). This can
|
393
|
-
be changed as can be the padding string which defaults to a single space
|
394
|
-
(’ ’).
|
395
|
-
</p>
|
396
|
-
<pre>
|
397
|
-
s = <<-EOS
|
398
|
-
This is a test
|
399
|
-
and
|
400
|
-
so on
|
401
|
-
EOS
|
402
|
-
|
403
|
-
puts s.align_left(20, "\n", '.')
|
404
|
-
</pre>
|
405
|
-
<p>
|
406
|
-
<em>produces</em>
|
407
|
-
</p>
|
408
|
-
<pre>
|
409
|
-
This is a test......
|
410
|
-
and.................
|
411
|
-
so on...............
|
412
|
-
</pre>
|
413
|
-
<p>
|
414
|
-
CREDIT: Trans
|
415
|
-
</p>
|
416
|
-
</div>
|
417
|
-
<div class="sourcecode">
|
418
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000285_source')" id="l_M000285_source">+</a> ]</p>
|
419
|
-
<div id="M000285_source" class="dyn-source">
|
420
|
-
<pre>
|
421
|
-
<span class="ruby-comment cmt"># File lib/core/facets/string/align.rb, line 68</span>
|
422
|
-
<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>)
|
423
|
-
<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>
|
424
|
-
<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">map</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">line</span><span class="ruby-operator">|</span>
|
425
|
-
<span class="ruby-identifier">line</span>.<span class="ruby-identifier">strip</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>)
|
426
|
-
<span class="ruby-keyword kw">end</span>
|
427
|
-
<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>)
|
428
|
-
<span class="ruby-keyword kw">end</span>
|
429
|
-
</pre>
|
430
|
-
</div>
|
431
|
-
</div>
|
432
|
-
</div>
|
433
|
-
<div class="method">
|
434
|
-
<div class="title">
|
435
|
-
<a name="M000284"></a><b>align_right</b>(n, sep="\n", c=' ')
|
436
|
-
</div>
|
437
|
-
<div class="description">
|
438
|
-
<p>
|
439
|
-
Align a string to the right.
|
440
|
-
</p>
|
441
|
-
<p>
|
442
|
-
The default alignment separation is a new line ("\n"). This can
|
443
|
-
be changed as can be the padding string which defaults to a single space
|
444
|
-
(’ ’).
|
445
|
-
</p>
|
446
|
-
<pre>
|
447
|
-
s = <<-EOS
|
448
|
-
This is a test
|
449
|
-
and
|
450
|
-
so on
|
451
|
-
EOS
|
452
|
-
|
453
|
-
puts s.align_right(14)
|
454
|
-
</pre>
|
455
|
-
<p>
|
456
|
-
<em>produces</em>
|
457
|
-
</p>
|
458
|
-
<pre>
|
459
|
-
This is a test
|
460
|
-
and
|
461
|
-
so on
|
462
|
-
</pre>
|
463
|
-
<p>
|
464
|
-
CREDIT: Trans
|
465
|
-
</p>
|
466
|
-
</div>
|
467
|
-
<div class="sourcecode">
|
468
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000284_source')" id="l_M000284_source">+</a> ]</p>
|
469
|
-
<div id="M000284_source" class="dyn-source">
|
470
|
-
<pre>
|
471
|
-
<span class="ruby-comment cmt"># File lib/core/facets/string/align.rb, line 38</span>
|
472
|
-
<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>)
|
473
|
-
<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>
|
474
|
-
<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">map</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">line</span><span class="ruby-operator">|</span>
|
475
|
-
<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>)
|
476
|
-
<span class="ruby-keyword kw">end</span>
|
477
|
-
<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>)
|
478
|
-
<span class="ruby-keyword kw">end</span>
|
479
|
-
</pre>
|
480
|
-
</div>
|
481
|
-
</div>
|
482
|
-
</div>
|
483
|
-
<div class="method">
|
484
|
-
<div class="title">
|
485
|
-
<a name="M000331"></a><b>blank?</b>()
|
486
|
-
</div>
|
487
|
-
<div class="description">
|
488
|
-
<p>
|
489
|
-
Is this string just whitespace?
|
490
|
-
</p>
|
491
|
-
<pre>
|
492
|
-
"abc".blank? #=> false
|
493
|
-
" ".blank? #=> true
|
494
|
-
</pre>
|
495
|
-
</div>
|
496
|
-
<div class="sourcecode">
|
497
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000331_source')" id="l_M000331_source">+</a> ]</p>
|
498
|
-
<div id="M000331_source" class="dyn-source">
|
499
|
-
<pre>
|
500
|
-
<span class="ruby-comment cmt"># File lib/core/facets/blank.rb, line 50</span>
|
501
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">blank?</span>
|
502
|
-
<span class="ruby-keyword kw">self</span> <span class="ruby-operator">!~</span> <span class="ruby-regexp re">/\S/</span>
|
503
|
-
<span class="ruby-keyword kw">end</span>
|
504
|
-
</pre>
|
505
|
-
</div>
|
506
|
-
</div>
|
507
|
-
</div>
|
508
|
-
<div class="method">
|
509
|
-
<div class="title">
|
510
|
-
<a name="M000317"></a><b>bracket</b>(bra, ket=nil)
|
511
|
-
</div>
|
512
|
-
<div class="description">
|
513
|
-
<p>
|
514
|
-
Return a new string embraced by given brakets. If only one <a
|
515
|
-
href="String.html#M000317">bracket</a> char is given it will be placed on
|
516
|
-
either side.
|
517
|
-
</p>
|
518
|
-
<pre>
|
519
|
-
"wrap me".bracket('{') #=> "{wrap me}"
|
520
|
-
"wrap me".bracket('--','!') #=> "--wrap me!"
|
521
|
-
</pre>
|
522
|
-
<p>
|
523
|
-
CREDIT: Trans
|
524
|
-
</p>
|
525
|
-
</div>
|
526
|
-
<div class="sourcecode">
|
527
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000317_source')" id="l_M000317_source">+</a> ]</p>
|
528
|
-
<div id="M000317_source" class="dyn-source">
|
529
|
-
<pre>
|
530
|
-
<span class="ruby-comment cmt"># File lib/core/facets/string/bracket.rb, line 14</span>
|
531
|
-
<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>)
|
532
|
-
<span class="ruby-comment cmt">#ket = String.bra2ket[$&] if ! ket && /^[\[({<]$/ =~ bra</span>
|
533
|
-
<span class="ruby-identifier">ket</span> = <span class="ruby-constant">BRA2KET</span>[<span class="ruby-identifier">bra</span>] <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">ket</span>
|
534
|
-
<span class="ruby-node">"#{bra}#{self}#{ket ? ket : bra}"</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="M000318"></a><b>bracket!</b>(bra, ket=nil)
|
543
|
-
</div>
|
544
|
-
<div class="description">
|
545
|
-
<p>
|
546
|
-
Inplace version of braket.
|
547
|
-
</p>
|
548
|
-
<p>
|
549
|
-
CREDIT: Trans
|
550
|
-
</p>
|
551
|
-
</div>
|
552
|
-
<div class="sourcecode">
|
553
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000318_source')" id="l_M000318_source">+</a> ]</p>
|
554
|
-
<div id="M000318_source" class="dyn-source">
|
555
|
-
<pre>
|
556
|
-
<span class="ruby-comment cmt"># File lib/core/facets/string/bracket.rb, line 24</span>
|
557
|
-
<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>)
|
558
|
-
<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">replace</span>(<span class="ruby-identifier">bracket</span>(<span class="ruby-identifier">bra</span>, <span class="ruby-identifier">ket</span>))
|
559
|
-
<span class="ruby-keyword kw">end</span>
|
560
|
-
</pre>
|
561
|
-
</div>
|
562
|
-
</div>
|
563
|
-
</div>
|
564
|
-
<div class="method">
|
565
|
-
<div class="title">
|
566
|
-
<a name="M000307"></a><b>bytes</b>()
|
567
|
-
</div>
|
568
|
-
<div class="description">
|
569
|
-
<p>
|
570
|
-
Upacks string into <a href="String.html#M000307">bytes</a>.
|
571
|
-
</p>
|
572
|
-
</div>
|
573
|
-
<div class="sourcecode">
|
574
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000307_source')" id="l_M000307_source">+</a> ]</p>
|
575
|
-
<div id="M000307_source" class="dyn-source">
|
576
|
-
<pre>
|
577
|
-
<span class="ruby-comment cmt"># File lib/core/facets/string/bytes.rb, line 8</span>
|
578
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">bytes</span>
|
579
|
-
<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">unpack</span>(<span class="ruby-value str">'C*'</span>)
|
580
|
-
<span class="ruby-keyword kw">end</span>
|
581
|
-
</pre>
|
582
|
-
</div>
|
583
|
-
</div>
|
584
|
-
</div>
|
585
|
-
<div class="method">
|
586
|
-
<div class="title">
|
587
|
-
<a name="M000278"></a><b>camelcase</b>(upcase_first_letter=true)
|
588
|
-
</div>
|
589
|
-
<div class="description">
|
590
|
-
<p>
|
591
|
-
Converts a string to <a href="String.html#M000278">camelcase</a>.
|
592
|
-
</p>
|
593
|
-
<p>
|
594
|
-
By default <a href="String.html#M000278">camelcase</a> convert to
|
595
|
-
UpperCamelCase, If an argument is set to <tt>false</tt>, then <a
|
596
|
-
href="String.html#M000278">camelcase</a> will produce lowerCamelCase.
|
597
|
-
</p>
|
598
|
-
<p>
|
599
|
-
<tt><a href="String.html#M000278">camelcase</a></tt> also converts
|
600
|
-
’/’ to ’::’ which is useful for converting paths to
|
601
|
-
namespaces.
|
602
|
-
</p>
|
603
|
-
<p>
|
604
|
-
Examples
|
605
|
-
</p>
|
606
|
-
<pre>
|
607
|
-
"camel_case".camelcase #=> "CamelCase"
|
608
|
-
"camel/case".camelcase #=> "Camel::Case"
|
609
|
-
"camel_case".camelcase(false) #=> "camelCase"
|
610
|
-
</pre>
|
611
|
-
</div>
|
612
|
-
<div class="sourcecode">
|
613
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000278_source')" id="l_M000278_source">+</a> ]</p>
|
614
|
-
<div id="M000278_source" class="dyn-source">
|
615
|
-
<pre>
|
616
|
-
<span class="ruby-comment cmt"># File lib/core/facets/string/camelcase.rb, line 16</span>
|
617
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">camelcase</span>(<span class="ruby-identifier">upcase_first_letter</span>=<span class="ruby-keyword kw">true</span>)
|
618
|
-
<span class="ruby-identifier">up</span> = <span class="ruby-identifier">upcase_first_letter</span>
|
619
|
-
<span class="ruby-identifier">str</span> = <span class="ruby-identifier">dup</span>
|
620
|
-
<span class="ruby-identifier">str</span>.<span class="ruby-identifier">gsub!</span>(<span class="ruby-regexp re">/\/(.?)/</span>){ <span class="ruby-node">"::#{$1.upcase}"</span> } <span class="ruby-comment cmt"># NOT SO SURE ABOUT THIS</span>
|
621
|
-
<span class="ruby-identifier">str</span>.<span class="ruby-identifier">gsub!</span>(<span class="ruby-regexp re">/(?:_+|-+)([a-z])/</span>){ <span class="ruby-identifier">$1</span>.<span class="ruby-identifier">upcase</span> }
|
622
|
-
<span class="ruby-identifier">str</span>.<span class="ruby-identifier">gsub!</span>(<span class="ruby-regexp re">/(\A|\s)([a-z])/</span>){ <span class="ruby-identifier">$1</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">$2</span>.<span class="ruby-identifier">upcase</span> } <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">up</span>
|
623
|
-
<span class="ruby-identifier">str</span>
|
624
|
-
<span class="ruby-keyword kw">end</span>
|
625
|
-
</pre>
|
626
|
-
</div>
|
627
|
-
</div>
|
628
|
-
</div>
|
629
|
-
<div class="method">
|
630
|
-
<div class="title">
|
631
|
-
<a name="M000300"></a><b>capitalized?</b>()
|
632
|
-
</div>
|
633
|
-
<div class="description">
|
634
|
-
<p>
|
635
|
-
Return true if the string is capitalized, otherwise false.
|
636
|
-
</p>
|
637
|
-
<pre>
|
638
|
-
"THIS".capitalized? #=> true
|
639
|
-
"This".capitalized? #=> true
|
640
|
-
"this".capitalized? #=> false
|
641
|
-
</pre>
|
642
|
-
<p>
|
643
|
-
CREDIT: Phil Tomson
|
644
|
-
</p>
|
645
|
-
</div>
|
646
|
-
<div class="sourcecode">
|
647
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000300_source')" id="l_M000300_source">+</a> ]</p>
|
648
|
-
<div id="M000300_source" class="dyn-source">
|
649
|
-
<pre>
|
650
|
-
<span class="ruby-comment cmt"># File lib/core/facets/string/capitalized.rb, line 11</span>
|
651
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">capitalized?</span>
|
652
|
-
<span class="ruby-keyword kw">self</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/^[A-Z]/</span>
|
653
|
-
<span class="ruby-keyword kw">end</span>
|
654
|
-
</pre>
|
655
|
-
</div>
|
656
|
-
</div>
|
657
|
-
</div>
|
658
|
-
<div class="method">
|
659
|
-
<div class="title">
|
660
|
-
<a name="M000323"></a><b>chars</b>()
|
661
|
-
</div>
|
662
|
-
<div class="description">
|
663
|
-
<p>
|
664
|
-
Returns an array of characters.
|
665
|
-
</p>
|
666
|
-
<pre>
|
667
|
-
"abc".chars #=> ["a","b","c"]
|
668
|
-
</pre>
|
669
|
-
</div>
|
670
|
-
<div class="sourcecode">
|
671
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000323_source')" id="l_M000323_source">+</a> ]</p>
|
672
|
-
<div id="M000323_source" class="dyn-source">
|
673
|
-
<pre>
|
674
|
-
<span class="ruby-comment cmt"># File lib/core/facets/string/chars.rb, line 9</span>
|
675
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">chars</span>
|
676
|
-
<span class="ruby-identifier">split</span>(<span class="ruby-regexp re">//</span>)
|
677
|
-
<span class="ruby-keyword kw">end</span>
|
678
|
-
</pre>
|
679
|
-
</div>
|
680
|
-
</div>
|
681
|
-
</div>
|
682
|
-
<div class="method">
|
683
|
-
<div class="title">
|
684
|
-
<a name="M000315"></a><b>cleave</b>(threshold=nil, len=nil)
|
685
|
-
</div>
|
686
|
-
<div class="description">
|
687
|
-
<p>
|
688
|
-
Cleave a string. Break a string in two parts at the nearest whitespace.
|
689
|
-
</p>
|
690
|
-
<p>
|
691
|
-
CREDIT: Trans
|
692
|
-
</p>
|
693
|
-
</div>
|
694
|
-
<div class="sourcecode">
|
695
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000315_source')" id="l_M000315_source">+</a> ]</p>
|
696
|
-
<div id="M000315_source" class="dyn-source">
|
697
|
-
<pre>
|
698
|
-
<span class="ruby-comment cmt"># File lib/core/facets/string/cleave.rb, line 8</span>
|
699
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">cleave</span>(<span class="ruby-identifier">threshold</span>=<span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">len</span>=<span class="ruby-keyword kw">nil</span>)
|
700
|
-
<span class="ruby-identifier">l</span> = (<span class="ruby-identifier">len</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">size</span> <span class="ruby-operator">/</span> <span class="ruby-value">2</span>)
|
701
|
-
<span class="ruby-identifier">t</span> = <span class="ruby-identifier">threshold</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">size</span>
|
702
|
-
|
703
|
-
<span class="ruby-identifier">h1</span> = <span class="ruby-keyword kw">self</span>[<span class="ruby-value">0</span><span class="ruby-operator">...</span><span class="ruby-identifier">l</span>]
|
704
|
-
<span class="ruby-identifier">h2</span> = <span class="ruby-keyword kw">self</span>[<span class="ruby-identifier">l</span><span class="ruby-operator">..</span><span class="ruby-value">-1</span>]
|
705
|
-
|
706
|
-
<span class="ruby-identifier">i1</span> = <span class="ruby-identifier">h1</span>.<span class="ruby-identifier">rindex</span>(<span class="ruby-regexp re">/\s/</span>) <span class="ruby-operator">||</span> <span class="ruby-value">0</span>
|
707
|
-
<span class="ruby-identifier">d1</span> = (<span class="ruby-identifier">i1</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">l</span>).<span class="ruby-identifier">abs</span>
|
708
|
-
|
709
|
-
<span class="ruby-identifier">d2</span> = <span class="ruby-identifier">h2</span>.<span class="ruby-identifier">index</span>(<span class="ruby-regexp re">/\s/</span>) <span class="ruby-operator">||</span> <span class="ruby-identifier">l</span>
|
710
|
-
<span class="ruby-identifier">i2</span> = <span class="ruby-identifier">d2</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">l</span>
|
711
|
-
|
712
|
-
<span class="ruby-identifier">d1</span> = (<span class="ruby-identifier">i1</span><span class="ruby-operator">-</span><span class="ruby-identifier">l</span>).<span class="ruby-identifier">abs</span>
|
713
|
-
<span class="ruby-identifier">d2</span> = (<span class="ruby-identifier">i2</span><span class="ruby-operator">-</span><span class="ruby-identifier">l</span>).<span class="ruby-identifier">abs</span>
|
714
|
-
|
715
|
-
<span class="ruby-keyword kw">if</span> [<span class="ruby-identifier">d1</span>, <span class="ruby-identifier">d2</span>].<span class="ruby-identifier">min</span> <span class="ruby-operator">></span> <span class="ruby-identifier">t</span>
|
716
|
-
<span class="ruby-identifier">i</span> = <span class="ruby-identifier">t</span>
|
717
|
-
<span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">d1</span> <span class="ruby-operator"><</span> <span class="ruby-identifier">d2</span>
|
718
|
-
<span class="ruby-identifier">i</span> = <span class="ruby-identifier">i1</span>
|
719
|
-
<span class="ruby-keyword kw">else</span>
|
720
|
-
<span class="ruby-identifier">i</span> = <span class="ruby-identifier">i2</span>
|
721
|
-
<span class="ruby-keyword kw">end</span>
|
722
|
-
|
723
|
-
<span class="ruby-comment cmt">#dup.insert(l, "\n").gsub(/^\s+|\s+$/, '')</span>
|
724
|
-
<span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">self</span>[<span class="ruby-value">0</span><span class="ruby-operator">..</span><span class="ruby-identifier">i</span>].<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">strip</span>, <span class="ruby-keyword kw">self</span>[<span class="ruby-identifier">i</span><span class="ruby-operator">+</span><span class="ruby-value">1</span><span class="ruby-operator">..</span><span class="ruby-value">-1</span>].<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">strip</span>
|
725
|
-
<span class="ruby-keyword kw">end</span>
|
726
|
-
</pre>
|
727
|
-
</div>
|
728
|
-
</div>
|
729
|
-
</div>
|
730
|
-
<div class="method">
|
731
|
-
<div class="title">
|
732
|
-
<a name="M000270"></a><b>cmp</b>(other)
|
733
|
-
</div>
|
734
|
-
<div class="description">
|
735
|
-
<p>
|
736
|
-
Compare method that takes length into account. Unlike #<=>, this is
|
737
|
-
compatible with succ.
|
738
|
-
</p>
|
739
|
-
<pre>
|
740
|
-
"abc".cmp("abc") #=> 0
|
741
|
-
"abcd".cmp("abc") #=> 1
|
742
|
-
"abc".cmp("abcd") #=> -1
|
743
|
-
"xyz".cmp("abc") #=> 1
|
744
|
-
</pre>
|
745
|
-
<p>
|
746
|
-
CREDIT: Peter Vanbroekhoven
|
747
|
-
</p>
|
748
|
-
</div>
|
749
|
-
<div class="sourcecode">
|
750
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000270_source')" id="l_M000270_source">+</a> ]</p>
|
751
|
-
<div id="M000270_source" class="dyn-source">
|
752
|
-
<pre>
|
753
|
-
<span class="ruby-comment cmt"># File lib/core/facets/comparable/cmp.rb, line 31</span>
|
754
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">cmp</span>(<span class="ruby-identifier">other</span>)
|
755
|
-
<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>
|
756
|
-
<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>
|
757
|
-
<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>
|
758
|
-
<span class="ruby-keyword kw">end</span>
|
759
|
-
</pre>
|
760
|
-
</div>
|
761
|
-
</div>
|
762
|
-
</div>
|
763
|
-
<div class="method">
|
764
|
-
<div class="title">
|
765
|
-
<a name="M000290"></a><b>compress_lines</b>(spaced = true)
|
766
|
-
</div>
|
767
|
-
<div class="description">
|
768
|
-
<p>
|
769
|
-
Matches any whitespace (including newline) and replaces with a single space
|
770
|
-
</p>
|
771
|
-
<p>
|
772
|
-
@example
|
773
|
-
</p>
|
774
|
-
<pre>
|
775
|
-
<<-QUERY.compress_lines
|
776
|
-
SELECT name
|
777
|
-
FROM users
|
778
|
-
QUERY
|
779
|
-
=> "SELECT name FROM users"
|
780
|
-
</pre>
|
781
|
-
</div>
|
782
|
-
<div class="sourcecode">
|
783
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000290_source')" id="l_M000290_source">+</a> ]</p>
|
784
|
-
<div id="M000290_source" class="dyn-source">
|
785
|
-
<pre>
|
786
|
-
<span class="ruby-comment cmt"># File lib/core/facets/string/compress_lines.rb, line 12</span>
|
787
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">compress_lines</span>(<span class="ruby-identifier">spaced</span> = <span class="ruby-keyword kw">true</span>)
|
788
|
-
<span class="ruby-identifier">split</span>(<span class="ruby-identifier">$/</span>).<span class="ruby-identifier">map</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">line</span><span class="ruby-operator">|</span> <span class="ruby-identifier">line</span>.<span class="ruby-identifier">strip</span> }.<span class="ruby-identifier">join</span>(<span class="ruby-identifier">spaced</span> <span class="ruby-value">? </span><span class="ruby-value str">' '</span> <span class="ruby-operator">:</span> <span class="ruby-value str">''</span>)
|
789
|
-
<span class="ruby-keyword kw">end</span>
|
790
|
-
</pre>
|
791
|
-
</div>
|
792
|
-
</div>
|
793
|
-
</div>
|
794
|
-
<div class="method">
|
795
|
-
<div class="title">
|
796
|
-
<a name="M000322"></a><b>dequote</b>()
|
797
|
-
</div>
|
798
|
-
<div class="description">
|
799
|
-
<p>
|
800
|
-
Remove quotes from string.
|
801
|
-
</p>
|
802
|
-
<pre>
|
803
|
-
"'hi'".dequite #=> "hi"
|
804
|
-
</pre>
|
805
|
-
<p>
|
806
|
-
CREDIT: Trans
|
807
|
-
</p>
|
808
|
-
</div>
|
809
|
-
<div class="sourcecode">
|
810
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000322_source')" id="l_M000322_source">+</a> ]</p>
|
811
|
-
<div id="M000322_source" class="dyn-source">
|
812
|
-
<pre>
|
813
|
-
<span class="ruby-comment cmt"># File lib/core/facets/string/bracket.rb, line 88</span>
|
814
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">dequote</span>
|
815
|
-
<span class="ruby-identifier">s</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">dup</span>
|
816
|
-
|
817
|
-
<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>]
|
818
|
-
<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>
|
819
|
-
<span class="ruby-identifier">s</span>[<span class="ruby-value">0</span>] = <span class="ruby-value str">''</span>
|
820
|
-
<span class="ruby-keyword kw">end</span>
|
821
|
-
|
822
|
-
<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>]
|
823
|
-
<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>
|
824
|
-
<span class="ruby-identifier">s</span>[<span class="ruby-value">-1</span>] = <span class="ruby-value str">''</span>
|
825
|
-
<span class="ruby-keyword kw">end</span>
|
826
|
-
|
827
|
-
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">s</span>
|
828
|
-
<span class="ruby-keyword kw">end</span>
|
829
|
-
</pre>
|
830
|
-
</div>
|
831
|
-
</div>
|
832
|
-
</div>
|
833
|
-
<div class="method">
|
834
|
-
<div class="title">
|
835
|
-
<a name="M000297"></a><b>divide</b>( re )
|
836
|
-
</div>
|
837
|
-
<div class="description">
|
838
|
-
<p>
|
839
|
-
Breaks a string up into an array based on a regular expression. Similar to
|
840
|
-
scan, but includes the matches.
|
841
|
-
</p>
|
842
|
-
<pre>
|
843
|
-
s = "<p>This<b>is</b>a test.</p>"
|
844
|
-
s.divide( /\<.*?\>/ )
|
845
|
-
</pre>
|
846
|
-
<p>
|
847
|
-
<em>produces</em>
|
848
|
-
</p>
|
849
|
-
<pre>
|
850
|
-
["<p>This", "<b>is", "</b>a test.", "</p>"]
|
851
|
-
</pre>
|
852
|
-
<p>
|
853
|
-
CREDIT: Trans
|
854
|
-
</p>
|
855
|
-
</div>
|
856
|
-
<div class="sourcecode">
|
857
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000297_source')" id="l_M000297_source">+</a> ]</p>
|
858
|
-
<div id="M000297_source" class="dyn-source">
|
859
|
-
<pre>
|
860
|
-
<span class="ruby-comment cmt"># File lib/core/facets/string/divide.rb, line 15</span>
|
861
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">divide</span>( <span class="ruby-identifier">re</span> )
|
862
|
-
<span class="ruby-identifier">re2</span> = <span class="ruby-node">/#{re}.*?(?=#{re}|\Z)/</span>
|
863
|
-
<span class="ruby-identifier">scan</span>(<span class="ruby-identifier">re2</span>) <span class="ruby-comment cmt">#{re}(?=#{re})/)</span>
|
864
|
-
<span class="ruby-keyword kw">end</span>
|
865
|
-
</pre>
|
866
|
-
</div>
|
867
|
-
</div>
|
868
|
-
</div>
|
869
|
-
<div class="method">
|
870
|
-
<div class="title">
|
871
|
-
<a name="M000301"></a><b>downcase?</b>()
|
872
|
-
</div>
|
873
|
-
<div class="description">
|
874
|
-
<p>
|
875
|
-
Return true if the string is lowercase (downcase), otherwise false.
|
876
|
-
</p>
|
877
|
-
<pre>
|
878
|
-
"THIS".downcase? #=> false
|
879
|
-
"This".downcase? #=> false
|
880
|
-
"this".downcase? #=> true
|
881
|
-
</pre>
|
882
|
-
<p>
|
883
|
-
CREDIT: Phil Tomson
|
884
|
-
</p>
|
885
|
-
</div>
|
886
|
-
<div class="sourcecode">
|
887
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000301_source')" id="l_M000301_source">+</a> ]</p>
|
888
|
-
<div id="M000301_source" class="dyn-source">
|
889
|
-
<pre>
|
890
|
-
<span class="ruby-comment cmt"># File lib/core/facets/string/capitalized.rb, line 23</span>
|
891
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">downcase?</span>
|
892
|
-
<span class="ruby-identifier">downcase</span> <span class="ruby-operator">==</span> <span class="ruby-keyword kw">self</span>
|
893
|
-
<span class="ruby-keyword kw">end</span>
|
894
|
-
</pre>
|
895
|
-
</div>
|
896
|
-
</div>
|
897
|
-
</div>
|
898
|
-
<div class="method">
|
899
|
-
<div class="title">
|
900
|
-
<a name="M000296"></a><b>each_char</b>() {|scanner.scan(char || break)| ...}
|
901
|
-
</div>
|
902
|
-
<div class="description">
|
903
|
-
<p>
|
904
|
-
Yields a single-character string for each character in the string. When
|
905
|
-
$KCODE = ‘UTF8’, multi-byte characters are yielded
|
906
|
-
appropriately.
|
907
|
-
</p>
|
908
|
-
</div>
|
909
|
-
<div class="sourcecode">
|
910
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000296_source')" id="l_M000296_source">+</a> ]</p>
|
911
|
-
<div id="M000296_source" class="dyn-source">
|
912
|
-
<pre>
|
913
|
-
<span class="ruby-comment cmt"># File lib/core/facets/string/each_char.rb, line 22</span>
|
914
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">each_char</span>
|
915
|
-
<span class="ruby-identifier">scanner</span>, <span class="ruby-identifier">char</span> = <span class="ruby-constant">StringScanner</span>.<span class="ruby-identifier">new</span>(<span class="ruby-keyword kw">self</span>), <span class="ruby-regexp re">/./</span><span class="ruby-identifier">mu</span>
|
916
|
-
<span class="ruby-identifier">loop</span> { <span class="ruby-keyword kw">yield</span>(<span class="ruby-identifier">scanner</span>.<span class="ruby-identifier">scan</span>(<span class="ruby-identifier">char</span>) <span class="ruby-operator">||</span> <span class="ruby-keyword kw">break</span>) }
|
917
|
-
<span class="ruby-keyword kw">end</span>
|
918
|
-
</pre>
|
919
|
-
</div>
|
920
|
-
</div>
|
921
|
-
</div>
|
922
|
-
<div class="method">
|
923
|
-
<div class="title">
|
924
|
-
<a name="M000330"></a><b>each_word</b>(&block)
|
925
|
-
</div>
|
926
|
-
<div class="description">
|
927
|
-
<p>
|
928
|
-
Iterate through each word of a string.
|
929
|
-
</p>
|
930
|
-
<pre>
|
931
|
-
"a string".each_word { |word, range| ... }
|
932
|
-
</pre>
|
933
|
-
</div>
|
934
|
-
<div class="sourcecode">
|
935
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000330_source')" id="l_M000330_source">+</a> ]</p>
|
936
|
-
<div id="M000330_source" class="dyn-source">
|
937
|
-
<pre>
|
938
|
-
<span class="ruby-comment cmt"># File lib/core/facets/string/each_word.rb, line 9</span>
|
939
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">each_word</span>(<span class="ruby-operator">&</span><span class="ruby-identifier">block</span>)
|
940
|
-
<span class="ruby-identifier">words</span>.<span class="ruby-identifier">each</span>(<span class="ruby-operator">&</span><span class="ruby-identifier">block</span>)
|
941
|
-
<span class="ruby-keyword kw">end</span>
|
942
|
-
</pre>
|
943
|
-
</div>
|
944
|
-
</div>
|
945
|
-
</div>
|
946
|
-
<div class="method">
|
947
|
-
<div class="title">
|
948
|
-
<a name="M000277"></a><b>end_with?</b>(suffix)
|
949
|
-
</div>
|
950
|
-
<div class="description">
|
951
|
-
<p>
|
952
|
-
Does a string end with the given suffix?
|
953
|
-
</p>
|
954
|
-
<pre>
|
955
|
-
"hello".ends_with?("lo") #=> true
|
956
|
-
"hello".ends_with?("to") #=> false
|
957
|
-
</pre>
|
958
|
-
<p>
|
959
|
-
CREDIT: Lucas Carlson, Blaine Cook
|
960
|
-
</p>
|
961
|
-
</div>
|
962
|
-
<div class="sourcecode">
|
963
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000277_source')" id="l_M000277_source">+</a> ]</p>
|
964
|
-
<div id="M000277_source" class="dyn-source">
|
965
|
-
<pre>
|
966
|
-
<span class="ruby-comment cmt"># File lib/core/facets/string/start_with.rb, line 23</span>
|
967
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">end_with?</span>(<span class="ruby-identifier">suffix</span>)
|
968
|
-
<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">rindex</span>(<span class="ruby-identifier">suffix</span>) <span class="ruby-operator">==</span> <span class="ruby-identifier">size</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">suffix</span>.<span class="ruby-identifier">size</span>
|
969
|
-
<span class="ruby-keyword kw">end</span>
|
970
|
-
</pre>
|
971
|
-
</div>
|
972
|
-
</div>
|
973
|
-
</div>
|
974
|
-
<div class="method">
|
975
|
-
<div class="title">
|
976
|
-
<a name="M000303"></a><b>expand_tab</b>(n=8)
|
977
|
-
</div>
|
978
|
-
<div class="description">
|
979
|
-
<p>
|
980
|
-
Expands tabs to <tt>n</tt> spaces. Non-destructive. If <tt>n</tt> is 0,
|
981
|
-
then tabs are simply removed. Raises an exception if <tt>n</tt> is
|
982
|
-
negative.
|
983
|
-
</p>
|
984
|
-
<pre>
|
985
|
-
"\t\tHey".expand_tab(2) #=> " Hey"
|
986
|
-
</pre>
|
987
|
-
<p>
|
988
|
-
Thanks to GGaramuno for a more efficient algorithm. Very nice.
|
989
|
-
</p>
|
990
|
-
<p>
|
991
|
-
CREDIT: Gavin Sinclair, Noah Gibbs, GGaramuno
|
992
|
-
</p>
|
993
|
-
</div>
|
994
|
-
<div class="aka">
|
995
|
-
This method is also aliased as
|
996
|
-
<a href="String.html#M000304">expand_tabs</a>
|
997
|
-
</div>
|
998
|
-
<div class="sourcecode">
|
999
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000303_source')" id="l_M000303_source">+</a> ]</p>
|
1000
|
-
<div id="M000303_source" class="dyn-source">
|
1001
|
-
<pre>
|
1002
|
-
<span class="ruby-comment cmt"># File lib/core/facets/string/expand_tab.rb, line 13</span>
|
1003
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">expand_tab</span>(<span class="ruby-identifier">n</span>=<span class="ruby-value">8</span>)
|
1004
|
-
<span class="ruby-identifier">n</span> = <span class="ruby-identifier">n</span>.<span class="ruby-identifier">to_int</span>
|
1005
|
-
<span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-value str">"n must be >= 0"</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">n</span> <span class="ruby-operator"><</span> <span class="ruby-value">0</span>
|
1006
|
-
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/\t/</span>, <span class="ruby-value str">""</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">n</span> <span class="ruby-operator">==</span> <span class="ruby-value">0</span>
|
1007
|
-
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/\t/</span>, <span class="ruby-value str">" "</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">n</span> <span class="ruby-operator">==</span> <span class="ruby-value">1</span>
|
1008
|
-
<span class="ruby-identifier">str</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">dup</span>
|
1009
|
-
<span class="ruby-keyword kw">while</span>
|
1010
|
-
<span class="ruby-identifier">str</span>.<span class="ruby-identifier">gsub!</span>(<span class="ruby-regexp re">/^([^\t\n]*)(\t+)/</span>) { <span class="ruby-operator">|</span><span class="ruby-identifier">f</span><span class="ruby-operator">|</span>
|
1011
|
-
<span class="ruby-identifier">val</span> = ( <span class="ruby-identifier">n</span> <span class="ruby-operator">*</span> <span class="ruby-identifier">$2</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">-</span> (<span class="ruby-identifier">$1</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">%</span> <span class="ruby-identifier">n</span>) )
|
1012
|
-
<span class="ruby-identifier">$1</span> <span class="ruby-operator"><<</span> (<span class="ruby-value str">' '</span> <span class="ruby-operator">*</span> <span class="ruby-identifier">val</span>)
|
1013
|
-
}
|
1014
|
-
<span class="ruby-keyword kw">end</span>
|
1015
|
-
<span class="ruby-identifier">str</span>
|
1016
|
-
<span class="ruby-keyword kw">end</span>
|
1017
|
-
</pre>
|
1018
|
-
</div>
|
1019
|
-
</div>
|
1020
|
-
</div>
|
1021
|
-
<div class="method">
|
1022
|
-
<div class="title">
|
1023
|
-
<a name="M000304"></a><b>expand_tabs</b>(n=8)
|
1024
|
-
</div>
|
1025
|
-
<div class="description">
|
1026
|
-
<p>
|
1027
|
-
Alias for <a href="String.html#M000303">expand_tab</a>
|
1028
|
-
</p>
|
1029
|
-
</div>
|
1030
|
-
</div>
|
1031
|
-
<div class="method">
|
1032
|
-
<div class="title">
|
1033
|
-
<a name="M000272"></a><b>file</b>()
|
1034
|
-
</div>
|
1035
|
-
<div class="description">
|
1036
|
-
<p>
|
1037
|
-
Use fluent notation for making <a href="String.html#M000272">file</a>
|
1038
|
-
directives.
|
1039
|
-
</p>
|
1040
|
-
<pre>
|
1041
|
-
'~/trans/Desktop/notes.txt'.file.mtime
|
1042
|
-
</pre>
|
1043
|
-
</div>
|
1044
|
-
<div class="sourcecode">
|
1045
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000272_source')" id="l_M000272_source">+</a> ]</p>
|
1046
|
-
<div id="M000272_source" class="dyn-source">
|
1047
|
-
<pre>
|
1048
|
-
<span class="ruby-comment cmt"># File lib/core/facets/string/file.rb, line 9</span>
|
1049
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">file</span>
|
1050
|
-
<span class="ruby-identifier">f</span> = <span class="ruby-keyword kw">self</span>
|
1051
|
-
<span class="ruby-constant">Functor</span>.<span class="ruby-identifier">new</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">op</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">a</span><span class="ruby-operator">|</span>
|
1052
|
-
<span class="ruby-constant">File</span>.<span class="ruby-identifier">send</span>(<span class="ruby-identifier">op</span>, <span class="ruby-identifier">f</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">a</span>)
|
1053
|
-
<span class="ruby-keyword kw">end</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="M000275"></a><b>fold</b>(ignore_indented=false)
|
1062
|
-
</div>
|
1063
|
-
<div class="description">
|
1064
|
-
<p>
|
1065
|
-
Returns a new string with all new <a href="String.html#M000279">lines</a>
|
1066
|
-
removed from adjacent <a href="String.html#M000279">lines</a> of text.
|
1067
|
-
</p>
|
1068
|
-
<pre>
|
1069
|
-
s = "This is\na test.\n\nIt clumps\nlines of text."
|
1070
|
-
s.fold
|
1071
|
-
</pre>
|
1072
|
-
<p>
|
1073
|
-
<em>produces</em>
|
1074
|
-
</p>
|
1075
|
-
<pre>
|
1076
|
-
"This is a test.\n\nIt clumps lines of text. "
|
1077
|
-
</pre>
|
1078
|
-
<p>
|
1079
|
-
One arguable flaw with this, that might need a fix: if the given string
|
1080
|
-
ends in a newline, it is replaced with a single space.
|
1081
|
-
</p>
|
1082
|
-
<p>
|
1083
|
-
CREDIT: Trans
|
1084
|
-
</p>
|
1085
|
-
</div>
|
1086
|
-
<div class="sourcecode">
|
1087
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000275_source')" id="l_M000275_source">+</a> ]</p>
|
1088
|
-
<div id="M000275_source" class="dyn-source">
|
1089
|
-
<pre>
|
1090
|
-
<span class="ruby-comment cmt"># File lib/core/facets/string/fold.rb, line 19</span>
|
1091
|
-
<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>)
|
1092
|
-
<span class="ruby-identifier">ns</span> = <span class="ruby-value str">''</span>
|
1093
|
-
<span class="ruby-identifier">i</span> = <span class="ruby-value">0</span>
|
1094
|
-
<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>
|
1095
|
-
<span class="ruby-identifier">b</span> = <span class="ruby-identifier">$~</span>.<span class="ruby-identifier">begin</span>(<span class="ruby-value">1</span>)
|
1096
|
-
<span class="ruby-identifier">e</span> = <span class="ruby-identifier">$~</span>.<span class="ruby-identifier">end</span>(<span class="ruby-value">1</span>)
|
1097
|
-
<span class="ruby-identifier">nl</span> = <span class="ruby-identifier">$&</span>
|
1098
|
-
<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>)
|
1099
|
-
<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>
|
1100
|
-
<span class="ruby-identifier">ns</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">tx</span>
|
1101
|
-
<span class="ruby-keyword kw">else</span>
|
1102
|
-
<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>)
|
1103
|
-
<span class="ruby-keyword kw">end</span>
|
1104
|
-
<span class="ruby-identifier">ns</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">nl</span>
|
1105
|
-
<span class="ruby-identifier">i</span> = <span class="ruby-identifier">e</span>
|
1106
|
-
<span class="ruby-keyword kw">end</span>
|
1107
|
-
<span class="ruby-identifier">ns</span>
|
1108
|
-
<span class="ruby-keyword kw">end</span>
|
1109
|
-
</pre>
|
1110
|
-
</div>
|
1111
|
-
</div>
|
1112
|
-
</div>
|
1113
|
-
<div class="method">
|
1114
|
-
<div class="title">
|
1115
|
-
<a name="M000309"></a><b>indent</b>(n)
|
1116
|
-
</div>
|
1117
|
-
<div class="description">
|
1118
|
-
<p>
|
1119
|
-
Indent left or right by n spaces. (This used to be called <a
|
1120
|
-
href="String.html#M000287">tab</a> and aliased as <a
|
1121
|
-
href="String.html#M000309">indent</a>.)
|
1122
|
-
</p>
|
1123
|
-
<p>
|
1124
|
-
CREDIT: Gavin Sinclair, Trans
|
1125
|
-
</p>
|
1126
|
-
</div>
|
1127
|
-
<div class="sourcecode">
|
1128
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000309_source')" id="l_M000309_source">+</a> ]</p>
|
1129
|
-
<div id="M000309_source" class="dyn-source">
|
1130
|
-
<pre>
|
1131
|
-
<span class="ruby-comment cmt"># File lib/core/facets/string/indent.rb, line 8</span>
|
1132
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">indent</span>(<span class="ruby-identifier">n</span>)
|
1133
|
-
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">n</span> <span class="ruby-operator">>=</span> <span class="ruby-value">0</span>
|
1134
|
-
<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>)
|
1135
|
-
<span class="ruby-keyword kw">else</span>
|
1136
|
-
<span class="ruby-identifier">gsub</span>(<span class="ruby-node">/^ {0,#{-n}}/</span>, <span class="ruby-value str">""</span>)
|
1137
|
-
<span class="ruby-keyword kw">end</span>
|
1138
|
-
<span class="ruby-keyword kw">end</span>
|
1139
|
-
</pre>
|
1140
|
-
</div>
|
1141
|
-
</div>
|
1142
|
-
</div>
|
1143
|
-
<div class="method">
|
1144
|
-
<div class="title">
|
1145
|
-
<a name="M000294"></a><b>index_all</b>(s, reuse=false)
|
1146
|
-
</div>
|
1147
|
-
<div class="description">
|
1148
|
-
<p>
|
1149
|
-
Like index but returns an array of all index locations. The reuse flag
|
1150
|
-
allows the trailing portion of a match to be reused for subsquent matches.
|
1151
|
-
</p>
|
1152
|
-
<pre>
|
1153
|
-
"abcabcabc".index_all('a') #=> [0,3,6]
|
1154
|
-
|
1155
|
-
"bbb".index_all('bb', false) #=> [0]
|
1156
|
-
"bbb".index_all('bb', true) #=> [0,1]
|
1157
|
-
</pre>
|
1158
|
-
<p>
|
1159
|
-
TODO: Culd probably be defined for <a href="Indexable.html">Indexable</a>
|
1160
|
-
in general too.
|
1161
|
-
</p>
|
1162
|
-
</div>
|
1163
|
-
<div class="sourcecode">
|
1164
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000294_source')" id="l_M000294_source">+</a> ]</p>
|
1165
|
-
<div id="M000294_source" class="dyn-source">
|
1166
|
-
<pre>
|
1167
|
-
<span class="ruby-comment cmt"># File lib/core/facets/string/range.rb, line 66</span>
|
1168
|
-
<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>)
|
1169
|
-
<span class="ruby-identifier">s</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">s</span>)) <span class="ruby-keyword kw">unless</span> <span class="ruby-constant">Regexp</span><span class="ruby-operator">===</span><span class="ruby-identifier">s</span>
|
1170
|
-
<span class="ruby-identifier">ia</span> = []; <span class="ruby-identifier">i</span> = <span class="ruby-value">0</span>
|
1171
|
-
<span class="ruby-keyword kw">while</span> (<span class="ruby-identifier">i</span> = <span class="ruby-identifier">index</span>(<span class="ruby-identifier">s</span>,<span class="ruby-identifier">i</span>))
|
1172
|
-
<span class="ruby-identifier">ia</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">i</span>
|
1173
|
-
<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-value">0</span>].<span class="ruby-identifier">size</span>)
|
1174
|
-
<span class="ruby-keyword kw">end</span>
|
1175
|
-
<span class="ruby-identifier">ia</span>
|
1176
|
-
<span class="ruby-keyword kw">end</span>
|
1177
|
-
</pre>
|
1178
|
-
</div>
|
1179
|
-
</div>
|
1180
|
-
</div>
|
1181
|
-
<div class="method">
|
1182
|
-
<div class="title">
|
1183
|
-
<a name="M000324"></a><b>lchomp</b>(match)
|
1184
|
-
</div>
|
1185
|
-
<div class="description">
|
1186
|
-
<p>
|
1187
|
-
Left chomp.
|
1188
|
-
</p>
|
1189
|
-
<pre>
|
1190
|
-
"help".lchomp("h") #=> "elp"
|
1191
|
-
"help".lchomp("k") #=> "help"
|
1192
|
-
</pre>
|
1193
|
-
<p>
|
1194
|
-
CREDIT: Trans
|
1195
|
-
</p>
|
1196
|
-
</div>
|
1197
|
-
<div class="sourcecode">
|
1198
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000324_source')" id="l_M000324_source">+</a> ]</p>
|
1199
|
-
<div id="M000324_source" class="dyn-source">
|
1200
|
-
<pre>
|
1201
|
-
<span class="ruby-comment cmt"># File lib/core/facets/string/chomp.rb, line 10</span>
|
1202
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">lchomp</span>(<span class="ruby-identifier">match</span>)
|
1203
|
-
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">index</span>(<span class="ruby-identifier">match</span>) <span class="ruby-operator">==</span> <span class="ruby-value">0</span>
|
1204
|
-
<span class="ruby-keyword kw">self</span>[<span class="ruby-identifier">match</span>.<span class="ruby-identifier">size</span><span class="ruby-operator">..</span><span class="ruby-value">-1</span>]
|
1205
|
-
<span class="ruby-keyword kw">else</span>
|
1206
|
-
<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">dup</span>
|
1207
|
-
<span class="ruby-keyword kw">end</span>
|
1208
|
-
<span class="ruby-keyword kw">end</span>
|
1209
|
-
</pre>
|
1210
|
-
</div>
|
1211
|
-
</div>
|
1212
|
-
</div>
|
1213
|
-
<div class="method">
|
1214
|
-
<div class="title">
|
1215
|
-
<a name="M000325"></a><b>lchomp!</b>(match)
|
1216
|
-
</div>
|
1217
|
-
<div class="description">
|
1218
|
-
<p>
|
1219
|
-
In-place left chomp.
|
1220
|
-
</p>
|
1221
|
-
<pre>
|
1222
|
-
"help".lchomp("h") #=> "elp"
|
1223
|
-
"help".lchomp("k") #=> "help"
|
1224
|
-
</pre>
|
1225
|
-
<p>
|
1226
|
-
CREDIT: Trans
|
1227
|
-
</p>
|
1228
|
-
</div>
|
1229
|
-
<div class="sourcecode">
|
1230
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000325_source')" id="l_M000325_source">+</a> ]</p>
|
1231
|
-
<div id="M000325_source" class="dyn-source">
|
1232
|
-
<pre>
|
1233
|
-
<span class="ruby-comment cmt"># File lib/core/facets/string/chomp.rb, line 25</span>
|
1234
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">lchomp!</span>(<span class="ruby-identifier">match</span>)
|
1235
|
-
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">index</span>(<span class="ruby-identifier">match</span>) <span class="ruby-operator">==</span> <span class="ruby-value">0</span>
|
1236
|
-
<span class="ruby-keyword kw">self</span>[<span class="ruby-value">0</span><span class="ruby-operator">...</span><span class="ruby-identifier">match</span>.<span class="ruby-identifier">size</span>] = <span class="ruby-value str">''</span>
|
1237
|
-
<span class="ruby-keyword kw">self</span>
|
1238
|
-
<span class="ruby-keyword kw">end</span>
|
1239
|
-
<span class="ruby-keyword kw">end</span>
|
1240
|
-
</pre>
|
1241
|
-
</div>
|
1242
|
-
</div>
|
1243
|
-
</div>
|
1244
|
-
<div class="method">
|
1245
|
-
<div class="title">
|
1246
|
-
<a name="M000316"></a><b>line_wrap</b>(width, tabs=4)
|
1247
|
-
</div>
|
1248
|
-
<div class="description">
|
1249
|
-
<p>
|
1250
|
-
Line wrap at width.
|
1251
|
-
</p>
|
1252
|
-
<pre>
|
1253
|
-
puts "1234567890".line_wrap(5)
|
1254
|
-
</pre>
|
1255
|
-
<p>
|
1256
|
-
<em>produces</em>
|
1257
|
-
</p>
|
1258
|
-
<pre>
|
1259
|
-
12345
|
1260
|
-
67890
|
1261
|
-
</pre>
|
1262
|
-
<p>
|
1263
|
-
CREDIT: Trans
|
1264
|
-
</p>
|
1265
|
-
</div>
|
1266
|
-
<div class="sourcecode">
|
1267
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000316_source')" id="l_M000316_source">+</a> ]</p>
|
1268
|
-
<div id="M000316_source" class="dyn-source">
|
1269
|
-
<pre>
|
1270
|
-
<span class="ruby-comment cmt"># File lib/core/facets/string/line_wrap.rb, line 14</span>
|
1271
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">line_wrap</span>(<span class="ruby-identifier">width</span>, <span class="ruby-identifier">tabs</span>=<span class="ruby-value">4</span>)
|
1272
|
-
<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-identifier">tabs</span>) <span class="ruby-comment cmt"># tabs default to 4 spaces</span>
|
1273
|
-
<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>)
|
1274
|
-
<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> )
|
1275
|
-
<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>
|
1276
|
-
<span class="ruby-keyword kw">end</span>
|
1277
|
-
</pre>
|
1278
|
-
</div>
|
1279
|
-
</div>
|
1280
|
-
</div>
|
1281
|
-
<div class="method">
|
1282
|
-
<div class="title">
|
1283
|
-
<a name="M000279"></a><b>lines</b>()
|
1284
|
-
</div>
|
1285
|
-
<div class="description">
|
1286
|
-
<p>
|
1287
|
-
Returns an array of characters.
|
1288
|
-
</p>
|
1289
|
-
<pre>
|
1290
|
-
"abc\n123".lines #=> ["abc","123"]
|
1291
|
-
</pre>
|
1292
|
-
</div>
|
1293
|
-
<div class="sourcecode">
|
1294
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000279_source')" id="l_M000279_source">+</a> ]</p>
|
1295
|
-
<div id="M000279_source" class="dyn-source">
|
1296
|
-
<pre>
|
1297
|
-
<span class="ruby-comment cmt"># File lib/core/facets/string/lines.rb, line 9</span>
|
1298
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">lines</span>
|
1299
|
-
<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">split</span>(<span class="ruby-regexp re">/\n/</span>)
|
1300
|
-
<span class="ruby-keyword kw">end</span>
|
1301
|
-
</pre>
|
1302
|
-
</div>
|
1303
|
-
</div>
|
1304
|
-
</div>
|
1305
|
-
<div class="method">
|
1306
|
-
<div class="title">
|
1307
|
-
<a name="M000298"></a><b>margin</b>(n=0)
|
1308
|
-
</div>
|
1309
|
-
<div class="description">
|
1310
|
-
<p>
|
1311
|
-
Provides a <a href="String.html#M000298">margin</a> controlled string.
|
1312
|
-
</p>
|
1313
|
-
<pre>
|
1314
|
-
x = %Q{
|
1315
|
-
| This
|
1316
|
-
| is
|
1317
|
-
| margin controlled!
|
1318
|
-
}.margin
|
1319
|
-
</pre>
|
1320
|
-
<p>
|
1321
|
-
NOTE: This may still need a bit of tweaking.
|
1322
|
-
</p>
|
1323
|
-
<p>
|
1324
|
-
CREDIT: Trans
|
1325
|
-
</p>
|
1326
|
-
</div>
|
1327
|
-
<div class="sourcecode">
|
1328
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000298_source')" id="l_M000298_source">+</a> ]</p>
|
1329
|
-
<div id="M000298_source" class="dyn-source">
|
1330
|
-
<pre>
|
1331
|
-
<span class="ruby-comment cmt"># File lib/core/facets/string/margin.rb, line 16</span>
|
1332
|
-
<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>)
|
1333
|
-
<span class="ruby-comment cmt">#d = /\A.*\n\s*(.)/.match( self )[1]</span>
|
1334
|
-
<span class="ruby-comment cmt">#d = /\A\s*(.)/.match( self)[1] unless d</span>
|
1335
|
-
<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-operator">||</span>
|
1336
|
-
(<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>]
|
1337
|
-
<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>
|
1338
|
-
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">n</span> <span class="ruby-operator">==</span> <span class="ruby-value">0</span>
|
1339
|
-
<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>)
|
1340
|
-
<span class="ruby-keyword kw">else</span>
|
1341
|
-
<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>)
|
1342
|
-
<span class="ruby-keyword kw">end</span>
|
1343
|
-
<span class="ruby-keyword kw">end</span>
|
1344
|
-
</pre>
|
1345
|
-
</div>
|
1346
|
-
</div>
|
1347
|
-
</div>
|
1348
|
-
<div class="method">
|
1349
|
-
<div class="title">
|
1350
|
-
<a name="M000288"></a><b>methodize</b>()
|
1351
|
-
</div>
|
1352
|
-
<div class="description">
|
1353
|
-
<p>
|
1354
|
-
Translate a (class or module) name to a suitable method name.
|
1355
|
-
</p>
|
1356
|
-
<pre>
|
1357
|
-
My::CoolClass.name.methodize => "my__cool_class"
|
1358
|
-
</pre>
|
1359
|
-
</div>
|
1360
|
-
<div class="sourcecode">
|
1361
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000288_source')" id="l_M000288_source">+</a> ]</p>
|
1362
|
-
<div id="M000288_source" class="dyn-source">
|
1363
|
-
<pre>
|
1364
|
-
<span class="ruby-comment cmt"># File lib/core/facets/string/methodize.rb, line 7</span>
|
1365
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">methodize</span>
|
1366
|
-
<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/([A-Z]+)([A-Z])/</span>,<span class="ruby-value str">'\1_\2'</span>).
|
1367
|
-
<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/([a-z])([A-Z])/</span>,<span class="ruby-value str">'\1_\2'</span>).
|
1368
|
-
<span class="ruby-identifier">gsub</span>(<span class="ruby-value str">'/'</span> ,<span class="ruby-value str">'__'</span>).
|
1369
|
-
<span class="ruby-identifier">gsub</span>(<span class="ruby-value str">'::'</span>,<span class="ruby-value str">'__'</span>).
|
1370
|
-
<span class="ruby-identifier">downcase</span>
|
1371
|
-
<span class="ruby-keyword kw">end</span>
|
1372
|
-
</pre>
|
1373
|
-
</div>
|
1374
|
-
</div>
|
1375
|
-
</div>
|
1376
|
-
<div class="method">
|
1377
|
-
<div class="title">
|
1378
|
-
<a name="M000280"></a><b>modulize</b>()
|
1379
|
-
</div>
|
1380
|
-
<div class="description">
|
1381
|
-
<p>
|
1382
|
-
Converts a string to module name representation.
|
1383
|
-
</p>
|
1384
|
-
<p>
|
1385
|
-
This is essentially <a href="String.html#M000278">camelcase</a>. It also
|
1386
|
-
converts ’/’ to ’::’ which is useful for converting
|
1387
|
-
paths to namespaces.
|
1388
|
-
</p>
|
1389
|
-
<p>
|
1390
|
-
Examples
|
1391
|
-
</p>
|
1392
|
-
<pre>
|
1393
|
-
"method_name".modulize #=> "MethodName"
|
1394
|
-
"method/name".modulize #=> "Method::Name"
|
1395
|
-
</pre>
|
1396
|
-
</div>
|
1397
|
-
<div class="sourcecode">
|
1398
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000280_source')" id="l_M000280_source">+</a> ]</p>
|
1399
|
-
<div id="M000280_source" class="dyn-source">
|
1400
|
-
<pre>
|
1401
|
-
<span class="ruby-comment cmt"># File lib/core/facets/string/modulize.rb, line 13</span>
|
1402
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">modulize</span>
|
1403
|
-
<span class="ruby-identifier">gsub</span>(<span class="ruby-value str">'__'</span>,<span class="ruby-value str">'/'</span>).
|
1404
|
-
<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/\/(.?)/</span>){ <span class="ruby-node">"::#{$1.upcase}"</span> }.
|
1405
|
-
<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/(?:_+|-+)([a-z])/</span>){ <span class="ruby-identifier">$1</span>.<span class="ruby-identifier">upcase</span> }.
|
1406
|
-
<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/(\A|\s)([a-z])/</span>){ <span class="ruby-identifier">$1</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">$2</span>.<span class="ruby-identifier">upcase</span> }
|
1407
|
-
<span class="ruby-keyword kw">end</span>
|
1408
|
-
</pre>
|
1409
|
-
</div>
|
1410
|
-
</div>
|
1411
|
-
</div>
|
1412
|
-
<div class="method">
|
1413
|
-
<div class="title">
|
1414
|
-
<a name="M000299"></a><b>mscan</b>(re) {|| ...}
|
1415
|
-
</div>
|
1416
|
-
<div class="description">
|
1417
|
-
<p>
|
1418
|
-
Like scan but returns <a href="MatchData.html">MatchData</a> ($~) rather
|
1419
|
-
then matched string ($&).
|
1420
|
-
</p>
|
1421
|
-
<p>
|
1422
|
-
CREDIT: Trans
|
1423
|
-
</p>
|
1424
|
-
</div>
|
1425
|
-
<div class="sourcecode">
|
1426
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000299_source')" id="l_M000299_source">+</a> ]</p>
|
1427
|
-
<div id="M000299_source" class="dyn-source">
|
1428
|
-
<pre>
|
1429
|
-
<span class="ruby-comment cmt"># File lib/core/facets/string/mscan.rb, line 8</span>
|
1430
|
-
<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>
|
1431
|
-
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">block_given?</span>
|
1432
|
-
<span class="ruby-identifier">scan</span>(<span class="ruby-identifier">re</span>) { <span class="ruby-keyword kw">yield</span>(<span class="ruby-identifier">$~</span>) }
|
1433
|
-
<span class="ruby-keyword kw">else</span>
|
1434
|
-
<span class="ruby-identifier">m</span> = []
|
1435
|
-
<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> }
|
1436
|
-
<span class="ruby-identifier">m</span>
|
1437
|
-
<span class="ruby-keyword kw">end</span>
|
1438
|
-
<span class="ruby-keyword kw">end</span>
|
1439
|
-
</pre>
|
1440
|
-
</div>
|
1441
|
-
</div>
|
1442
|
-
</div>
|
1443
|
-
<div class="method">
|
1444
|
-
<div class="title">
|
1445
|
-
<a name="M000305"></a><b>natcmp</b>(str2, caseInsensitive=false)
|
1446
|
-
</div>
|
1447
|
-
<div class="description">
|
1448
|
-
<p>
|
1449
|
-
‘Natural order’ comparison of strings, e.g.
|
1450
|
-
</p>
|
1451
|
-
<pre>
|
1452
|
-
"my_prog_v1.1.0" < "my_prog_v1.2.0" < "my_prog_v1.10.0"
|
1453
|
-
</pre>
|
1454
|
-
<p>
|
1455
|
-
which does not follow alphabetically. A secondary parameter, if set to
|
1456
|
-
<em>true</em>, makes the comparison case insensitive.
|
1457
|
-
</p>
|
1458
|
-
<pre>
|
1459
|
-
"Hello.10".natcmp("Hello.1") #=> -1
|
1460
|
-
|
1461
|
-
TODO: Invert case flag?
|
1462
|
-
</pre>
|
1463
|
-
<p>
|
1464
|
-
CREDIT: Alan Davies, Martin Pool
|
1465
|
-
</p>
|
1466
|
-
</div>
|
1467
|
-
<div class="sourcecode">
|
1468
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000305_source')" id="l_M000305_source">+</a> ]</p>
|
1469
|
-
<div id="M000305_source" class="dyn-source">
|
1470
|
-
<pre>
|
1471
|
-
<span class="ruby-comment cmt"># File lib/core/facets/string/natcmp.rb, line 46</span>
|
1472
|
-
<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>)
|
1473
|
-
<span class="ruby-identifier">str1</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">dup</span>
|
1474
|
-
<span class="ruby-identifier">str2</span> = <span class="ruby-identifier">str2</span>.<span class="ruby-identifier">dup</span>
|
1475
|
-
<span class="ruby-identifier">compareExpression</span> = <span class="ruby-regexp re">/^(\D*)(\d*)(.*)$/</span>
|
1476
|
-
|
1477
|
-
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">caseInsensitive</span>
|
1478
|
-
<span class="ruby-identifier">str1</span>.<span class="ruby-identifier">downcase!</span>
|
1479
|
-
<span class="ruby-identifier">str2</span>.<span class="ruby-identifier">downcase!</span>
|
1480
|
-
<span class="ruby-keyword kw">end</span>
|
1481
|
-
|
1482
|
-
<span class="ruby-comment cmt"># remove all whitespace</span>
|
1483
|
-
<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>)
|
1484
|
-
<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>)
|
1485
|
-
|
1486
|
-
<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>
|
1487
|
-
<span class="ruby-comment cmt"># Extract non-digits, digits and rest of string</span>
|
1488
|
-
<span class="ruby-identifier">str1</span> <span class="ruby-operator">=~</span> <span class="ruby-identifier">compareExpression</span>
|
1489
|
-
<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>
|
1490
|
-
<span class="ruby-identifier">str2</span> <span class="ruby-operator">=~</span> <span class="ruby-identifier">compareExpression</span>
|
1491
|
-
<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>
|
1492
|
-
<span class="ruby-comment cmt"># Compare the non-digits</span>
|
1493
|
-
<span class="ruby-keyword kw">case</span> (<span class="ruby-identifier">chars1</span> <span class="ruby-operator"><=></span> <span class="ruby-identifier">chars2</span>)
|
1494
|
-
<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>
|
1495
|
-
<span class="ruby-comment cmt"># If either number begins with a zero, then compare alphabetically,</span>
|
1496
|
-
<span class="ruby-comment cmt"># otherwise compare numerically</span>
|
1497
|
-
<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>)
|
1498
|
-
<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>
|
1499
|
-
<span class="ruby-keyword kw">end</span>
|
1500
|
-
<span class="ruby-keyword kw">case</span> (<span class="ruby-identifier">num1</span> <span class="ruby-operator"><=></span> <span class="ruby-identifier">num2</span>)
|
1501
|
-
<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>
|
1502
|
-
<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>
|
1503
|
-
<span class="ruby-keyword kw">end</span>
|
1504
|
-
<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>
|
1505
|
-
<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>
|
1506
|
-
<span class="ruby-keyword kw">end</span> <span class="ruby-comment cmt"># case</span>
|
1507
|
-
<span class="ruby-keyword kw">end</span> <span class="ruby-comment cmt"># while</span>
|
1508
|
-
|
1509
|
-
<span class="ruby-comment cmt"># strings are naturally equal.</span>
|
1510
|
-
<span class="ruby-keyword kw">return</span> <span class="ruby-value">0</span>
|
1511
|
-
<span class="ruby-keyword kw">end</span>
|
1512
|
-
|
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="M000328"></a><b>nchar</b>(n, replacement=nil)
|
1521
|
-
</div>
|
1522
|
-
<div class="description">
|
1523
|
-
<p>
|
1524
|
-
Returns <em>n</em> characters of the string. If <em>n</em> is positive the
|
1525
|
-
characters are from the beginning of the string. If <em>n</em> is negative
|
1526
|
-
from the end of the string.
|
1527
|
-
</p>
|
1528
|
-
<p>
|
1529
|
-
Alternatively a replacement string can be given, which will replace the
|
1530
|
-
<em>n</em> characters.
|
1531
|
-
</p>
|
1532
|
-
<pre>
|
1533
|
-
str = "this is text"
|
1534
|
-
str.nchar(4) #=> "this"
|
1535
|
-
str.nchar(4, 'that') #=> "that"
|
1536
|
-
str #=> "that is text"
|
1537
|
-
</pre>
|
1538
|
-
</div>
|
1539
|
-
<div class="sourcecode">
|
1540
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000328_source')" id="l_M000328_source">+</a> ]</p>
|
1541
|
-
<div id="M000328_source" class="dyn-source">
|
1542
|
-
<pre>
|
1543
|
-
<span class="ruby-comment cmt"># File lib/core/facets/string/nchar.rb, line 15</span>
|
1544
|
-
<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>)
|
1545
|
-
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">replacement</span>
|
1546
|
-
<span class="ruby-identifier">s</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">dup</span>
|
1547
|
-
<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>)
|
1548
|
-
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">s</span>
|
1549
|
-
<span class="ruby-keyword kw">else</span>
|
1550
|
-
<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>]
|
1551
|
-
<span class="ruby-keyword kw">end</span>
|
1552
|
-
<span class="ruby-keyword kw">end</span>
|
1553
|
-
</pre>
|
1554
|
-
</div>
|
1555
|
-
</div>
|
1556
|
-
</div>
|
1557
|
-
<div class="method">
|
1558
|
-
<div class="title">
|
1559
|
-
<a name="M000310"></a><b>outdent</b>(n)
|
1560
|
-
</div>
|
1561
|
-
<div class="description">
|
1562
|
-
<p>
|
1563
|
-
Outdent just indents a negative number of spaces.
|
1564
|
-
</p>
|
1565
|
-
<p>
|
1566
|
-
CREDIT: Noah Gibbs
|
1567
|
-
</p>
|
1568
|
-
</div>
|
1569
|
-
<div class="sourcecode">
|
1570
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000310_source')" id="l_M000310_source">+</a> ]</p>
|
1571
|
-
<div id="M000310_source" class="dyn-source">
|
1572
|
-
<pre>
|
1573
|
-
<span class="ruby-comment cmt"># File lib/core/facets/string/indent.rb, line 20</span>
|
1574
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">outdent</span>(<span class="ruby-identifier">n</span>)
|
1575
|
-
<span class="ruby-identifier">indent</span>(<span class="ruby-operator">-</span><span class="ruby-identifier">n</span>)
|
1576
|
-
<span class="ruby-keyword kw">end</span>
|
1577
|
-
</pre>
|
1578
|
-
</div>
|
1579
|
-
</div>
|
1580
|
-
</div>
|
1581
|
-
<div class="method">
|
1582
|
-
<div class="title">
|
1583
|
-
<a name="M000308"></a><b>pathize</b>()
|
1584
|
-
</div>
|
1585
|
-
<div class="description">
|
1586
|
-
<p>
|
1587
|
-
Converts a (class or module) name to a unix path.
|
1588
|
-
</p>
|
1589
|
-
<pre>
|
1590
|
-
My::CoolClass.name.pathize #=> "my/cool_class"
|
1591
|
-
</pre>
|
1592
|
-
</div>
|
1593
|
-
<div class="sourcecode">
|
1594
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000308_source')" id="l_M000308_source">+</a> ]</p>
|
1595
|
-
<div id="M000308_source" class="dyn-source">
|
1596
|
-
<pre>
|
1597
|
-
<span class="ruby-comment cmt"># File lib/core/facets/string/pathize.rb, line 7</span>
|
1598
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">pathize</span>
|
1599
|
-
<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/([A-Z]+)([A-Z])/</span>,<span class="ruby-value str">'\1_\2'</span>).
|
1600
|
-
<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/([a-z])([A-Z])/</span>,<span class="ruby-value str">'\1_\2'</span>).
|
1601
|
-
<span class="ruby-identifier">gsub</span>(<span class="ruby-value str">'__'</span>,<span class="ruby-value str">'/'</span>).
|
1602
|
-
<span class="ruby-identifier">gsub</span>(<span class="ruby-value str">'::'</span>,<span class="ruby-value str">'/'</span>).
|
1603
|
-
<span class="ruby-identifier">downcase</span>
|
1604
|
-
<span class="ruby-keyword kw">end</span>
|
1605
|
-
</pre>
|
1606
|
-
</div>
|
1607
|
-
</div>
|
1608
|
-
</div>
|
1609
|
-
<div class="method">
|
1610
|
-
<div class="title">
|
1611
|
-
<a name="M000321"></a><b>quote</b>(type=:s)
|
1612
|
-
</div>
|
1613
|
-
<div class="description">
|
1614
|
-
<p>
|
1615
|
-
Return a new string embraced by given quotes. If no quotes are specified,
|
1616
|
-
then assumes single quotes.
|
1617
|
-
</p>
|
1618
|
-
<pre>
|
1619
|
-
"quote me".quote #=> "'quote me'"
|
1620
|
-
"quote me".quote(2) #=> "\"quote me\""
|
1621
|
-
</pre>
|
1622
|
-
<p>
|
1623
|
-
CREDIT: Trans
|
1624
|
-
</p>
|
1625
|
-
</div>
|
1626
|
-
<div class="sourcecode">
|
1627
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000321_source')" id="l_M000321_source">+</a> ]</p>
|
1628
|
-
<div id="M000321_source" class="dyn-source">
|
1629
|
-
<pre>
|
1630
|
-
<span class="ruby-comment cmt"># File lib/core/facets/string/bracket.rb, line 69</span>
|
1631
|
-
<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>)
|
1632
|
-
<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>
|
1633
|
-
<span class="ruby-keyword kw">when</span> <span class="ruby-value str">'s'</span>, <span class="ruby-value str">'single'</span>
|
1634
|
-
<span class="ruby-identifier">bracket</span>(<span class="ruby-value str">"'"</span>)
|
1635
|
-
<span class="ruby-keyword kw">when</span> <span class="ruby-value str">'d'</span>, <span class="ruby-value str">'double'</span>
|
1636
|
-
<span class="ruby-identifier">bracket</span>(<span class="ruby-value str">'"'</span>)
|
1637
|
-
<span class="ruby-keyword kw">when</span> <span class="ruby-value str">'b'</span>, <span class="ruby-value str">'back'</span>
|
1638
|
-
<span class="ruby-identifier">bracket</span>(<span class="ruby-value str">'`'</span>)
|
1639
|
-
<span class="ruby-keyword kw">else</span>
|
1640
|
-
<span class="ruby-identifier">bracket</span>(<span class="ruby-value str">"'"</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="M000291"></a><b>range</b>(s, offset=0)
|
1650
|
-
</div>
|
1651
|
-
<div class="description">
|
1652
|
-
<p>
|
1653
|
-
Like index but returns a <a href="Range.html">Range</a>.
|
1654
|
-
</p>
|
1655
|
-
<pre>
|
1656
|
-
"This is a test!".range('test') #=> 10..13
|
1657
|
-
</pre>
|
1658
|
-
<p>
|
1659
|
-
CREDIT: Trans
|
1660
|
-
</p>
|
1661
|
-
</div>
|
1662
|
-
<div class="sourcecode">
|
1663
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000291_source')" id="l_M000291_source">+</a> ]</p>
|
1664
|
-
<div id="M000291_source" class="dyn-source">
|
1665
|
-
<pre>
|
1666
|
-
<span class="ruby-comment cmt"># File lib/core/facets/string/range.rb, line 9</span>
|
1667
|
-
<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>)
|
1668
|
-
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">index</span>(<span class="ruby-identifier">s</span>, <span class="ruby-identifier">offset</span>)
|
1669
|
-
<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>)
|
1670
|
-
<span class="ruby-keyword kw">end</span>
|
1671
|
-
<span class="ruby-keyword kw">nil</span>
|
1672
|
-
<span class="ruby-keyword kw">end</span>
|
1673
|
-
</pre>
|
1674
|
-
</div>
|
1675
|
-
</div>
|
1676
|
-
</div>
|
1677
|
-
<div class="method">
|
1678
|
-
<div class="title">
|
1679
|
-
<a name="M000292"></a><b>range_all</b>(s, reuse=false)
|
1680
|
-
</div>
|
1681
|
-
<div class="description">
|
1682
|
-
<p>
|
1683
|
-
Like <a href="String.html#M000294">index_all</a> but returns an array of
|
1684
|
-
Ranges.
|
1685
|
-
</p>
|
1686
|
-
<pre>
|
1687
|
-
"abc123abc123".range_all('abc') #=> [0..2, 6..8]
|
1688
|
-
|
1689
|
-
TODO: Add offset, perhaps ?
|
1690
|
-
</pre>
|
1691
|
-
<p>
|
1692
|
-
CREDIT: Trans
|
1693
|
-
</p>
|
1694
|
-
</div>
|
1695
|
-
<div class="sourcecode">
|
1696
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000292_source')" id="l_M000292_source">+</a> ]</p>
|
1697
|
-
<div id="M000292_source" class="dyn-source">
|
1698
|
-
<pre>
|
1699
|
-
<span class="ruby-comment cmt"># File lib/core/facets/string/range.rb, line 24</span>
|
1700
|
-
<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>)
|
1701
|
-
<span class="ruby-identifier">r</span> = []; <span class="ruby-identifier">i</span> = <span class="ruby-value">0</span>
|
1702
|
-
<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>
|
1703
|
-
<span class="ruby-identifier">rng</span> = <span class="ruby-identifier">range</span>(<span class="ruby-identifier">s</span>, <span class="ruby-identifier">i</span>)
|
1704
|
-
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">rng</span>
|
1705
|
-
<span class="ruby-identifier">r</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">rng</span>
|
1706
|
-
<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>
|
1707
|
-
<span class="ruby-keyword kw">else</span>
|
1708
|
-
<span class="ruby-keyword kw">break</span>
|
1709
|
-
<span class="ruby-keyword kw">end</span>
|
1710
|
-
<span class="ruby-keyword kw">end</span>
|
1711
|
-
<span class="ruby-identifier">r</span>.<span class="ruby-identifier">uniq</span>
|
1712
|
-
<span class="ruby-keyword kw">end</span>
|
1713
|
-
</pre>
|
1714
|
-
</div>
|
1715
|
-
</div>
|
1716
|
-
</div>
|
1717
|
-
<div class="method">
|
1718
|
-
<div class="title">
|
1719
|
-
<a name="M000293"></a><b>range_of_line</b>()
|
1720
|
-
</div>
|
1721
|
-
<div class="description">
|
1722
|
-
<p>
|
1723
|
-
Returns an array of ranges mapping the characters per line.
|
1724
|
-
</p>
|
1725
|
-
<pre>
|
1726
|
-
"this\nis\na\ntest".range_of_line
|
1727
|
-
#=> [0..4, 5..7, 8..9, 10..13]
|
1728
|
-
</pre>
|
1729
|
-
<p>
|
1730
|
-
CREDIT: Trans
|
1731
|
-
</p>
|
1732
|
-
</div>
|
1733
|
-
<div class="sourcecode">
|
1734
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000293_source')" id="l_M000293_source">+</a> ]</p>
|
1735
|
-
<div id="M000293_source" class="dyn-source">
|
1736
|
-
<pre>
|
1737
|
-
<span class="ruby-comment cmt"># File lib/core/facets/string/range.rb, line 46</span>
|
1738
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">range_of_line</span>
|
1739
|
-
<span class="ruby-identifier">offset</span>=<span class="ruby-value">0</span>; <span class="ruby-identifier">charmap</span> = []
|
1740
|
-
<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>
|
1741
|
-
<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>))
|
1742
|
-
<span class="ruby-identifier">offset</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">line</span>.<span class="ruby-identifier">length</span>
|
1743
|
-
<span class="ruby-keyword kw">end</span>
|
1744
|
-
<span class="ruby-identifier">charmap</span>
|
1745
|
-
<span class="ruby-keyword kw">end</span>
|
1746
|
-
</pre>
|
1747
|
-
</div>
|
1748
|
-
</div>
|
1749
|
-
</div>
|
1750
|
-
<div class="method">
|
1751
|
-
<div class="title">
|
1752
|
-
<a name="M000327"></a><b>rewrite</b>(rules)
|
1753
|
-
</div>
|
1754
|
-
<div class="description">
|
1755
|
-
<p>
|
1756
|
-
Apply a set of rules (regular expression matches) to the string.
|
1757
|
-
</p>
|
1758
|
-
<h3>Requirements:</h3>
|
1759
|
-
<p>
|
1760
|
-
The rules must be applied in order! So we cannot use a hash because the
|
1761
|
-
ordering is not guaranteed! we use an array instead.
|
1762
|
-
</p>
|
1763
|
-
<h3>Input:</h3>
|
1764
|
-
<p>
|
1765
|
-
The array containing rule-pairs (match, write).
|
1766
|
-
</p>
|
1767
|
-
<h3>Output:</h3>
|
1768
|
-
<p>
|
1769
|
-
The rewritten string.
|
1770
|
-
</p>
|
1771
|
-
<p>
|
1772
|
-
CREDIT: George Moschovitis
|
1773
|
-
</p>
|
1774
|
-
</div>
|
1775
|
-
<div class="sourcecode">
|
1776
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000327_source')" id="l_M000327_source">+</a> ]</p>
|
1777
|
-
<div id="M000327_source" class="dyn-source">
|
1778
|
-
<pre>
|
1779
|
-
<span class="ruby-comment cmt"># File lib/core/facets/string/rewrite.rb, line 18</span>
|
1780
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">rewrite</span>(<span class="ruby-identifier">rules</span>)
|
1781
|
-
<span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">'The rules parameter is nil'</span>) <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">rules</span>
|
1782
|
-
<span class="ruby-identifier">rewritten_string</span> = <span class="ruby-identifier">dup</span>
|
1783
|
-
<span class="ruby-identifier">rules</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">match</span>,<span class="ruby-identifier">write</span><span class="ruby-operator">|</span>
|
1784
|
-
<span class="ruby-identifier">rewritten_string</span>.<span class="ruby-identifier">gsub!</span>(<span class="ruby-identifier">match</span>,<span class="ruby-identifier">write</span>)
|
1785
|
-
<span class="ruby-keyword kw">end</span>
|
1786
|
-
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">rewritten_string</span>
|
1787
|
-
<span class="ruby-keyword kw">end</span>
|
1788
|
-
</pre>
|
1789
|
-
</div>
|
1790
|
-
</div>
|
1791
|
-
</div>
|
1792
|
-
<div class="method">
|
1793
|
-
<div class="title">
|
1794
|
-
<a name="M000271"></a><b>shatter</b>( re )
|
1795
|
-
</div>
|
1796
|
-
<div class="description">
|
1797
|
-
<p>
|
1798
|
-
Breaks a string up into an array based on a regular expression. Similar to
|
1799
|
-
scan, but includes the matches.
|
1800
|
-
</p>
|
1801
|
-
<pre>
|
1802
|
-
s = "<p>This<b>is</b>a test.</p>"
|
1803
|
-
s.shatter( /\<.*?\>/ )
|
1804
|
-
</pre>
|
1805
|
-
<p>
|
1806
|
-
<em>produces</em>
|
1807
|
-
</p>
|
1808
|
-
<pre>
|
1809
|
-
["<p>", "This", "<b>", "is", "</b>", "a test.", "</p>"]
|
1810
|
-
</pre>
|
1811
|
-
<p>
|
1812
|
-
CREDIT: Trans
|
1813
|
-
</p>
|
1814
|
-
</div>
|
1815
|
-
<div class="sourcecode">
|
1816
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000271_source')" id="l_M000271_source">+</a> ]</p>
|
1817
|
-
<div id="M000271_source" class="dyn-source">
|
1818
|
-
<pre>
|
1819
|
-
<span class="ruby-comment cmt"># File lib/core/facets/string/shatter.rb, line 15</span>
|
1820
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">shatter</span>( <span class="ruby-identifier">re</span> )
|
1821
|
-
<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> }
|
1822
|
-
<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>
|
1823
|
-
<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>
|
1824
|
-
<span class="ruby-identifier">r</span>.<span class="ruby-identifier">split</span>(<span class="ruby-value str">"\1"</span>)
|
1825
|
-
<span class="ruby-keyword kw">end</span>
|
1826
|
-
</pre>
|
1827
|
-
</div>
|
1828
|
-
</div>
|
1829
|
-
</div>
|
1830
|
-
<div class="method">
|
1831
|
-
<div class="title">
|
1832
|
-
<a name="M000295"></a><b>snakecase</b>()
|
1833
|
-
</div>
|
1834
|
-
<div class="description">
|
1835
|
-
<p>
|
1836
|
-
The reverse of <tt><a href="String.html#M000278">camelcase</a></tt>. Makes
|
1837
|
-
an underscored of a <a href="String.html#M000278">camelcase</a> string.
|
1838
|
-
</p>
|
1839
|
-
<p>
|
1840
|
-
Changes ’::’ to ’/’ to convert namespaces to paths.
|
1841
|
-
</p>
|
1842
|
-
<p>
|
1843
|
-
Examples
|
1844
|
-
</p>
|
1845
|
-
<pre>
|
1846
|
-
"SnakeCase".snakecase #=> "snake_case"
|
1847
|
-
"Snake-Case".snakecase #=> "snake_case"
|
1848
|
-
"SnakeCase::Errors".underscore #=> "snake_case/errors"
|
1849
|
-
</pre>
|
1850
|
-
</div>
|
1851
|
-
<div class="sourcecode">
|
1852
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000295_source')" id="l_M000295_source">+</a> ]</p>
|
1853
|
-
<div id="M000295_source" class="dyn-source">
|
1854
|
-
<pre>
|
1855
|
-
<span class="ruby-comment cmt"># File lib/core/facets/string/snakecase.rb, line 12</span>
|
1856
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">snakecase</span>
|
1857
|
-
<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/::/</span>, <span class="ruby-value str">'/'</span>). <span class="ruby-comment cmt"># NOT SO SURE ABOUT THIS -T</span>
|
1858
|
-
<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/([A-Z]+)([A-Z][a-z])/</span>,<span class="ruby-value str">'\1_\2'</span>).
|
1859
|
-
<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/([a-z\d])([A-Z])/</span>,<span class="ruby-value str">'\1_\2'</span>).
|
1860
|
-
<span class="ruby-identifier">tr</span>(<span class="ruby-value str">"-"</span>, <span class="ruby-value str">"_"</span>).
|
1861
|
-
<span class="ruby-identifier">downcase</span>
|
1862
|
-
<span class="ruby-keyword kw">end</span>
|
1863
|
-
</pre>
|
1864
|
-
</div>
|
1865
|
-
</div>
|
1866
|
-
</div>
|
1867
|
-
<div class="method">
|
1868
|
-
<div class="title">
|
1869
|
-
<a name="M000326"></a><b>splice</b>(idx, sub=nil)
|
1870
|
-
</div>
|
1871
|
-
<div class="description">
|
1872
|
-
<p>
|
1873
|
-
This is basically the same as store, but it acts like slice! when given
|
1874
|
-
only one argument.
|
1875
|
-
</p>
|
1876
|
-
<p>
|
1877
|
-
Essentlay slice, but writes rather than reads.
|
1878
|
-
</p>
|
1879
|
-
<pre>
|
1880
|
-
a = "HELLO"
|
1881
|
-
a.splice("X", 1)
|
1882
|
-
a #=> "HXLLO"
|
1883
|
-
|
1884
|
-
a = "HELLO"
|
1885
|
-
a.splice(1) #=> "E"
|
1886
|
-
a #=> "HLLO"
|
1887
|
-
</pre>
|
1888
|
-
<p>
|
1889
|
-
CREDIT: Trans
|
1890
|
-
</p>
|
1891
|
-
</div>
|
1892
|
-
<div class="sourcecode">
|
1893
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000326_source')" id="l_M000326_source">+</a> ]</p>
|
1894
|
-
<div id="M000326_source" class="dyn-source">
|
1895
|
-
<pre>
|
1896
|
-
<span class="ruby-comment cmt"># File lib/core/facets/string/splice.rb, line 20</span>
|
1897
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">splice</span>(<span class="ruby-identifier">idx</span>, <span class="ruby-identifier">sub</span>=<span class="ruby-keyword kw">nil</span>)
|
1898
|
-
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">sub</span>
|
1899
|
-
<span class="ruby-identifier">store</span>(<span class="ruby-identifier">idx</span>, <span class="ruby-identifier">sub</span>)
|
1900
|
-
<span class="ruby-keyword kw">else</span>
|
1901
|
-
<span class="ruby-keyword kw">case</span> <span class="ruby-identifier">idx</span>
|
1902
|
-
<span class="ruby-keyword kw">when</span> <span class="ruby-constant">Range</span>
|
1903
|
-
<span class="ruby-identifier">slice!</span>(<span class="ruby-identifier">idx</span>)
|
1904
|
-
<span class="ruby-keyword kw">else</span>
|
1905
|
-
<span class="ruby-identifier">slice!</span>(<span class="ruby-identifier">idx</span>,<span class="ruby-value">1</span>)
|
1906
|
-
<span class="ruby-keyword kw">end</span>
|
1907
|
-
<span class="ruby-keyword kw">end</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="M000276"></a><b>start_with?</b>(prefix)
|
1916
|
-
</div>
|
1917
|
-
<div class="description">
|
1918
|
-
<p>
|
1919
|
-
Does a string start with the given prefix.
|
1920
|
-
</p>
|
1921
|
-
<pre>
|
1922
|
-
"hello".starts_with?("he") #=> true
|
1923
|
-
"hello".starts_with?("to") #=> false
|
1924
|
-
</pre>
|
1925
|
-
<p>
|
1926
|
-
CREDIT: Lucas Carlson, Blaine Cook
|
1927
|
-
</p>
|
1928
|
-
</div>
|
1929
|
-
<div class="sourcecode">
|
1930
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000276_source')" id="l_M000276_source">+</a> ]</p>
|
1931
|
-
<div id="M000276_source" class="dyn-source">
|
1932
|
-
<pre>
|
1933
|
-
<span class="ruby-comment cmt"># File lib/core/facets/string/start_with.rb, line 12</span>
|
1934
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">start_with?</span>(<span class="ruby-identifier">prefix</span>)
|
1935
|
-
<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">index</span>(<span class="ruby-identifier">prefix</span>) <span class="ruby-operator">==</span> <span class="ruby-value">0</span>
|
1936
|
-
<span class="ruby-keyword kw">end</span>
|
1937
|
-
</pre>
|
1938
|
-
</div>
|
1939
|
-
</div>
|
1940
|
-
</div>
|
1941
|
-
<div class="method">
|
1942
|
-
<div class="title">
|
1943
|
-
<a name="M000287"></a><b>tab</b>(n)
|
1944
|
-
</div>
|
1945
|
-
<div class="description">
|
1946
|
-
<p>
|
1947
|
-
Aligns each line n spaces.
|
1948
|
-
</p>
|
1949
|
-
<p>
|
1950
|
-
CREDIT: Gavin Sinclair
|
1951
|
-
</p>
|
1952
|
-
</div>
|
1953
|
-
<div class="sourcecode">
|
1954
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000287_source')" id="l_M000287_source">+</a> ]</p>
|
1955
|
-
<div id="M000287_source" class="dyn-source">
|
1956
|
-
<pre>
|
1957
|
-
<span class="ruby-comment cmt"># File lib/core/facets/string/tab.rb, line 12</span>
|
1958
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">tab</span>(<span class="ruby-identifier">n</span>)
|
1959
|
-
<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>)
|
1960
|
-
<span class="ruby-keyword kw">end</span>
|
1961
|
-
</pre>
|
1962
|
-
</div>
|
1963
|
-
</div>
|
1964
|
-
</div>
|
1965
|
-
<div class="method">
|
1966
|
-
<div class="title">
|
1967
|
-
<a name="M000312"></a><b>tabto</b>(n)
|
1968
|
-
</div>
|
1969
|
-
<div class="description">
|
1970
|
-
<p>
|
1971
|
-
Preserves relative tabbing. The first non-empty line ends up with n spaces
|
1972
|
-
before nonspace.
|
1973
|
-
</p>
|
1974
|
-
<p>
|
1975
|
-
CREDIT: Gavin Sinclair
|
1976
|
-
</p>
|
1977
|
-
</div>
|
1978
|
-
<div class="sourcecode">
|
1979
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000312_source')" id="l_M000312_source">+</a> ]</p>
|
1980
|
-
<div id="M000312_source" class="dyn-source">
|
1981
|
-
<pre>
|
1982
|
-
<span class="ruby-comment cmt"># File lib/core/facets/string/tabto.rb, line 10</span>
|
1983
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">tabto</span>(<span class="ruby-identifier">n</span>)
|
1984
|
-
<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>
|
1985
|
-
<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>)
|
1986
|
-
<span class="ruby-keyword kw">else</span>
|
1987
|
-
<span class="ruby-keyword kw">self</span>
|
1988
|
-
<span class="ruby-keyword kw">end</span>
|
1989
|
-
<span class="ruby-keyword kw">end</span>
|
1990
|
-
</pre>
|
1991
|
-
</div>
|
1992
|
-
</div>
|
1993
|
-
</div>
|
1994
|
-
<div class="method">
|
1995
|
-
<div class="title">
|
1996
|
-
<a name="M000311"></a><b>titlecase</b>()
|
1997
|
-
</div>
|
1998
|
-
<div class="description">
|
1999
|
-
<p>
|
2000
|
-
Title case.
|
2001
|
-
</p>
|
2002
|
-
<pre>
|
2003
|
-
"this is a string".titlecase
|
2004
|
-
=> "This Is A String"
|
2005
|
-
</pre>
|
2006
|
-
<p>
|
2007
|
-
CREDIT: Eliazar Parra
|
2008
|
-
</p>
|
2009
|
-
</div>
|
2010
|
-
<div class="sourcecode">
|
2011
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000311_source')" id="l_M000311_source">+</a> ]</p>
|
2012
|
-
<div id="M000311_source" class="dyn-source">
|
2013
|
-
<pre>
|
2014
|
-
<span class="ruby-comment cmt"># File lib/core/facets/string/titlecase.rb, line 10</span>
|
2015
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">titlecase</span>
|
2016
|
-
<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/\b\w/</span>){<span class="ruby-identifier">$&</span>.<span class="ruby-identifier">upcase</span>}
|
2017
|
-
<span class="ruby-keyword kw">end</span>
|
2018
|
-
</pre>
|
2019
|
-
</div>
|
2020
|
-
</div>
|
2021
|
-
</div>
|
2022
|
-
<div class="method">
|
2023
|
-
<div class="title">
|
2024
|
-
<a name="M000269"></a><b>to_b</b>()
|
2025
|
-
</div>
|
2026
|
-
<div class="description">
|
2027
|
-
<p>
|
2028
|
-
Interpret common affirmative string meanings as true, otherwise false.
|
2029
|
-
Balnk sapce and case are ignored. The following strings that will return
|
2030
|
-
true:
|
2031
|
-
</p>
|
2032
|
-
<pre>
|
2033
|
-
<tt>true</tt>,<tt>yes</tt>,<tt>on</tt>,<tt>t</tt>,<tt>1</tt>,<tt>y</tt>,<tt>==</tt>
|
2034
|
-
</pre>
|
2035
|
-
<p>
|
2036
|
-
Examples:
|
2037
|
-
</p>
|
2038
|
-
<pre>
|
2039
|
-
"true".to_b #=> true
|
2040
|
-
"yes".to_b #=> true
|
2041
|
-
"no".to_b #=> false
|
2042
|
-
"123".to_b #=> false
|
2043
|
-
</pre>
|
2044
|
-
</div>
|
2045
|
-
<div class="sourcecode">
|
2046
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000269_source')" id="l_M000269_source">+</a> ]</p>
|
2047
|
-
<div id="M000269_source" class="dyn-source">
|
2048
|
-
<pre>
|
2049
|
-
<span class="ruby-comment cmt"># File lib/core/facets/boolean.rb, line 43</span>
|
2050
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_b</span>
|
2051
|
-
<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>
|
2052
|
-
<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>
|
2053
|
-
<span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">true</span>
|
2054
|
-
<span class="ruby-keyword kw">when</span> <span class="ruby-value str">'nil'</span>, <span class="ruby-value str">'null'</span>
|
2055
|
-
<span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">nil</span>
|
2056
|
-
<span class="ruby-keyword kw">else</span>
|
2057
|
-
<span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">false</span>
|
2058
|
-
<span class="ruby-keyword kw">end</span>
|
2059
|
-
<span class="ruby-keyword kw">end</span>
|
2060
|
-
</pre>
|
2061
|
-
</div>
|
2062
|
-
</div>
|
2063
|
-
</div>
|
2064
|
-
<div class="method">
|
2065
|
-
<div class="title">
|
2066
|
-
<a name="M000273"></a><b>to_re</b>(esc=false)
|
2067
|
-
</div>
|
2068
|
-
<div class="description">
|
2069
|
-
<p>
|
2070
|
-
Turns a string into a regular expression.
|
2071
|
-
</p>
|
2072
|
-
<pre>
|
2073
|
-
"a?".to_re #=> /a?/
|
2074
|
-
</pre>
|
2075
|
-
<p>
|
2076
|
-
CREDIT: Trans
|
2077
|
-
</p>
|
2078
|
-
</div>
|
2079
|
-
<div class="sourcecode">
|
2080
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000273_source')" id="l_M000273_source">+</a> ]</p>
|
2081
|
-
<div id="M000273_source" class="dyn-source">
|
2082
|
-
<pre>
|
2083
|
-
<span class="ruby-comment cmt"># File lib/core/facets/string/to_re.rb, line 9</span>
|
2084
|
-
<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>)
|
2085
|
-
<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>))
|
2086
|
-
<span class="ruby-keyword kw">end</span>
|
2087
|
-
</pre>
|
2088
|
-
</div>
|
2089
|
-
</div>
|
2090
|
-
</div>
|
2091
|
-
<div class="method">
|
2092
|
-
<div class="title">
|
2093
|
-
<a name="M000274"></a><b>to_rx</b>(esc=true)
|
2094
|
-
</div>
|
2095
|
-
<div class="description">
|
2096
|
-
<p>
|
2097
|
-
Turns a string into a regular expression. By default it will escape all
|
2098
|
-
characters. Use <tt>false</tt> argument to turn off escaping.
|
2099
|
-
</p>
|
2100
|
-
<pre>
|
2101
|
-
"[".to_rx #=> /\[/
|
2102
|
-
</pre>
|
2103
|
-
<p>
|
2104
|
-
CREDIT: Trans
|
2105
|
-
</p>
|
2106
|
-
</div>
|
2107
|
-
<div class="sourcecode">
|
2108
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000274_source')" id="l_M000274_source">+</a> ]</p>
|
2109
|
-
<div id="M000274_source" class="dyn-source">
|
2110
|
-
<pre>
|
2111
|
-
<span class="ruby-comment cmt"># File lib/core/facets/string/to_re.rb, line 21</span>
|
2112
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_rx</span>(<span class="ruby-identifier">esc</span>=<span class="ruby-keyword kw">true</span>)
|
2113
|
-
<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>))
|
2114
|
-
<span class="ruby-keyword kw">end</span>
|
2115
|
-
</pre>
|
2116
|
-
</div>
|
2117
|
-
</div>
|
2118
|
-
</div>
|
2119
|
-
<div class="method">
|
2120
|
-
<div class="title">
|
2121
|
-
<a name="M000319"></a><b>unbracket</b>(bra=nil, ket=nil)
|
2122
|
-
</div>
|
2123
|
-
<div class="description">
|
2124
|
-
<p>
|
2125
|
-
Return a new string embraced by given brakets. If only one <a
|
2126
|
-
href="String.html#M000317">bracket</a> char is given it will be placed on
|
2127
|
-
either side.
|
2128
|
-
</p>
|
2129
|
-
<pre>
|
2130
|
-
"{unwrap me}".debracket('{') #=> "unwrap me"
|
2131
|
-
"--unwrap me!".debracket('--','!') #=> "unwrap me!"
|
2132
|
-
</pre>
|
2133
|
-
<p>
|
2134
|
-
CREDIT: Trans
|
2135
|
-
</p>
|
2136
|
-
</div>
|
2137
|
-
<div class="sourcecode">
|
2138
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000319_source')" id="l_M000319_source">+</a> ]</p>
|
2139
|
-
<div id="M000319_source" class="dyn-source">
|
2140
|
-
<pre>
|
2141
|
-
<span class="ruby-comment cmt"># File lib/core/facets/string/bracket.rb, line 37</span>
|
2142
|
-
<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>)
|
2143
|
-
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">bra</span>
|
2144
|
-
<span class="ruby-identifier">ket</span> = <span class="ruby-constant">BRA2KET</span>[<span class="ruby-identifier">bra</span>] <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">ket</span>
|
2145
|
-
<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>
|
2146
|
-
<span class="ruby-identifier">s</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">dup</span>
|
2147
|
-
<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>)
|
2148
|
-
<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>)
|
2149
|
-
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">s</span>
|
2150
|
-
<span class="ruby-keyword kw">else</span>
|
2151
|
-
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">m</span> = <span class="ruby-constant">BRA2KET</span>[ <span class="ruby-keyword kw">self</span>[<span class="ruby-value">0</span>,<span class="ruby-value">1</span>] ]
|
2152
|
-
<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>
|
2153
|
-
<span class="ruby-keyword kw">end</span>
|
2154
|
-
<span class="ruby-keyword kw">end</span>
|
2155
|
-
<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>
|
2156
|
-
<span class="ruby-keyword kw">end</span>
|
2157
|
-
</pre>
|
2158
|
-
</div>
|
2159
|
-
</div>
|
2160
|
-
</div>
|
2161
|
-
<div class="method">
|
2162
|
-
<div class="title">
|
2163
|
-
<a name="M000320"></a><b>unbracket!</b>(bra=nil, ket=nil)
|
2164
|
-
</div>
|
2165
|
-
<div class="description">
|
2166
|
-
<p>
|
2167
|
-
Inplace version of debraket.
|
2168
|
-
</p>
|
2169
|
-
<p>
|
2170
|
-
CREDIT: Trans
|
2171
|
-
</p>
|
2172
|
-
</div>
|
2173
|
-
<div class="sourcecode">
|
2174
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000320_source')" id="l_M000320_source">+</a> ]</p>
|
2175
|
-
<div id="M000320_source" class="dyn-source">
|
2176
|
-
<pre>
|
2177
|
-
<span class="ruby-comment cmt"># File lib/core/facets/string/bracket.rb, line 57</span>
|
2178
|
-
<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>)
|
2179
|
-
<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>) )
|
2180
|
-
<span class="ruby-keyword kw">end</span>
|
2181
|
-
</pre>
|
2182
|
-
</div>
|
2183
|
-
</div>
|
2184
|
-
</div>
|
2185
|
-
<div class="method">
|
2186
|
-
<div class="title">
|
2187
|
-
<a name="M000302"></a><b>upcase?</b>()
|
2188
|
-
</div>
|
2189
|
-
<div class="description">
|
2190
|
-
<p>
|
2191
|
-
Is the string upcase/uppercase?
|
2192
|
-
</p>
|
2193
|
-
<pre>
|
2194
|
-
"THIS".upcase? #=> true
|
2195
|
-
"This".upcase? #=> false
|
2196
|
-
"this".upcase? #=> false
|
2197
|
-
</pre>
|
2198
|
-
<p>
|
2199
|
-
CREDIT: Phil Tomson
|
2200
|
-
</p>
|
2201
|
-
</div>
|
2202
|
-
<div class="sourcecode">
|
2203
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000302_source')" id="l_M000302_source">+</a> ]</p>
|
2204
|
-
<div id="M000302_source" class="dyn-source">
|
2205
|
-
<pre>
|
2206
|
-
<span class="ruby-comment cmt"># File lib/core/facets/string/capitalized.rb, line 38</span>
|
2207
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">upcase?</span>
|
2208
|
-
<span class="ruby-identifier">upcase</span> <span class="ruby-operator">==</span> <span class="ruby-keyword kw">self</span>
|
2209
|
-
<span class="ruby-keyword kw">end</span>
|
2210
|
-
</pre>
|
2211
|
-
</div>
|
2212
|
-
</div>
|
2213
|
-
</div>
|
2214
|
-
<div class="method">
|
2215
|
-
<div class="title">
|
2216
|
-
<a name="M000306"></a><b>variablize</b>()
|
2217
|
-
</div>
|
2218
|
-
<div class="description">
|
2219
|
-
<p>
|
2220
|
-
Prepend an "@" to the beginning of a string to make a instance
|
2221
|
-
variable name. This also replaces non-valid characters with underscores.
|
2222
|
-
</p>
|
2223
|
-
</div>
|
2224
|
-
<div class="sourcecode">
|
2225
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000306_source')" id="l_M000306_source">+</a> ]</p>
|
2226
|
-
<div id="M000306_source" class="dyn-source">
|
2227
|
-
<pre>
|
2228
|
-
<span class="ruby-comment cmt"># File lib/core/facets/string/variablize.rb, line 7</span>
|
2229
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">variablize</span>
|
2230
|
-
<span class="ruby-identifier">v</span> = <span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/\W/</span>, <span class="ruby-value str">'_'</span>)
|
2231
|
-
<span class="ruby-node">"@#{v}"</span>
|
2232
|
-
<span class="ruby-keyword kw">end</span>
|
2233
|
-
</pre>
|
2234
|
-
</div>
|
2235
|
-
</div>
|
2236
|
-
</div>
|
2237
|
-
<div class="method">
|
2238
|
-
<div class="title">
|
2239
|
-
<a name="M000281"></a><b>word_wrap</b>( col_width=80 )
|
2240
|
-
</div>
|
2241
|
-
<div class="description">
|
2242
|
-
<p>
|
2243
|
-
Word wrap a string not exceeding max width.
|
2244
|
-
</p>
|
2245
|
-
<pre>
|
2246
|
-
puts "this is a test".word_wrap(4)
|
2247
|
-
</pre>
|
2248
|
-
<p>
|
2249
|
-
<em>produces</em>
|
2250
|
-
</p>
|
2251
|
-
<pre>
|
2252
|
-
this
|
2253
|
-
is a
|
2254
|
-
test
|
2255
|
-
</pre>
|
2256
|
-
<p>
|
2257
|
-
This is basic implementation of word wrap, but smart enough to suffice for
|
2258
|
-
most use cases.
|
2259
|
-
</p>
|
2260
|
-
<p>
|
2261
|
-
CREDIT: Gavin Kistner, Dayne Broderson
|
2262
|
-
</p>
|
2263
|
-
</div>
|
2264
|
-
<div class="sourcecode">
|
2265
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000281_source')" id="l_M000281_source">+</a> ]</p>
|
2266
|
-
<div id="M000281_source" class="dyn-source">
|
2267
|
-
<pre>
|
2268
|
-
<span class="ruby-comment cmt"># File lib/core/facets/string/word_wrap.rb, line 18</span>
|
2269
|
-
<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> )
|
2270
|
-
<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> )
|
2271
|
-
<span class="ruby-keyword kw">end</span>
|
2272
|
-
</pre>
|
2273
|
-
</div>
|
2274
|
-
</div>
|
2275
|
-
</div>
|
2276
|
-
<div class="method">
|
2277
|
-
<div class="title">
|
2278
|
-
<a name="M000282"></a><b>word_wrap!</b>( col_width=80 )
|
2279
|
-
</div>
|
2280
|
-
<div class="description">
|
2281
|
-
<p>
|
2282
|
-
As with <a href="String.html#M000281">word_wrap</a>, but modifies the
|
2283
|
-
string in place.
|
2284
|
-
</p>
|
2285
|
-
<p>
|
2286
|
-
CREDIT: Gavin Kistner, Dayne Broderson
|
2287
|
-
</p>
|
2288
|
-
</div>
|
2289
|
-
<div class="sourcecode">
|
2290
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000282_source')" id="l_M000282_source">+</a> ]</p>
|
2291
|
-
<div id="M000282_source" class="dyn-source">
|
2292
|
-
<pre>
|
2293
|
-
<span class="ruby-comment cmt"># File lib/core/facets/string/word_wrap.rb, line 26</span>
|
2294
|
-
<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> )
|
2295
|
-
<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> )
|
2296
|
-
<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> )
|
2297
|
-
<span class="ruby-keyword kw">self</span>
|
2298
|
-
<span class="ruby-keyword kw">end</span>
|
2299
|
-
</pre>
|
2300
|
-
</div>
|
2301
|
-
</div>
|
2302
|
-
</div>
|
2303
|
-
<div class="method">
|
2304
|
-
<div class="title">
|
2305
|
-
<a name="M000313"></a><b>words</b>()
|
2306
|
-
</div>
|
2307
|
-
<div class="description">
|
2308
|
-
<p>
|
2309
|
-
Returns an array of characters.
|
2310
|
-
</p>
|
2311
|
-
<pre>
|
2312
|
-
"abc 123".words #=> ["abc","123"]
|
2313
|
-
</pre>
|
2314
|
-
</div>
|
2315
|
-
<div class="sourcecode">
|
2316
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000313_source')" id="l_M000313_source">+</a> ]</p>
|
2317
|
-
<div id="M000313_source" class="dyn-source">
|
2318
|
-
<pre>
|
2319
|
-
<span class="ruby-comment cmt"># File lib/core/facets/string/words.rb, line 7</span>
|
2320
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">words</span>
|
2321
|
-
<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">split</span>(<span class="ruby-regexp re">/\s+/</span>)
|
2322
|
-
<span class="ruby-keyword kw">end</span>
|
2323
|
-
</pre>
|
2324
|
-
</div>
|
2325
|
-
</div>
|
2326
|
-
</div>
|
2327
|
-
</div>
|
2328
|
-
|
2329
|
-
</div>
|
2330
|
-
|
2331
|
-
</body>
|
2332
|
-
</html>
|