Class: String
Overview
String helpers
Constant Summary
Constants included from Doing::Color
Doing::Color::ATTRIBUTES, Doing::Color::ATTRIBUTE_NAMES, Doing::Color::COLORED_REGEXP
Instance Method Summary collapse
- #add_tags(tags, remove: false) ⇒ Object
- #add_tags!(tags, remove: false) ⇒ Object
-
#cap_first ⇒ Object
Capitalize on the first character on string.
- #dedup_tags ⇒ Object
-
#dedup_tags! ⇒ Object
Remove duplicate tags, leaving only first occurrence.
-
#highlight_tags(color = 'yellow') ⇒ String
Colorize @tags with ANSI escapes.
- #highlight_tags!(color = 'yellow') ⇒ Object
-
#ignore? ⇒ Boolean
Test if line should be ignored.
- #link_urls(opt = {}) ⇒ Object
-
#link_urls!(opt = {}) ⇒ Object
Turn raw urls into HTML links.
- #normalize_bool(default = :and) ⇒ Object
-
#normalize_bool!(default = :and) ⇒ Object
Convert a boolean string to a symbol.
- #normalize_case(default = :smart) ⇒ Object
-
#normalize_case! ⇒ Object
Convert a case sensitivity string to a symbol.
- #normalize_order(default = 'asc') ⇒ Object
-
#normalize_order!(default = 'asc') ⇒ String
Convert a sort order string to a qualified type.
- #normalize_trigger ⇒ Object
- #normalize_trigger! ⇒ Object
- #tag(tag, value: nil, remove: false, rename_to: nil, regex: false, single: false) ⇒ Object
- #tag!(tag, value: nil, remove: false, rename_to: nil, regex: false, single: false) ⇒ Object
-
#to_rx(distance) ⇒ String
Convert string to fuzzy regex.
- #to_tags ⇒ Object
-
#truncate(len, ellipsis: '...') ⇒ Object
Truncate to nearest word.
- #truncate!(len, ellipsis: '...') ⇒ Object
-
#truncmiddle(len, ellipsis: '...') ⇒ Object
Truncate string in the middle.
- #truncmiddle!(len, ellipsis: '...') ⇒ Object
-
#truthy? ⇒ Boolean
Test string for truthiness (0, "f", "false", "n", "no" all return false, case insensitive, otherwise true).
-
#uncolor ⇒ Object
Remove color escape codes.
- #uncolor! ⇒ Object
-
#wrap(len, pad: 0, indent: ' ', offset: 0, prefix: '', after: '', reset: '') ⇒ Object
Wrap string at word breaks, respecting tags.
Methods included from Doing::Color
attributes, coloring=, coloring?, #support?
Instance Method Details
#add_tags(tags, remove: false) ⇒ Object
#add_tags!(tags, remove: false) ⇒ Object
#cap_first ⇒ Object
Capitalize on the first character on string
#dedup_tags ⇒ Object
#dedup_tags! ⇒ Object
Remove duplicate tags, leaving only first occurrence
#highlight_tags(color = 'yellow') ⇒ String
Colorize @tags with ANSI escapes
#highlight_tags!(color = 'yellow') ⇒ Object
#ignore? ⇒ Boolean
Test if line should be ignored
#link_urls(opt = {}) ⇒ Object
#link_urls!(opt = {}) ⇒ Object
Turn raw urls into HTML links
#normalize_bool(default = :and) ⇒ Object
#normalize_bool!(default = :and) ⇒ Object
Convert a boolean string to a symbol
#normalize_case(default = :smart) ⇒ Object
#normalize_case! ⇒ Object
Convert a case sensitivity string to a symbol
#normalize_order(default = 'asc') ⇒ Object
#normalize_order!(default = 'asc') ⇒ String
Convert a sort order string to a qualified type
#normalize_trigger ⇒ Object
#normalize_trigger! ⇒ Object
#tag(tag, value: nil, remove: false, rename_to: nil, regex: false, single: false) ⇒ Object
#tag!(tag, value: nil, remove: false, rename_to: nil, regex: false, single: false) ⇒ Object
#to_rx(distance) ⇒ String
Convert string to fuzzy regex
#to_tags ⇒ Object
#truncate(len, ellipsis: '...') ⇒ Object
Truncate to nearest word
#truncate!(len, ellipsis: '...') ⇒ Object
#truncmiddle(len, ellipsis: '...') ⇒ Object
Truncate string in the middle
#truncmiddle!(len, ellipsis: '...') ⇒ Object
#truthy? ⇒ Boolean
Test string for truthiness (0, "f", "false", "n", "no" all return false, case insensitive, otherwise true)
#uncolor ⇒ Object
Remove color escape codes
#uncolor! ⇒ Object
#wrap(len, pad: 0, indent: ' ', offset: 0, prefix: '', after: '', reset: '') ⇒ Object
Wrap string at word breaks, respecting tags